Only include those parts of AVFoundation.framework which are strictly needed.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-12-22  Jer Noble  <jer.noble@apple.com>
2
3         Only include those parts of AVFoundation.framework which are strictly needed.
4         https://bugs.webkit.org/show_bug.cgi?id=166423
5
6         Reviewed by Eric Carlson.
7
8         * Modules/plugins/QuickTimePluginReplacement.mm:
9         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
10         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
11         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
12         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
13         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
14         * platform/mac/SerializedPlatformRepresentationMac.mm:
15         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
16         * platform/mac/WebVideoFullscreenController.mm:
17         * platform/mediastream/mac/AVAudioCaptureSource.mm:
18         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
19         * platform/mediastream/mac/AVMediaCaptureSource.mm:
20         * platform/mediastream/mac/AVVideoCaptureSource.mm:
21
22 2016-12-22  Jer Noble  <jer.noble@apple.com>
23
24         NULL-deref CRASH in WebCore::PlatformMediaSession::mediaType
25         https://bugs.webkit.org/show_bug.cgi?id=166407
26
27         Reviewed by Darin Adler.
28
29         In r207688, we added a facility in PlatformMediaSessionManager for safely walking through a
30         list of PlatformMediaSessions by replacing entries of deleted sessions with nullptr. We now
31         need to use those new iteration falicities in MediaSessionManageriOS.
32
33         In addition to the existing iterators, add one which takes a predicate, and returns the first
34         session which matches the predicate, or nullptr, if none do.
35
36         * platform/audio/PlatformMediaSessionManager.cpp:
37         (WebCore::PlatformMediaSessionManager::findSession):
38         (WebCore::PlatformMediaSessionManager::anyOfSessions):
39         * platform/audio/PlatformMediaSessionManager.h:
40         (WebCore::PlatformMediaSessionManager::sessions): Deleted.
41         * platform/audio/ios/MediaSessionManagerIOS.mm:
42         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
43         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession):
44         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
45         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground):
46         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground):
47
48 2016-12-22  Jer Noble  <jer.noble@apple.com>
49
50         Muted media element playback should not interrupt other audio playback
51         https://bugs.webkit.org/show_bug.cgi?id=166347
52
53         Reviewed by Eric Carlson.
54
55         Test: TestWebKitAPI/WebKit/ios/AudioSessionCategoryIOS.mm
56
57         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
58         (PlatformMediaSessionManager::updateSessionState):
59
60 2016-12-22  Jer Noble  <jer.noble@apple.com>
61
62         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
63         https://bugs.webkit.org/show_bug.cgi?id=166421
64
65         Reviewed by Eric Carlson.
66
67         * platform/spi/mac/AVFoundationSPI.h:
68
69 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
70
71         AVPlayerLayer isn't available on every system
72         https://bugs.webkit.org/show_bug.cgi?id=166399
73
74         Reviewed by Jer Noble.
75
76         No new tests, prevents a crash that can't be reproduced on a test system.
77
78         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Use SOFT_LINK_CLASS_OPTIONAL.
79
80 2016-12-21  Tim Horton  <timothy_horton@apple.com>
81
82         TileGrid revalidates tiles twice during flush, first with wrong visible rect
83         https://bugs.webkit.org/show_bug.cgi?id=166406
84
85         Reviewed by Simon Fraser.
86
87         No new tests; existing tests cover this code, this is just a perf win,
88         specifically reducing the amount of layer churn during zooming.
89
90         * platform/graphics/ca/TileGrid.cpp:
91         (WebCore::TileGrid::setScale):
92         Schedule a revalidation, which will happen later in the same flush,
93         instead of doing it immediately. Doing it immediately is problematic,
94         because we're currently in the middle of a GraphicsLayer tree flush,
95         and don't have the complete picture of the new state yet. We're guaranteed
96         to get the new scale *before* the flush calls revalidateTiles.
97
98 2016-12-21  Tim Horton  <timothy_horton@apple.com>
99
100         TileGrid creates new tiles when there are recyclable tiles about to be removed
101         https://bugs.webkit.org/show_bug.cgi?id=166408
102
103         Reviewed by Simon Fraser.
104
105         No new tests; existing tests cover this code, this is just a perf win,
106         specifically reducing the amount of layer churn during zooming.
107
108         * platform/graphics/ca/TileGrid.cpp:
109         (WebCore::TileGrid::revalidateTiles):
110         Remove all the tiles that will be removed first, then add new tiles.
111         Strictly ordering it this way means that tiles will be removed, go into
112         the LayerPool, then be pulled back out of the LayerPool to sit in the
113         newly-covered areas. Previously, we would sometimes make new layers
114         for newly-covered areas, and then remove unneeded but otherwise recyclable
115         tiles, which would then just go sit in the LayerPool (and often get
116         pruned, wastefully).
117
118 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
119
120         [MediaStream] Update media-stream-event-constructor test
121         https://bugs.webkit.org/show_bug.cgi?id=166398
122
123         Reviewed by Jer Noble.
124
125         No new tests, updated existing test.
126
127         * Modules/mediastream/MediaStreamEvent.idl: Mark eventInitDict as optional.
128
129 2016-12-21  Jiewen Tan  <jiewen_tan@apple.com>
130
131         WebKit should set Original URL of a download request correctly
132         https://bugs.webkit.org/show_bug.cgi?id=166394
133         <rdar://problem/25391382>
134
135         Reviewed by Alex Christensen.
136
137         WebKit should set Original URL of a download request correctly if the download
138         is initiated by clicking on a link with target=_blank.
139
140         Manually tested as the requested test infrastructure doesn't exist yet. We need actual
141         loading process for API test such that we could simulate the real situation which
142         PolicyDownload is only set when we receive responds. Currently we can only set
143         PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate
144         the following process: load starts -> PolicyUse -> creates a new WebView ->
145         respond receives -> PolicyDownload -> downloads.
146
147         * loader/FrameLoader.cpp:
148         (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
149
150 2016-12-21  Sam Weinig  <sam@webkit.org>
151
152         [WebIDL] Remove custom binding for ErrorEvent
153         https://bugs.webkit.org/show_bug.cgi?id=166345
154
155         Reviewed by Anders Carlsson.
156
157         * CMakeLists.txt:
158         * WebCore.xcodeproj/project.pbxproj:
159         * bindings/js/JSBindingsAllInOne.cpp:
160         * bindings/js/JSErrorEventCustom.cpp: Removed.
161         Remove JSErrorEventCustom.cpp
162
163         * ForwardingHeaders/heap/HandleTypes.h: Added.
164         Add forwarding header for HandleTypes.h
165
166         * bindings/js/JSErrorHandler.cpp:
167         (WebCore::JSErrorHandler::handleEvent):
168         Switch to using JSDOMConvert and call the updated name for the error getter.
169
170         * bindings/js/ScriptController.h:
171         * bindings/js/SerializedScriptValue.h:
172         Remove unnecessary forward declaration of ScriptValue.
173
174         * bindings/js/WorkerScriptController.cpp:
175         (WebCore::WorkerScriptController::evaluate):
176         * dom/ScriptExecutionContext.cpp:
177         (WebCore::ScriptExecutionContext::sanitizeScriptError):
178         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
179         * dom/ScriptExecutionContext.h:
180         * workers/WorkerMessagingProxy.cpp:
181         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
182         Update type that sanitizeScriptError takes from a ScriptValue to a Strong<Unknown>.
183
184         * bindings/scripts/CodeGeneratorJS.pm:
185         (GenerateCallWith):
186         * bindings/scripts/IDLAttributes.txt:
187         Add a new extended attributes option for the CallWith, GlobalObject, that passes the global object.
188
189         * dom/ErrorEvent.cpp:
190         (WebCore::ErrorEvent::ErrorEvent):
191         (WebCore::ErrorEvent::error):
192         (WebCore::ErrorEvent::trySerializeError):
193         (WebCore::ErrorEvent::sanitizedErrorValue): Deleted.
194         * dom/ErrorEvent.h:
195         Store a Strong<Unknown> directly, rather than a ScriptValue. Rename sanitizedErrorValue to 
196         just error to match the IDL.
197
198         * dom/ErrorEvent.idl:
199         Remove CustomGetter.
200
201 2016-12-21  Ryosuke Niwa  <rniwa@webkit.org>
202
203         Modernize findPlainText
204         https://bugs.webkit.org/show_bug.cgi?id=166299
205
206         Reviewed by Sam Weinig.
207
208         Modernized findPlainText by merging the static version of it into it
209         and extracting the main nested loop out as findPlainTextOffset.
210
211         No new tests since there should be no behavioral change.
212
213         * editing/TextIterator.cpp:
214         (WebCore::findPlainTextOffset):
215         (WebCore::findPlainText):
216
217 2016-12-21  John Wilander  <wilander@apple.com>
218
219         Switch to a blacklist model for restricted Accept headers in simple CORS requests
220         https://bugs.webkit.org/show_bug.cgi?id=166363
221
222         Reviewed by Alex Christensen.
223
224         Updated existing tests.
225
226         * platform/network/HTTPParsers.cpp:
227         (WebCore::isDelimiterCharacter):
228             Convenience function for checking delimiter characters according to:
229             https://tools.ietf.org/html/rfc7230#section-3.2.6 
230         (WebCore::isValidAcceptHeaderValue):
231             Now uses WebCore::isDelimiterCharacter() to blacklist delimiter characters
232             instead of a whitelist of accepted non-alphanumeric characters.
233
234 2016-12-21  Beth Dakin  <bdakin@apple.com>
235
236         Holding down on candidates in the TouchBar should show panel on screen
237         https://bugs.webkit.org/show_bug.cgi?id=166367
238         -and corresponding-
239         <rdar://problem/28479236>
240
241         Reviewed by Tim Horton.
242
243         Expose the version of setCandidates: that takes a rect.
244         * platform/spi/cocoa/NSTouchBarSPI.h:
245
246 2016-12-21  Michael Catanzaro  <mcatanzaro@igalia.com>
247
248         Extensions3DOpenGL[ES] constructor should not be explicit
249         https://bugs.webkit.org/show_bug.cgi?id=166296
250
251         Reviewed by Darin Adler.
252
253         These constructors used to only have one parameter. Now they have two and they're both
254         mandatory.
255
256         * platform/graphics/opengl/Extensions3DOpenGL.h:
257         * platform/graphics/opengl/Extensions3DOpenGLES.h:
258
259 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
260
261         [MediaStream] MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer can be called before it has a media stream
262         https://bugs.webkit.org/show_bug.cgi?id=166344
263         <rdar://problem/29763143>
264
265         Reviewed by Jer Noble.
266
267         There is a very narrow window during which a MediaStream player can be asked for its layer 
268         before it has a steam, resulting in a NULL dereference and crash. Don't do that.
269
270         Unable to reproduce.
271
272         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
273         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
274
275 2016-12-21  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
276
277         [Readable Streams API] Fix test in readableByteStreamCallPullIfNeeded
278         https://bugs.webkit.org/show_bug.cgi?id=166312
279
280         Reviewed by Youenn Fablet.
281
282         Add a new function to evaluate if calling a pull function is
283         required as per specification.
284
285         No new test required.
286
287         * Modules/streams/ReadableByteStreamInternals.js:
288         (readableByteStreamControllerShouldCallPull): Added.
289         (readableByteStreamControllerCallPullIfNeeded):
290
291 2016-12-21  Simon Fraser  <simon.fraser@apple.com>
292
293         Fixed bars are positioned incorrectly when there are header and footer banners
294         https://bugs.webkit.org/show_bug.cgi?id=166302
295         rdar://problem/29727145
296
297         Reviewed by Tim Horton.
298         
299         The computation of the visual viewport was wrong in the presence of header and footer
300         banners. It needs to take into account the fact that "visibleContentRect" applies to the
301         scroll view contents, which includes header and footer (unscaled), and the potentially scaled
302         document, and we need to return a rectangle in unscaled document coordinates.
303         
304         Make a static method in FrameView to do this computation, and call it from FrameView::visualViewportRect()
305         and ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition().
306         
307         layoutViewportForScrollPosition() is only called on Mac, so remove the #ifdeffing related to scaling, 
308         and pass in an unscaled scroll position.
309
310         Test: fast/visual-viewport/zoomed-fixed-header-and-footer.html
311
312         * page/FrameView.cpp:
313         (WebCore::FrameView::updateLayoutViewport):
314         (WebCore::FrameView::maxStableLayoutViewportOrigin):
315         (WebCore::FrameView::visibleDocumentRect):
316         (WebCore::FrameView::visualViewportRect):
317         * page/FrameView.h:
318         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
319         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
320         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
321         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
322
323 2016-12-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
324
325         [CMake] Remove remaining INDIE_UI related entries.
326         https://bugs.webkit.org/show_bug.cgi?id=165881
327
328         Unreviewed.
329
330         * CMakeLists.txt:
331
332 2016-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
333
334         [Cairo] Conditional jump or move depends on uninitialised value(s)
335         https://bugs.webkit.org/show_bug.cgi?id=166058
336
337         Reviewed by Michael Catanzaro.
338
339         Initialize x and y members of cairo_glyph_t struct before passing it to cairo_glyph_path.
340
341         * platform/graphics/cairo/FontCairo.cpp:
342         (WebCore::CairoGlyphToPathTranslator::path):
343
344 2016-12-20  Myles C. Maxfield  <mmaxfield@apple.com>
345
346         Skia lighter wght variation looks bolder than regular
347         https://bugs.webkit.org/show_bug.cgi?id=165948
348
349         Reviewed by Antti Koivisto.
350
351         Test: fast/text/variations/default-value.html
352
353         This patch inspects the font's information regarding variations. It uses this information
354         to work around a bug in CoreText where default variation values were not getting applied.
355         This workaround is placed behind a version check and the macro name
356         "WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG" so we know to delete it whenever
357         possible. It also uses the minimum and maximum supported values for the axis to clamp our
358         variation values to the closest supported point, which is in line with a recent edit to
359         the fonts spec:
360         https://github.com/w3c/csswg-drafts/commit/52b802ac38619286a30662dceb71b8a29fa72f42
361         This clamping behavior also revealed another bug in CoreText, which was worked around
362         behind another version check and macro name WORKAROUND_CORETEXT_VARIATIONS_EXTENTS_BUG so
363         we know to delete it whenever possible.
364
365         * platform/graphics/cocoa/FontCacheCoreText.cpp:
366         (WebCore::defaultVariationValues):
367         (WebCore::preparePlatformFont):
368
369 2016-12-20  Tim Horton  <timothy_horton@apple.com>
370
371         Remove a duplicate reference to ScrollingMomentumCalculatorMac.h in the Xcode project
372
373         Rubber-stamped by Sam Weinig.
374
375         * WebCore.xcodeproj/project.pbxproj:
376
377 2016-12-20  Tim Horton  <timothy_horton@apple.com>
378
379         Remove a duplicate reference to ScrollingMomentumCalculatorMac.mm in the Xcode project
380
381         Rubber-stamped by Sam Weinig.
382
383         * WebCore.xcodeproj/project.pbxproj:
384
385 2016-12-20  Alex Christensen  <achristensen@webkit.org>
386
387         Remove initEvent quirk
388         https://bugs.webkit.org/show_bug.cgi?id=166284
389
390         Reviewed by Dan Bernstein.
391
392         We added this quirk in r207908 and expanded it in r209946 and r210034.
393         Many web compatibility issues have been found, which leads us to believe that many more exist.
394         This reverts the behavior to match how it was before r203848.
395         This change was proposed to the spec in https://github.com/whatwg/dom/issues/387
396
397         * dom/Event.cpp:
398         (WebCore::Event::initEventForBindings): Deleted.
399         * dom/Event.h:
400         * dom/Event.idl:
401         * platform/RuntimeApplicationChecks.h:
402         * platform/RuntimeApplicationChecks.mm:
403         (WebCore::IOSApplication::isBaiduNuomi): Deleted.
404         (WebCore::IOSApplication::isAutoNaviAMap): Deleted.
405         (WebCore::IOSApplication::isFlipboard): Deleted.
406
407 2016-12-20  JF Bastien  <jfbastien@apple.com>
408
409         INDIE_UI: fix cmake build
410         https://bugs.webkit.org/show_bug.cgi?id=166288
411
412         Reviewed by Mark Lam.
413
414         Bug #165881 didn't remove a file from cmake.
415
416         * PlatformMac.cmake:
417
418 2016-12-20  Alex Christensen  <achristensen@webkit.org>
419
420         Fix clean Windows build after r210029
421         https://bugs.webkit.org/show_bug.cgi?id=165881
422
423         * DerivedSources.cpp:
424
425 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
426
427         Address some style problems found by static analysis
428         https://bugs.webkit.org/show_bug.cgi?id=165975
429
430         Reviewed by Alex Christensen.
431
432         Correct the const-correctness of functions that are implemented using stricter
433         const declarations.
434
435         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
436
437         * inspector/InspectorCSSAgent.h: Declare the method overrides properly to match
438         the stricter const declarations in the implementation files.
439         * inspector/InspectorDOMAgent.h: Ditto.
440         * inspector/InspectorPageAgent.h: Ditto.
441         * inspector/InspectorTimelineAgent.h: Ditto.
442         * inspector/PageDebuggerAgent.h: Ditto.
443         * platform/graphics/ANGLEWebKitBridge.cpp:
444         (WebCore::ANGLEWebKitBridge::setResources): Pass by const reference.
445         * platform/graphics/ANGLEWebKitBridge.h:
446         (WebCore::ANGLEWebKitBridge::getResources): Return a const reference.
447         * platform/mediastream/RealtimeMediaSource.cpp:
448         (WebCore::RealtimeMediaSource::selectSettings): Use a lambda that takes
449         a const reference, rather than copying the maps while searching.
450
451 2016-12-20  Sam Weinig  <sam@webkit.org>
452
453         [WebIDL] Remove custom binding for WorkerGlobalScope::importScripts
454         https://bugs.webkit.org/show_bug.cgi?id=166243
455
456         Reviewed by Alex Christensen.
457
458         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
459         (WebCore::JSWorkerGlobalScope::importScripts): Deleted.
460         * workers/WorkerGlobalScope.idl:
461         Import scripts can now be trivially generated.
462
463 2016-12-20  Zalan Bujtas  <zalan@apple.com>
464
465         SVG elements should inherit the root's flow thread state.
466         https://bugs.webkit.org/show_bug.cgi?id=166173
467         rdar://problem/29704862
468
469         Reviewed by Simon Fraser.
470
471         When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either.
472
473         Test: fast/multicol/svg-inside-multicolumn.html
474
475         * rendering/RenderObject.cpp:
476         (WebCore::RenderObject::computedFlowThreadState):
477         * rendering/RenderObject.h:
478         (WebCore::RenderObject::isProgress):
479         (WebCore::RenderObject::isRenderSVGBlock):
480         * rendering/svg/RenderSVGBlock.h:
481
482 2016-12-20  Alex Christensen  <achristensen@webkit.org>
483
484         Fix yet another app that uses initEvent with fewer than 3 parameters
485         https://bugs.webkit.org/show_bug.cgi?id=166257
486         <rdar://problem/29420268>
487
488         Reviewed by Sam Weinig.
489
490         * dom/Event.cpp:
491         (WebCore::Event::initEventForBindings):
492         * platform/RuntimeApplicationChecks.h:
493         * platform/RuntimeApplicationChecks.mm:
494         (WebCore::IOSApplication::isAutoNaviAMap):
495         AutoNavi amap has content that uses initEvent with one parameter. This quirk is needed here, too.
496
497 2016-12-20  Dean Jackson  <dino@apple.com>
498
499         Remove INDIE_UI
500         https://bugs.webkit.org/show_bug.cgi?id=165881
501         <rdar://problem/29672532>
502
503         Reviewed by Simon Fraser.
504
505         The Indie UI work has been discontinued.
506
507         * Configurations/FeatureDefines.xcconfig:
508         * Modules/indieui/UIRequestEvent.cpp: Removed.
509         * Modules/indieui/UIRequestEvent.h: Removed.
510         * Modules/indieui/UIRequestEvent.idl: Removed.
511         * WebCore.xcodeproj/project.pbxproj:
512         * dom/Element.cpp:
513         (WebCore::Element::setUIActions): Deleted.
514         (WebCore::Element::UIActions): Deleted.
515         * dom/Element.h:
516         * dom/Element.idl:
517         * dom/EventNames.in:
518         * dom/Node.cpp:
519         (WebCore::Node::dispatchUIRequestEvent): Deleted.
520         * dom/Node.h:
521
522 2016-12-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>
523
524         [Readable Streams API] Implement readableByteStreamControllerCallPullIfNeeded()
525         https://bugs.webkit.org/show_bug.cgi?id=166022
526
527         Reviewed by Youenn Fablet.
528
529         Implemented readableByteStreamControllerCallPullIfNeeded(). This function is
530         in particular called when a new ReadableByteStreamController is created; hence,
531         ReadableByteStreamController constructor has been updated.
532
533         Added 3 tests to check behaviour in case of success/failure of the start and pull functions
534         associated to the underlyingByteSource.
535
536         * Modules/streams/ReadableByteStreamInternals.js:
537         (privateInitializeReadableByteStreamController): Updated handling of underlyingByteSource
538         start function (especially with call to readableByteStreamControllerCallPullIfNeeded).
539         (isReadableStreamBYOBReader): Added.
540         (readableStreamHasBYOBReader): Added.
541         (readableStreamHasDefaultReader): Added.
542         (readableByteStreamControllerCallPullIfNeeded): Added.
543         * Modules/streams/ReadableStreamInternals.js:
544         (privateInitializeReadableStreamDefaultController): Added missing asserts.
545         * bindings/js/WebCoreBuiltinNames.h: Added readIntoRequests.
546
547 2016-12-20  Sam Weinig  <sam@webkit.org>
548
549         [DataCue] Un-prefix DataCue and remove custom bindings
550         https://bugs.webkit.org/show_bug.cgi?id=166087
551
552         Reviewed by Eric Carlson.
553
554         * CMakeLists.txt:
555         * WebCore.xcodeproj/project.pbxproj:
556         * bindings/js/JSBindingsAllInOne.cpp:
557         * bindings/js/JSDataCueCustom.cpp: Removed.
558         Remove JSDataCueCustom.cpp
559
560         * bindings/js/JSTextTrackCueCustom.cpp:
561         (WebCore::toJSNewlyCreated):
562         Remove out of date comment.
563
564         * bindings/scripts/CodeGeneratorJS.pm:
565         (GenerateConstructorDefinition):
566         Update constructor generation code to use JSDOMConvert.
567
568         * html/track/DataCue.cpp:
569         (WebCore::DataCue::DataCue):
570         (WebCore::DataCue::~DataCue):
571         (WebCore::DataCue::data):
572         (WebCore::DataCue::setData):
573         (WebCore::DataCue::cueContentsMatch):
574         (WebCore::DataCue::value):
575         (WebCore::DataCue::setValue):
576         (WebCore::DataCue::valueOrNull):
577         * html/track/DataCue.h:
578         * html/track/DataCue.idl:
579         * platform/SerializedPlatformRepresentation.h:
580         Remove DATACUE_VALUE define from web exposed classes, so the interface can
581         be the same on all platforms. Platforms that don't support DATACUE_VALUE will
582         just never have any value. Also remove custom annotations.
583
584 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
585
586         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
587         https://bugs.webkit.org/show_bug.cgi?id=165317
588         <rdar://problem/29490956>
589
590         Reviewed by Dean Jackson.
591
592         Implements the changes drafted in the latest iteration of the Scroll Snap Module Level 1 spec, which uses a
593         snap-area and snap-port-based method for determining snap positions in a scroll snapping container.
594         Additionally, removes the now-obsolete and prefixed implementation of the scroll snap spec and refactors all
595         affected layout tests to use the new CSS properties. Also adds new layout tests covering some behaviors detailed
596         in the new version of the spec, such as scroll snapping with transformed child elements.
597
598         See below for more detailed descriptions of the changes.
599
600         Tests: css3/scroll-snap/scroll-snap-2d-change-axis-type.html
601                css3/scroll-snap/scroll-snap-2d-offsets-computed-independently.html
602                css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin.html
603                css3/scroll-snap/scroll-snap-children-with-transforms.html
604                css3/scroll-snap/scroll-snap-positions-mainframe.html
605                css3/scroll-snap/scroll-snap-positions-overflow-resize.html
606                css3/scroll-snap/scroll-snap-positions.html
607                css3/scroll-snap/scroll-snap-style-changed-align.html
608                css3/scroll-snap/scroll-snap-with-scroll-padding.html
609
610         * WebCore.xcodeproj/project.pbxproj:
611         * css/CSSCalculationValue.cpp:
612         (WebCore::hasDoubleValue):
613
614         Removed use of length repeat.
615
616         * css/CSSComputedStyleDeclaration.cpp:
617         (WebCore::valueForScrollSnapType):
618         (WebCore::valueForScrollSnapAlignment):
619         (WebCore::ComputedStyleExtractor::propertyValue):
620         (WebCore::scrollSnapDestination): Deleted.
621         (WebCore::scrollSnapPoints): Deleted.
622         (WebCore::scrollSnapCoordinates): Deleted.
623
624         Removed helper functions used to create CSS values for scroll snap coordinates and destination, and added
625         helpers for computed scroll snap type (a combination of axis and strictness values) as well as scroll snap align
626         (an alignment value per axis).
627
628         * css/CSSPrimitiveValue.cpp:
629         (WebCore::isValidCSSUnitTypeForDoubleConversion):
630         (WebCore::isStringType):
631         (WebCore::CSSPrimitiveValue::cleanup):
632         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
633         (WebCore::CSSPrimitiveValue::cloneForCSSOM):
634         (WebCore::CSSPrimitiveValue::equals):
635
636         Removed usages of the length repeat type, since repeat(*) is no longer being used anywhere.
637
638         * css/CSSPrimitiveValue.h:
639         * css/CSSPrimitiveValueMappings.h:
640         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
641         (WebCore::CSSPrimitiveValue::operator ScrollSnapStrictness):
642         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxis):
643         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxisAlignType):
644         (WebCore::CSSPrimitiveValue::operator ScrollSnapType): Deleted.
645
646         Added CSSPrimitiveValue mappings to ScrollSnapAxisAlignType, ScrollSnapStrictness, and ScrollSnapAxis. Removed
647         the old ScrollSnapType mapping.
648
649         * css/CSSProperties.json:
650
651         Replaced the old scroll snap CSS properties with the new ones. Note that scroll-snap-margin and scroll-padding
652         have 4 shorthands each, for the individual top/bottom/left/right values.
653
654         * css/CSSValueKeywords.in:
655
656         Added CSS keywords {x, y}, which are necessary to support the new scroll snapping properties.
657
658         * css/LengthRepeat.h: Removed.
659
660         Removed LengthRepeat entirely. This represented the `repeat(<length>)` CSS value, which was only used for the
661         scroll-snap-points-x and scroll-snap-points-y values.
662
663         * css/StyleBuilderConverter.h:
664         (WebCore::StyleBuilderConverter::convertScrollSnapType):
665         (WebCore::StyleBuilderConverter::convertScrollSnapAlign):
666         (WebCore::StyleBuilderConverter::parseSnapCoordinate): Deleted.
667         (WebCore::StyleBuilderConverter::convertScrollSnapPoints): Deleted.
668         (WebCore::StyleBuilderConverter::convertSnapCoordinatePair): Deleted.
669         (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates): Deleted.
670
671         Added helper functions to convert scroll snap type and scroll snap alignment from parsed CSS values to their
672         primary representation in WebCore as ScrollSnapType and ScrollSnapAlign. These methods assume that the given
673         CSS values have successfully cleared the parsing step and are represented as CSSValueLists or length 1 or 2.
674
675         * css/StyleBuilderCustom.h:
676         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX): Deleted.
677         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX): Deleted.
678         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY): Deleted.
679         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY): Deleted.
680         * css/StyleProperties.cpp:
681         (WebCore::StyleProperties::getPropertyValue):
682         (WebCore::StyleProperties::asText):
683
684         Adds support for the scroll-snap-margin and scroll-padding.
685
686         * css/parser/CSSParser.cpp:
687         (WebCore::isValidKeywordPropertyAndValue):
688         (WebCore::CSSParser::parseValue):
689         (WebCore::isScrollSnapAxisAlign):
690         (WebCore::isScrollSnapStrictness):
691         (WebCore::CSSParser::parseScrollSnapAlign):
692         (WebCore::CSSParser::parseScrollSnapType):
693         (WebCore::CSSParser::parseNonElementSnapPoints): Deleted.
694         (WebCore::CSSParser::parseScrollSnapPositions): Deleted.
695         (WebCore::CSSParser::parseScrollSnapDestination): Deleted.
696         (WebCore::CSSParser::parseScrollSnapCoordinate): Deleted.
697         * css/parser/CSSParser.h:
698
699         Removed references to LengthRepeat, and added support for parsing new scroll snapping properties. Scroll snap
700         margin and scroll padding, along with their shorthands, are parsed using the same helper functions as normal
701         margin and padding. For type and align, I added new helper functions that build up lists of 1 or 2
702         CSSPrimitiveValues for each of the properties.
703
704         Parsing scroll-snap-align is straightforward -- we either have one or two values in the set {none, start,
705         center, end}. For scroll-snap-type, we allow a single axis value {x, y, inline, block, both}, or a single
706         strictness value {none, proximity, mandatory}, or an axis value followed by a non-'none' strictness (i.e. either
707         proximity or mandatory).
708
709         * css/parser/CSSParserFastPaths.cpp:
710         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
711         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
712         * css/parser/CSSParserValues.cpp:
713         (WebCore::CSSParserValue::createCSSValue):
714
715         Removed references to LengthRepeat.
716
717         * css/parser/CSSPropertyParser.cpp:
718         (WebCore::CSSPropertyParser::parseSingleValue):
719         (WebCore::CSSPropertyParser::parseShorthand):
720         (WebCore::consumeSnapPointCoordinateList): Deleted.
721         (WebCore::consumeScrollSnapCoordinate): Deleted.
722         (WebCore::consumeScrollSnapDestination): Deleted.
723         (WebCore::consumeScrollSnapPoints): Deleted.
724         (WebCore::consumeScrollSnapAlign):
725         (WebCore::consumeScrollSnapType):
726         (WebCore::CSSPropertyParser::parseSingleValue):
727
728         Added parsing for the longhand properties of scroll-snap-margin and scroll-padding, which use the existing
729         consumeLength and consumeLengthOrPercent helpers, respectively. Removed code for parsing scroll snap
730         coordinates, destinations and points. Added parsing logic for align and type.
731
732         * page/scrolling/AxisScrollSnapOffsets.cpp:
733         (WebCore::computeScrollSnapPortOrAreaRect):
734         (WebCore::computeScrollSnapAlignOffset):
735         (WebCore::snapOffsetsToString):
736         (WebCore::snapPortOrAreaToString):
737         (WebCore::updateSnapOffsetsForScrollableArea):
738         (WebCore::appendChildSnapOffsets): Deleted.
739         (WebCore::destinationOffsetForViewSize): Deleted.
740         (WebCore::updateFromStyle): Deleted.
741         (WebCore::styleUsesElements): Deleted.
742
743         Overhauled updateSnapOffsetsForScrollableArea to work with the new scroll snapping model. In the new way of
744         computing scroll snap offsets, we:
745
746         Compute the scroll container's scroll snap port, which is the padding box inset by the scroll padding
747         For each child with snap positions (i.e. scroll-snap-align is not none on both axes)
748           Compute the child's scroll snap area, which is the bounding box of the transformed border box
749             If the container snaps along the horizontal axis and the snap area contributes a horizontal snap offset:
750               Emit the distance from the alignment offset in the horizontal of the snap port to the corresponding offset
751               in the snap area as a snap position.
752             If the container snaps along the vertical axis and the snap area contributes a vertical snap offset:
753               Emit the distance from the alignment offset in the vertical of the snap port to the corresponding offset
754               in the snap area as a snap position.
755         For the snap offsets in each axis, if there is at least one snap offset:
756           Clamp the offsets to the min and max scroll offsets
757           Ensure that the offsets are sorted and do not contain duplicated offsets
758
759         * platform/cocoa/ScrollController.mm:
760         (WebCore::ScrollController::updateScrollSnapState):
761
762         Clear out the ScrollController's snap offsets and state along an axis when its ScrollableArea no longer has snap
763         offsets in that axis.
764
765         * rendering/RenderBox.cpp:
766         (WebCore::RenderBox::styleWillChange):
767         (WebCore::RenderBox::willBeRemovedFromTree):
768         * rendering/RenderLayerModelObject.cpp:
769         (WebCore::scrollSnapContainerRequiresUpdateForStyleUpdate):
770         (WebCore::RenderLayerModelObject::styleDidChange):
771         * rendering/RenderView.cpp:
772         (WebCore::RenderView::registerBoxWithScrollSnapPositions):
773         (WebCore::RenderView::unregisterBoxWithScrollSnapPositions):
774         (WebCore::RenderView::registerBoxWithScrollSnapCoordinates): Deleted.
775         (WebCore::RenderView::unregisterBoxWithScrollSnapCoordinates): Deleted.
776         * rendering/RenderView.h:
777
778         Tweaked the scroll snap child registration logic. registerBoxWithScrollSnapCoordinates is renamed to
779         unregisterBoxWithScrollSnapPositions, since the notion of scroll snap coordinates no longer exists, and instead
780         of checking if the list of scroll snap coordinates is empty for the absence of scroll positions, we instead
781         check for a computed scroll snap align that is not none on both axes.
782
783         * rendering/style/RenderStyle.cpp:
784         (WebCore::RenderStyle::initialScrollSnapType):
785         (WebCore::RenderStyle::initialScrollSnapAlign):
786         (WebCore::RenderStyle::scrollSnapArea):
787         (WebCore::RenderStyle::scrollSnapPort):
788         (WebCore::RenderStyle::scrollSnapType):
789         (WebCore::RenderStyle::scrollPadding):
790         (WebCore::RenderStyle::scrollPaddingTop):
791         (WebCore::RenderStyle::scrollPaddingBottom):
792         (WebCore::RenderStyle::scrollPaddingLeft):
793         (WebCore::RenderStyle::scrollPaddingRight):
794         (WebCore::RenderStyle::scrollSnapAlign):
795         (WebCore::RenderStyle::scrollSnapMargin):
796         (WebCore::RenderStyle::scrollSnapMarginTop):
797         (WebCore::RenderStyle::scrollSnapMarginBottom):
798         (WebCore::RenderStyle::scrollSnapMarginLeft):
799         (WebCore::RenderStyle::scrollSnapMarginRight):
800         (WebCore::RenderStyle::setScrollSnapType):
801         (WebCore::RenderStyle::setScrollPaddingTop):
802         (WebCore::RenderStyle::setScrollPaddingBottom):
803         (WebCore::RenderStyle::setScrollPaddingLeft):
804         (WebCore::RenderStyle::setScrollPaddingRight):
805         (WebCore::RenderStyle::setScrollSnapAlign):
806         (WebCore::RenderStyle::setScrollSnapMarginTop):
807         (WebCore::RenderStyle::setScrollSnapMarginBottom):
808         (WebCore::RenderStyle::setScrollSnapMarginLeft):
809         (WebCore::RenderStyle::setScrollSnapMarginRight):
810         (WebCore::RenderStyle::initialScrollSnapDestination): Deleted.
811         (WebCore::RenderStyle::initialScrollSnapCoordinates): Deleted.
812         (WebCore::RenderStyle::scrollSnapPointsX): Deleted.
813         (WebCore::RenderStyle::scrollSnapPointsY): Deleted.
814         (WebCore::RenderStyle::scrollSnapDestination): Deleted.
815         (WebCore::RenderStyle::scrollSnapCoordinates): Deleted.
816         (WebCore::RenderStyle::setScrollSnapPointsX): Deleted.
817         (WebCore::RenderStyle::setScrollSnapPointsY): Deleted.
818         (WebCore::RenderStyle::setScrollSnapDestination): Deleted.
819         (WebCore::RenderStyle::setScrollSnapCoordinates): Deleted.
820         * rendering/style/RenderStyle.h:
821         (WebCore::RenderStyle::initialScrollSnapMargin):
822         (WebCore::RenderStyle::initialScrollPadding):
823         (WebCore::RenderStyle::scrollSnapType): Deleted.
824         (WebCore::RenderStyle::setScrollSnapType): Deleted.
825         (WebCore::RenderStyle::initialScrollSnapType): Deleted.
826         (WebCore::RenderStyle::initialScrollSnapPointsX): Deleted.
827         (WebCore::RenderStyle::initialScrollSnapPointsY): Deleted.
828
829         Added boilerplate code for returning various new scroll snap style properties, and removed similar code for
830         handling the old scroll snap properties.
831
832         * rendering/style/RenderStyleConstants.h:
833
834         Added three new enum classes:
835         - ScrollSnapStrictness represents the strictness of scroll snapping along one or both axes
836         - ScrollSnapAxis designates the axes along which scroll snapping should occur
837         - ScrollSnapAxisAlignType indicates which offsets along the x or y axes of the snap port and snap area should be
838           used to compute the snap position emitted by a snap area.
839
840         * rendering/style/StyleRareNonInheritedData.cpp:
841         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
842         (WebCore::StyleRareNonInheritedData::operator==):
843         * rendering/style/StyleRareNonInheritedData.h:
844
845         Replaces the StyleScrollSnapPoints object (which, confusingly, was in charge of storing both the scroll
846         container's and child elements' scroll snap styles) with StyleScrollSnapPort and StyleScrollSnapArea objects,
847         which keep track of the style properties on the scroll container and the child element, respectively.
848
849         * rendering/style/StyleScrollSnapPoints.h:
850         (WebCore::operator==):
851         (WebCore::StyleScrollSnapPort::copy):
852         (WebCore::StyleScrollSnapPort::StyleScrollSnapPort):
853         (WebCore::StyleScrollSnapArea::copy):
854         (WebCore::StyleScrollSnapArea::StyleScrollSnapArea):
855         * rendering/style/StyleScrollSnapping.h: Added.
856         (WebCore::operator!=):
857         (WebCore::StyleScrollSnapPort::create):
858         (WebCore::StyleScrollSnapArea::create):
859         (WebCore::StyleScrollSnapArea::hasSnapPosition):
860
861         Overhauled StyleScrollSnapPoints, breaking the logic here into two classes: StyleScrollSnapPort for the scroll
862         container, handling the properties `scroll-snap-type` and `scroll-padding` and StyleScrollSnapArea for child
863         elements, handling the properties `scroll-snap-align` and `scroll-snap-margin`. The ScrollSnapType itself is
864         composed of an axis value and a strictness, while a ScrollSnapAlign keeps track of the alignment modes in each
865         axis. By default, these are initialized to {Both, None} and {None, None}, respectively. The rest of the logic is
866         boilerplate code for comparing these style objects to one another and copying style representations.
867
868         * testing/Internals.cpp:
869         (WebCore::Internals::scrollSnapOffsets):
870
871         Perform a layout on the document if needed before returning the list of computed snap offsets. The absence of
872         this layout pass was causing some layout tests in css3/scroll-snap/ to flake when testing that programmatic
873         changes to the scroll snap style properties change the computed snap offsets.
874
875 2016-12-19  Dean Jackson  <dino@apple.com>
876
877         Use ENABLE() in place of ENABLE_CSS_SELECTORS_LEVEL4
878         https://bugs.webkit.org/show_bug.cgi?id=166043
879         <rdar://problems/29743655>
880
881         Reviewed by Alex Christensen.
882
883         This doesn't compile unless the ENABLE_CSS_SELECTORS_LEVEL4 is defined.
884
885         * css/SelectorChecker.cpp:
886         (WebCore::SelectorChecker::matchRecursively):
887         * css/SelectorFilter.cpp:
888         (WebCore::SelectorFilter::collectIdentifierHashes):
889         * css/parser/CSSSelectorParser.cpp:
890         (WebCore::isOnlyPseudoClassFunction):
891         (WebCore::CSSSelectorParser::consumePseudo):
892         (WebCore::CSSSelectorParser::consumeCombinator):
893         * cssjit/SelectorCompiler.cpp:
894         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
895
896 2016-12-20  Yusuke Suzuki  <utatane.tea@gmail.com>
897
898         Unreviewed, attempt to fix Windows Debug build part 2
899         https://bugs.webkit.org/show_bug.cgi?id=166035
900
901         Ensured that this patch passes the build on the GTK port.
902
903         * rendering/RenderElement.cpp:
904         * rendering/RenderElement.h:
905
906 2016-12-20  Yusuke Suzuki  <utatane.tea@gmail.com>
907
908         Unreviewed, fix Windows Debug build
909         https://bugs.webkit.org/show_bug.cgi?id=166035
910
911         The size of SameSizeAsRenderElement should be in sync with sizeof(RenderElement).
912
913         * rendering/RenderElement.cpp:
914
915 2016-12-20  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
916
917         WebRTC: RTCPeerConnection constructor argument should be optional
918         https://bugs.webkit.org/show_bug.cgi?id=164057
919
920         Reviewed by Youenn Fablet.
921
922         Modify RTCPeerConnection JSBuiltin constructor to allow RTCPeerConfiguration
923         argument to be optional.
924
925         Update existing tests.
926
927         * Modules/mediastream/RTCPeerConnection.js:
928         (initializeRTCPeerConnection):
929
930 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
931
932         [ES6] Enable ES6 Modules
933         https://bugs.webkit.org/show_bug.cgi?id=165849
934
935         Reviewed by Geoffrey Garen.
936
937         * dom/ScriptElement.cpp:
938         (WebCore::ScriptElement::determineScriptType):
939         * html/parser/HTMLPreloadScanner.cpp:
940         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
941         * page/Settings.in:
942
943 2016-12-17  Sam Weinig  <sam@webkit.org>
944
945         Remove a few trivial custom bindings
946         https://bugs.webkit.org/show_bug.cgi?id=165999
947
948         Reviewed by Simon Fraser.
949
950         * CMakeLists.txt:
951         * bindings/js/JSBindingsAllInOne.cpp:
952         Remove files.
953
954         * WebCore.xcodeproj/project.pbxproj:
955         Move custom bindings that only exist for GC or wrapping reasons
956         to their own group, so we can focus on the ones with custom functions.
957
958         * bindings/js/JSDataTransferCustom.cpp: Removed.
959         * bindings/js/JSTrackEventCustom.cpp: Removed.
960
961         * dom/DataTransfer.cpp:
962         (WebCore::DataTransfer::types):
963         Remove incorrect comment and use a more concise empty initialization syntax.
964
965         * dom/DataTransfer.idl:
966         Update IDL to remove [Custom] annotation and match spec better.
967
968         * html/track/TrackEvent.cpp:
969         (WebCore::convertToTrackEventTrack):
970         (WebCore::TrackEvent::TrackEvent):
971         * html/track/TrackEvent.h:
972         Switch to store the Track in a Variant to make the binding easier.
973
974         * html/track/TrackEvent.idl:
975         Remove [CustomGetter] annotation.
976
977 2016-12-19  Zalan Bujtas  <zalan@apple.com>
978
979         Do not position detached list item marker.
980         https://bugs.webkit.org/show_bug.cgi?id=166035
981         <rdar://problem/29175235>
982
983         Reviewed by Simon Fraser.
984
985         In certain (non-reproducible) cases, the list item marker can get detached from the tree
986         during layout and when in RenderListItem::positionListMarker() we dereference the marker's parent, we crash.
987         In addition to the null check, this patch adds an ASSERTION to catch such cases early on.
988
989         Unable to reproduce.
990
991         * rendering/RenderBoxModelObject.cpp:
992         (WebCore::RenderBoxModelObject::moveChildTo):
993         * rendering/RenderElement.cpp:
994         (WebCore::RenderElement::removeChildInternal):
995         * rendering/RenderElement.h:
996         * rendering/RenderListItem.cpp:
997         (WebCore::RenderListItem::layout):
998         (WebCore::RenderListItem::positionListMarker):
999         * rendering/RenderListItem.h:
1000         * rendering/RenderListMarker.h:
1001
1002 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
1003
1004         [CSS Parser] Enable CSS Deferred Parsing
1005         https://bugs.webkit.org/show_bug.cgi?id=165869
1006
1007         Unreviewed rollout – looks like this regressed performance.
1008
1009         * css/parser/CSSParserMode.h:
1010         * page/Settings.in:
1011
1012 2016-12-18  Brent Fulgham  <bfulgham@apple.com>
1013
1014         Side effects while restting form elements
1015         https://bugs.webkit.org/show_bug.cgi?id=165959
1016         <rdar://problem/29705967>
1017
1018         Reviewed by Anders Carlsson.
1019
1020         JavaScript logic can run while resetting FormElement objects. This can
1021         lead to unintended side-effets and other unwanted behavior. We should
1022         protect these elements during the reset.
1023
1024         Test: fast/html/form-mutate.html
1025
1026         * html/HTMLFormElement.cpp:
1027         (WebCore::HTMLFormElement::HTMLFormElement): Switch to C++11 initialization.
1028         (WebCore::HTMLFormElement::reset): Protect elements until the reset
1029         operation is finished.
1030         (WebCore::HTMLFormElement::resetAssociatedFormControlElements): Added to share
1031         code with 'resumeFromDocument'.
1032         (WebCore::HTMLFormElement::resumeFromDocument): Protect elements until the
1033         reset operation is finished.
1034
1035 2016-12-19  Commit Queue  <commit-queue@webkit.org>
1036
1037         Unreviewed, rolling out r209983.
1038         https://bugs.webkit.org/show_bug.cgi?id=166024
1039
1040         There's intent to support persistent-usage-record (Requested
1041         by zdobersek on #webkit).
1042
1043         Reverted changeset:
1044
1045         "[EME] Remove MediaKeySessionType::persistent-usage-record"
1046         https://bugs.webkit.org/show_bug.cgi?id=166012
1047         http://trac.webkit.org/changeset/209983
1048
1049 2016-12-19  Sam Weinig  <sam@webkit.org>
1050
1051         Move custom files / callback objects into their respective groups.
1052
1053         Rubber-stamped by Simon Fraser.
1054
1055         * WebCore.xcodeproj/project.pbxproj:
1056
1057 2016-12-19  Sam Weinig  <sam@webkit.org>
1058
1059         [WebIDL] Remove custom binding for the named Image constructor
1060         https://bugs.webkit.org/show_bug.cgi?id=166023
1061
1062         Reviewed by Alex Christensen.
1063
1064         * bindings/js/JSBindingsAllInOne.cpp:
1065         * CMakeLists.txt:
1066         * WebCore.xcodeproj/project.pbxproj:
1067         Remove JSImageConstructor.
1068
1069         * bindings/js/JSImageConstructor.cpp: Removed.
1070         * bindings/js/JSImageConstructor.h: Removed.
1071         
1072         * bindings/js/JSDOMWindowCustom.cpp:
1073         (WebCore::JSDOMWindow::image): Deleted.
1074         * page/DOMWindow.idl:
1075         Remove custom getter for the constructor.
1076
1077         * html/HTMLImageElement.idl:
1078         Add NamedConstructor annotation.
1079
1080 2016-12-19  Antti Koivisto  <antti@apple.com>
1081
1082         Remove RenderObject::requiresForcedStyleRecalcPropagation
1083         https://bugs.webkit.org/show_bug.cgi?id=166021
1084
1085         Reviewed by Andreas Kling.
1086
1087         It is not called. It also makes no sense architecturally.
1088
1089         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
1090         * html/shadow/mac/ImageControlsRootElementMac.cpp:
1091         * rendering/RenderButton.h:
1092         * rendering/RenderFileUploadControl.h:
1093         * rendering/RenderListItem.h:
1094         * rendering/RenderMedia.h:
1095         * rendering/RenderMenuList.h:
1096         * rendering/RenderMeter.h:
1097         * rendering/RenderObject.h:
1098         (WebCore::RenderObject::requiresForcedStyleRecalcPropagation): Deleted.
1099         * rendering/RenderProgress.h:
1100         * rendering/RenderSlider.h:
1101         * rendering/RenderTextControl.h:
1102         * style/RenderTreeUpdater.cpp:
1103         (WebCore::RenderTreeUpdater::updateElementRenderer):
1104
1105             This is the only call site. Combination
1106
1107                 update.change == Style::NoChange && parent().styleChange == Style::Force
1108
1109             is impossible ('Force' inherits) so requiresForcedStyleRecalcPropagation doesn't ever even get called.
1110
1111 2016-12-19  Zan Dobersek  <zdobersek@igalia.com>
1112
1113         [EME] Remove MediaKeySessionType::persistent-usage-record
1114         https://bugs.webkit.org/show_bug.cgi?id=166012
1115
1116         Reviewed by Xabier Rodriguez-Calvar.
1117
1118         Remove the "persistent-usage-record" value from the MediaKeySessionType.
1119         This was removed from the spec as an at-risk feature.
1120         https://github.com/w3c/encrypted-media/issues/353
1121
1122         No non-imported tests need to be updated. This is still present in the
1123         tests imported from the W3C's web-platform-tests repository, but the
1124         tests haven't yet been updated upstream.
1125
1126         * Modules/encryptedmedia/CDM.cpp:
1127         (WebCore::CDM::isPersistentType):
1128         * Modules/encryptedmedia/MediaKeySessionType.h:
1129         * Modules/encryptedmedia/MediaKeySessionType.idl:
1130
1131 2016-12-19  Miguel Gomez  <magomez@igalia.com>
1132
1133         [GTK] GLXBadFBConfig error when creating an OpenGL context
1134         https://bugs.webkit.org/show_bug.cgi?id=165200
1135
1136         Reviewed by Carlos Garcia Campos.
1137
1138         glXCreateContextAttribsARB causes a GLXBadFBConfig X error when it's not able to provide the
1139         OpenGL version >= 3.2 we are requesting. Due to this, the app crashes instead of falling back to
1140         the legacy path.
1141         The patch modifies GLX context creation using a XErrorTrapper, so the first time a context is created
1142         we don't crash if OpenGL >= 3.2 is not available.
1143         If the gotten context is not valid, we fall back to whatever version glXCreateContextAttribsARB is
1144         able to provide.
1145         The legacy glXCreateContext is only used if the GLX_ARB_create_context extension is not available.
1146
1147         Covered by existent tests.
1148
1149         * platform/graphics/glx/GLContextGLX.cpp:
1150         (WebCore::tryCreateGLXARBContext):
1151         (WebCore::GLContextGLX::createWindowContext):
1152         (WebCore::GLContextGLX::createPbufferContext):
1153
1154 2016-12-18  Brady Eidson  <beidson@apple.com>
1155
1156         IndexedDB 2.0: Prefetch cursor records in the server.
1157         https://bugs.webkit.org/show_bug.cgi?id=166014
1158
1159         Reviewed by Andy Estes.
1160
1161         No new tests (Covered by existing LayoutTests and PerformanceTests).
1162
1163         This patch implements the followng:
1164         1 - After a backing store cursor completes a fetch in the server, it will schedule the next fetch 
1165             even before the client requests one. It will do this up to a limited number of prefetches.
1166         2 - Once a client request to advance the cursor comes in, we'll work our way through prefetched
1167             records instead of reading anything from disk, which might then cause us to continue prefetch.
1168         3 - If any changes to the object store occur, it will throw away all previously fetched records
1169             (There's room for future improvement here)
1170
1171         * Modules/indexeddb/server/IDBBackingStore.h:
1172         
1173         * Modules/indexeddb/server/IDBServer.cpp:
1174         (WebCore::IDBServer::IDBServer::postDatabaseTask):
1175         
1176         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
1177         
1178         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1179         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
1180         (WebCore::IDBServer::SQLiteIDBBackingStore::prefetchCursor):
1181         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
1182         
1183         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
1184         (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
1185         (WebCore::IDBServer::SQLiteIDBCursor::prefetch):
1186         (WebCore::IDBServer::SQLiteIDBCursor::advance):
1187         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1188         
1189         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1190         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
1191         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
1192         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
1193         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1194
1195 2016-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1196
1197         Changing text direction fires input events with null inputTypes and no data
1198         https://bugs.webkit.org/show_bug.cgi?id=166007
1199         <rdar://problem/29557205>
1200
1201         Reviewed by Sam Weinig.
1202
1203         Adds support for the "formatSetInlineTextDirection" input type, triggered when using the context menu on Mac in
1204         an editable area (for both plain and rich text cases) to change paragraph direction. To do this, we add cases
1205         for EditActionSetWritingDirection in inputTypeNameForEditingAction and inputEventDataForEditingStyleAndAction.
1206
1207         When changing text direction for a plaintext editable element, we have logic in Editor::setBaseWritingDirection
1208         that sets the focused element's dir attribute to the requested value (ltr or rtl). We add similar hooks here to
1209         dispatch input events and handle preventing default.
1210
1211         Test: fast/events/before-input-events-prevent-text-direction.html
1212
1213         * editing/EditCommand.cpp:
1214         (WebCore::inputTypeNameForEditingAction):
1215
1216         Handle the EditActionSetWritingDirection case.
1217
1218         * editing/Editor.cpp:
1219         (WebCore::inputEventDataForEditingStyleAndAction):
1220         (WebCore::Editor::applyParagraphStyle):
1221
1222         Include input event data when dispatching an input event here.
1223
1224         (WebCore::Editor::setBaseWritingDirection):
1225         * testing/Internals.cpp:
1226         (WebCore::Internals::setBaseWritingDirection):
1227         * testing/Internals.h:
1228         * testing/Internals.idl:
1229
1230         Introduce an internal testing support hook for setting base writing direction (the same codepath taken when
1231         using the context menu to change paragraph direction). Currently, using testRunner.execCommand creates and
1232         applies style with an additional `unicode-bidi` attribute, and appears to also be intentionally disabled for
1233         plaintext editable elements.
1234
1235 2016-12-17  Simon Fraser  <simon.fraser@apple.com>
1236
1237         Build fix: linking WebCore was failing: you can't export inline functions.
1238
1239         * css/DeprecatedCSSOMPrimitiveValue.cpp:
1240         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType):
1241         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
1242         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue):
1243         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
1244         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue):
1245         * css/DeprecatedCSSOMPrimitiveValue.h:
1246         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType): Deleted.
1247         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Deleted.
1248         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue): Deleted.
1249         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Deleted.
1250         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue): Deleted.
1251
1252 2016-12-16  Dave Hyatt  <hyatt@apple.com>
1253
1254         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
1255         https://bugs.webkit.org/show_bug.cgi?id=165968
1256
1257         Reviewed by Andreas Kling.
1258
1259         This patch changes the CSS OM for values to use distinct wrapper
1260         classes instead of cloning the existing classes. By actually wrapping
1261         values instead of cloning, we are freed up to change our CSS value hierarchy
1262         however we'd like (such as changing to match the new CSS Values OM that
1263         is coming soon).
1264
1265         All of the CSS Values wrapper classes are prefixed with "DeprecatedCSSOM"
1266         to reflect our desire (ultimately) to remove this API from our tree. We're
1267         the only ones that support it, and it's not used on the Web, but it is part
1268         of the WebKitLegacy API and might be used internally.
1269
1270         * CMakeLists.txt:
1271         * DerivedSources.cpp:
1272         * DerivedSources.make:
1273         * WebCore.xcodeproj/project.pbxproj:
1274         * bindings/js/DOMWrapperWorld.h:
1275         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1276         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
1277         * bindings/js/JSCSSValueCustom.cpp:
1278         (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
1279         (WebCore::JSDeprecatedCSSOMValueOwner::finalize):
1280         (WebCore::toJSNewlyCreated):
1281         (WebCore::toJS):
1282         (WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots): Deleted.
1283         (WebCore::JSCSSValueOwner::finalize): Deleted.
1284         * css/CSSComputedStyleDeclaration.cpp:
1285         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
1286         * css/CSSComputedStyleDeclaration.h:
1287         * css/CSSGridLineNamesValue.cpp:
1288         (WebCore::CSSGridLineNamesValue::cloneForCSSOM): Deleted.
1289         * css/CSSGridLineNamesValue.h:
1290         * css/CSSImageSetValue.cpp:
1291         (WebCore::CSSImageSetValue::cloneForCSSOM): Deleted.
1292         * css/CSSImageSetValue.h:
1293         * css/CSSImageValue.cpp:
1294         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper):
1295         (WebCore::CSSImageValue::cloneForCSSOM): Deleted.
1296         * css/CSSImageValue.h:
1297         * css/CSSPrimitiveValue.cpp:
1298         (WebCore::CSSPrimitiveValue::createDeprecatedCSSOMPrimitiveWrapper):
1299         (WebCore::CSSPrimitiveValue::cloneForCSSOM): Deleted.
1300         * css/CSSPrimitiveValue.h:
1301         * css/CSSPrimitiveValue.idl: Removed.
1302         * css/CSSStyleDeclaration.h:
1303         * css/CSSStyleDeclaration.idl:
1304         * css/CSSValue.cpp:
1305         (WebCore::CSSValue::traverseSubresources):
1306         (WebCore::CSSValue::equals):
1307         (WebCore::CSSValue::cssText):
1308         (WebCore::CSSValue::destroy):
1309         (WebCore::CSSValue::createDeprecatedCSSOMWrapper):
1310         (): Deleted.
1311         (WebCore::CSSValue::cloneForCSSOM): Deleted.
1312         * css/CSSValue.h:
1313         (WebCore::CSSValue::CSSValue):
1314         (WebCore::CSSValue::setCssText): Deleted.
1315         (WebCore::CSSValue::isCSSOMSafe): Deleted.
1316         (WebCore::CSSValue::isSubtypeExposedToCSSOM): Deleted.
1317         * css/CSSValue.idl: Removed.
1318         * css/CSSValueList.cpp:
1319         (WebCore::CSSValueList::cloneForCSSOM): Deleted.
1320         * css/CSSValueList.h:
1321         (WebCore::CSSValueList::separator):
1322         * css/CSSValueList.idl: Removed.
1323         * css/Counter.h:
1324         * css/Counter.idl: Removed.
1325         * css/DeprecatedCSSOMCounter.h: Added.
1326         * css/DeprecatedCSSOMCounter.idl: Copied from Source/WebCore/css/Counter.idl.
1327         * css/DeprecatedCSSOMPrimitiveValue.cpp: Added.
1328         (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue):
1329         (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue):
1330         (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue):
1331         * css/DeprecatedCSSOMPrimitiveValue.h: Added.
1332         (WebCore::DeprecatedCSSOMPrimitiveValue::create):
1333         (WebCore::DeprecatedCSSOMPrimitiveValue::equals):
1334         (WebCore::DeprecatedCSSOMPrimitiveValue::cssValueType):
1335         (WebCore::DeprecatedCSSOMPrimitiveValue::cssText):
1336         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType):
1337         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
1338         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue):
1339         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
1340         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue):
1341         (WebCore::DeprecatedCSSOMPrimitiveValue::stringValue):
1342         (WebCore::DeprecatedCSSOMPrimitiveValue::DeprecatedCSSOMPrimitiveValue):
1343         * css/DeprecatedCSSOMPrimitiveValue.idl: Copied from Source/WebCore/css/CSSPrimitiveValue.idl.
1344         * css/DeprecatedCSSOMRGBColor.h: Added.
1345         * css/DeprecatedCSSOMRGBColor.idl: Copied from Source/WebCore/css/RGBColor.idl.
1346         * css/DeprecatedCSSOMRect.h: Added.
1347         * css/DeprecatedCSSOMRect.idl: Copied from Source/WebCore/css/Rect.idl.
1348         * css/DeprecatedCSSOMValue.cpp: Added.
1349         (WebCore::compareCSSOMValues):
1350         (WebCore::DeprecatedCSSOMValue::equals):
1351         (WebCore::DeprecatedCSSOMValue::destroy):
1352         (WebCore::DeprecatedCSSOMValue::cssValueType):
1353         (WebCore::DeprecatedCSSOMValue::cssText):
1354         * css/DeprecatedCSSOMValue.h: Added.
1355         (WebCore::DeprecatedCSSOMValue::deref):
1356         (WebCore::DeprecatedCSSOMValue::setCssText):
1357         (WebCore::DeprecatedCSSOMValue::operator==):
1358         (WebCore::DeprecatedCSSOMValue::isComplexValue):
1359         (WebCore::DeprecatedCSSOMValue::isPrimitiveValue):
1360         (WebCore::DeprecatedCSSOMValue::isValueList):
1361         (WebCore::DeprecatedCSSOMValue::classType):
1362         (WebCore::DeprecatedCSSOMValue::DeprecatedCSSOMValue):
1363         (WebCore::DeprecatedCSSOMValue::~DeprecatedCSSOMValue):
1364         (WebCore::DeprecatedCSSOMComplexValue::create):
1365         (WebCore::DeprecatedCSSOMComplexValue::equals):
1366         (WebCore::DeprecatedCSSOMComplexValue::cssText):
1367         (WebCore::DeprecatedCSSOMComplexValue::cssValueType):
1368         (WebCore::DeprecatedCSSOMComplexValue::DeprecatedCSSOMComplexValue):
1369         * css/DeprecatedCSSOMValue.idl: Copied from Source/WebCore/css/CSSValue.idl.
1370         * css/DeprecatedCSSOMValueList.cpp: Added.
1371         (WebCore::DeprecatedCSSOMValueList::equals):
1372         (WebCore::DeprecatedCSSOMValueList::cssText):
1373         * css/DeprecatedCSSOMValueList.h: Added.
1374         (WebCore::DeprecatedCSSOMValueList::create):
1375         (WebCore::DeprecatedCSSOMValueList::cssValueType):
1376         (WebCore::DeprecatedCSSOMValueList::length):
1377         (WebCore::DeprecatedCSSOMValueList::item):
1378         (WebCore::DeprecatedCSSOMValueList::DeprecatedCSSOMValueList):
1379         * css/DeprecatedCSSOMValueList.idl: Copied from Source/WebCore/css/CSSValueList.idl.
1380         * css/LengthRepeat.h:
1381         * css/PropertySetCSSStyleDeclaration.cpp:
1382         (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
1383         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
1384         (WebCore::StyleRuleCSSStyleDeclaration::didMutate):
1385         (WebCore::InlineCSSStyleDeclaration::didMutate):
1386         (WebCore::PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM): Deleted.
1387         * css/PropertySetCSSStyleDeclaration.h:
1388         * css/RGBColor.cpp:
1389         (WebCore::RGBColor::red): Deleted.
1390         (WebCore::RGBColor::green): Deleted.
1391         (WebCore::RGBColor::blue): Deleted.
1392         (WebCore::RGBColor::alpha): Deleted.
1393         * css/RGBColor.h:
1394         * css/RGBColor.idl: Removed.
1395         * css/Rect.h:
1396         (WebCore::RectBase::RectBase):
1397         * css/Rect.idl: Removed.
1398         * svg/SVGElement.cpp:
1399         (WebCore::SVGElement::getPresentationAttribute):
1400         * svg/SVGElement.h:
1401         * svg/SVGElement.idl:
1402
1403 2016-12-17  Philippe Normand  <pnormand@igalia.com>
1404
1405         Unreviewed, rollout r209860 OWR player shouldn't be selected for normal video playback
1406
1407         * platform/GStreamer.cmake:
1408         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
1409         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
1410         (WebCore::MediaPlayerPrivateGStreamerOwr::play):
1411         (WebCore::MediaPlayerPrivateGStreamerOwr::pause):
1412         (WebCore::MediaPlayerPrivateGStreamerOwr::load):
1413         (WebCore::MediaPlayerPrivateGStreamerOwr::stop):
1414         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded):
1415         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
1416         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize):
1417         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
1418         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1419         (WebCore::MediaEndpointOwr::createMutedRemoteSource):
1420         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Removed.
1421         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1422         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
1423         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Removed.
1424         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
1425         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Removed.
1426
1427 2016-12-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1428
1429         warning: the compiler can assume that the address of 'thisObject' will always evaluate to 'true' [-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot
1430         https://bugs.webkit.org/show_bug.cgi?id=165987
1431
1432         Reviewed by Mark Lam.
1433
1434         Work around the warning by passing the JSObject pointer this function receives directly to
1435         ASSERT_GC_OBJECT_INHERITS, instead of casting it to a reference and then taking the address
1436         of that, to avoid the -Waddress warning.
1437
1438         * bindings/js/JSHTMLDocumentCustom.cpp:
1439         (WebCore::JSHTMLDocument::getOwnPropertySlot):
1440
1441 2016-12-17  Jer Noble  <jer.noble@apple.com>
1442
1443         Add implementation for navigator.requestMediaKeySystemAccess()
1444         https://bugs.webkit.org/show_bug.cgi?id=165850
1445
1446         Reviewed by Eric Carlson.
1447
1448         Test: media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html
1449
1450         Add an implementation of NavigatorEME::requestMediaKeySystemAccess() as well as the CDM
1451         object on which it depends.
1452
1453         * Modules/encryptedmedia/CDM.cpp: Added.
1454         (WebCore::cdmFactories):
1455         (WebCore::createCDMPrivateForKeySystem):
1456         (WebCore::CDM::registerCDMFactory):
1457         (WebCore::CDM::unregisterCDMFactory):
1458         (WebCore::CDM::supportsKeySystem):
1459         (WebCore::CDM::create):
1460         (WebCore::CDM::CDM):
1461         (WebCore::CDM::getSupportedConfiguration):
1462         (WebCore::CDM::doSupportedConfigurationStep):
1463         (WebCore::CDM::isPersistentType):
1464         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
1465         (WebCore::CDM::getConsentStatus):
1466         * Modules/encryptedmedia/CDM.h: Added.
1467         (WebCore::CDMFactory::~CDMFactory):
1468         (WebCore::CDM::keySystem):
1469         (WebCore::CDM::createWeakPtr):
1470         * Modules/encryptedmedia/CDMPrivate.h: Added.
1471         (WebCore::CDMPrivate::~CDMPrivate):
1472         * Modules/encryptedmedia/NavigatorEME.cpp:
1473         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
1474         (WebCore::tryNextSupportedConfiguration):
1475         * Modules/encryptedmedia/NavigatorEME.h:
1476         * Modules/encryptedmedia/NavigatorEME.idl:
1477
1478         To aid in testing, a new Internals object is added, MockCDMFactory, which can be
1479         controlled by LayoutTests to change the behavior of the Mock objects it creates.
1480
1481         * testing/Internals.cpp:
1482         (WebCore::Internals::registerMockCDM):
1483         * testing/Internals.h:
1484         * testing/Internals.idl:
1485         * testing/MockCDMFactory.cpp: Added.
1486         (WebCore::MockCDMFactory::MockCDMFactory):
1487         (WebCore::MockCDMFactory::~MockCDMFactory):
1488         (WebCore::MockCDMFactory::unregister):
1489         (WebCore::MockCDMFactory::supportsKeySystem):
1490         (WebCore::MockCDMFactory::createCDM):
1491         (WebCore::MockCDM::MockCDM):
1492         (WebCore::MockCDM::supportsInitDataType):
1493         (WebCore::MockCDM::supportsConfiguration):
1494         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
1495         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
1496         (WebCore::MockCDM::supportsRobustness):
1497         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
1498         (WebCore::MockCDM::persistentStateRequirement):
1499         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
1500         * testing/MockCDMFactory.h: Added.
1501         (WebCore::MockCDMFactory::create):
1502         (WebCore::MockCDMFactory::supportedDataTypes):
1503         (WebCore::MockCDMFactory::setSupportedDataTypes):
1504         (WebCore::MockCDMFactory::supportedRobustness):
1505         (WebCore::MockCDMFactory::setSupportedRobustness):
1506         (WebCore::MockCDMFactory::distinctiveIdentifiersRequirement):
1507         (WebCore::MockCDMFactory::setDistinctiveIdentifiersRequirement):
1508         (WebCore::MockCDMFactory::persistentStateRequirement):
1509         (WebCore::MockCDMFactory::setPersistentStateRequirement):
1510         * testing/MockCDMFactory.idl: Added.
1511
1512         Move the MediaKeySessionType definition out of the MediaKeys.idl file and into its own.
1513         Move the MediaKeysRequiriment definition out of the MediaKeySystemConfiguration.idl file
1514         and into its own. Generally fix up the .idl files so that they properly work with their
1515         implementation files.
1516
1517         * Modules/encryptedmedia/MediaKeySessionType.idl: Added.
1518         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
1519         (WebCore::MediaKeySystemAccess::create):
1520         (WebCore::MediaKeySystemAccess::MediaKeySystemAccess):
1521         (WebCore::MediaKeySystemAccess::keySystem): Deleted.
1522         (WebCore::MediaKeySystemAccess::getConfiguration): Deleted.
1523         * Modules/encryptedmedia/MediaKeySystemAccess.h:
1524         (WebCore::MediaKeySystemAccess::keySystem):
1525         (WebCore::MediaKeySystemAccess::getConfiguration):
1526         (WebCore::MediaKeySystemAccess::create): Deleted.
1527         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
1528         * Modules/encryptedmedia/MediaKeySystemConfiguration.h:
1529         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl:
1530         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl:
1531         * Modules/encryptedmedia/MediaKeys.idl:
1532         * Modules/encryptedmedia/MediaKeysRequirement.idl: Added.
1533         * Modules/encryptedmedia/MediaKeysRestrictions.h: Added.
1534         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Removed.
1535
1536         As some of these enums are referenced in the Internals project, they need to be exported
1537         from WebCore correctly. Teach the code generator how to export the symbols generated by
1538         enums.
1539
1540         * bindings/scripts/CodeGeneratorJS.pm:
1541         (GenerateEnumerationHeaderContent):
1542
1543         Add new files to the project.
1544
1545         * CMakeLists.txt:
1546         * DerivedSources.make:
1547         * WebCore.xcodeproj/project.pbxproj:
1548
1549 2016-12-17  Darin Adler  <darin@apple.com>
1550
1551         Remove WebCore::Dictionary, which is now unused
1552         https://bugs.webkit.org/show_bug.cgi?id=165988
1553
1554         Reviewed by Andreas Kling.
1555
1556         * CMakeLists.txt: Removed the files.
1557         * WebCore.xcodeproj/project.pbxproj: Ditto.
1558         * bindings/js/Dictionary.cpp: Removed.
1559         * bindings/js/Dictionary.h: Removed.
1560         * bindings/js/JSBindingsAllInOne.cpp: Removed include of Dictionary.cpp.
1561
1562 2016-12-17  Youenn Fablet  <youenn@apple.com>
1563
1564         Cloned CachedResource should not have an empty response
1565         https://bugs.webkit.org/show_bug.cgi?id=165947
1566
1567         Reviewed by Sam Weinig.
1568
1569         Test: http/tests/loading/reusing-cached-stylesheet-from-different-domain.html
1570
1571         * loader/cache/CachedResource.cpp:
1572         (WebCore::CachedResource::setBodyDataFrom): Copying the response to the cloned resource.
1573         Even though the issue is appearing for stylesheets only, it is safer to do that for all cloned ressources.
1574
1575 2016-12-16  Brady Eidson  <beidson@apple.com>
1576
1577         IndexedDB: Refactor SQLiteIDBCursor to prepare for cursor prefetching.
1578         https://bugs.webkit.org/show_bug.cgi?id=165978
1579
1580         Reviewed by Alex Christensen.
1581
1582         No new tests (Refactor, no behavior change).
1583         
1584         In preparation for cursor prefetching, we need to shift the cursor off of keeping "the current record"
1585         and onto keeping "a deque of fetched records", the first of which is "the current record".
1586         
1587         This patch does just that, but with no behavior change; The deque only ever holds 0 or 1 records.
1588
1589         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
1590         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
1591         (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
1592         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
1593         (WebCore::IDBServer::SQLiteIDBCursor::prefetch):
1594         (WebCore::IDBServer::SQLiteIDBCursor::advance):
1595         (WebCore::IDBServer::SQLiteIDBCursor::fetch):
1596         (WebCore::IDBServer::SQLiteIDBCursor::fetchNextRecord):
1597         (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored):
1598         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
1599         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
1600         (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
1601         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
1602         (WebCore::IDBServer::SQLiteIDBCursor::currentValue):
1603         (WebCore::IDBServer::SQLiteIDBCursor::didComplete):
1604         (WebCore::IDBServer::SQLiteIDBCursor::didError):
1605         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID):
1606         (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique): Deleted.
1607         (WebCore::IDBServer::SQLiteIDBCursor::advanceOnce): Deleted.
1608         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Deleted.
1609         
1610         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1611         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteCursorRecord::isTerminalRecord):
1612         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): Deleted.
1613         (WebCore::IDBServer::SQLiteIDBCursor::currentKey): Deleted.
1614         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): Deleted.
1615         (WebCore::IDBServer::SQLiteIDBCursor::currentValue): Deleted.
1616         (WebCore::IDBServer::SQLiteIDBCursor::didComplete): Deleted.
1617         (WebCore::IDBServer::SQLiteIDBCursor::didError): Deleted.
1618
1619 2016-12-16  Darin Adler  <darin@apple.com>
1620
1621         Remove all custom bindings from media streams, using dictionaries instead
1622         https://bugs.webkit.org/show_bug.cgi?id=165943
1623
1624         Reviewed by Sam Weinig.
1625
1626         * CMakeLists.txt: Added and removed files.
1627         * DerivedSources.make: Ditto.
1628
1629         * Modules/mediastream/DoubleRange.h: Added. Moved dictionary here so it can be shared
1630         by both MediaStreamTrack and MediaTrackSupportedConstraints.
1631         * Modules/mediastream/DoubleRange.idl: Ditto.
1632         * Modules/mediastream/LongRange.h: Ditto.
1633         * Modules/mediastream/LongRange.idl: Ditto.
1634
1635         * Modules/mediastream/MediaDevices.cpp:
1636         (WebCore::MediaDevices::getSupportedConstraints): Changed to return a struct instead
1637         of a reference counted object.
1638         * Modules/mediastream/MediaDevices.h: Updated for the above.
1639         * Modules/mediastream/MediaDevices.idl: Added a conditional on the dictionary in this
1640         file; not needed because the conditional on the interface automatically affects the
1641         entire fiel, but for now the style seems to be to put these on all the dictionaries.
1642
1643         * Modules/mediastream/MediaSourceSettings.cpp: Removed.
1644         * Modules/mediastream/MediaSourceSettings.h: Removed.
1645
1646         * Modules/mediastream/MediaStreamTrack.cpp:
1647         (WebCore::MediaStreamTrack::getSettings): Changed to return a struct instead of a
1648         reference counted object.
1649         (WebCore::capabilityDoubleRange): Added. Helper for getCapabilities.
1650         (WebCore::capabilityIntRange): Ditto.
1651         (WebCore::capabilityStringVector): Ditto.
1652         (WebCore::capabilityBooleanVector): Ditto.
1653         (WebCore::MediaStreamTrack::getCapabilities): Changed to return a struct instead
1654         of a reference counted object.
1655         * Modules/mediastream/MediaStreamTrack.h: Updated for the above changes. Also
1656         defined the structs here in the class.
1657         * Modules/mediastream/MediaStreamTrack.idl: Defined the two dictionaries here and
1658         changed the functions to return them and not use [Custom] any more.
1659
1660         * Modules/mediastream/MediaTrackConstraints.h: Moved DoubleRange and LongRange out
1661         of this file and into their own headers. Also removed the currently unimplemented
1662         latency and channelCount; there are FIXME comments in the IDL file about eventually
1663         adding these to match the specification.
1664         * Modules/mediastream/MediaTrackConstraints.idl: Added conditionals, and removed
1665         the unimplemented latency and channelCount.
1666         style of marking everything consistently.
1667
1668         * Modules/mediastream/MediaTrackSupportedConstraints.h: Replaced this class with
1669         a struct.
1670         * Modules/mediastream/MediaTrackSupportedConstraints.idl: Replaced this interface
1671         with a dictionary.
1672
1673         * WebCore.xcodeproj/project.pbxproj: Added and removed files.
1674
1675         * bindings/js/JSMediaStreamTrackCustom.cpp: Removed.
1676         * bindings/js/JSMediaTrackSupportedConstraintsCustom.cpp: Removed.
1677
1678         * platform/mediastream/MediaStreamTrackPrivate.cpp: Removed include of the
1679         MediaSourceSettings.h header.
1680         * platform/mediastream/MediaStreamTrackPrivate.h: Removed forward declaration of
1681         the MediaSourceSettings class.
1682
1683 2016-12-16  Zalan Bujtas  <zalan@apple.com>
1684
1685         Possible nullptr dereference when applying pagination to viewport
1686         https://bugs.webkit.org/show_bug.cgi?id=165926
1687
1688         Reviewed by Simon Fraser.
1689
1690         Static analysis found a code path where a null dereference could occur.
1691         
1692         * page/FrameView.cpp:
1693         (WebCore::FrameView::applyPaginationToViewport):
1694
1695 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
1696
1697         Fix the Windows build.
1698
1699         Unreviewed build fix.
1700
1701         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
1702
1703 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
1704
1705         Yet another attempt to fix the Windows build after r209936.
1706
1707         Unreviewed build fix.
1708
1709         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
1710
1711 2016-12-16  Alex Christensen  <achristensen@webkit.org>
1712
1713         Use initEvent quirk added in r207908 for Flipboard
1714         https://bugs.webkit.org/show_bug.cgi?id=165974
1715         <rdar://problem/28264190>
1716
1717         Reviewed by Chris Dumez.
1718
1719         * dom/Event.cpp:
1720         (WebCore::Event::initEventForBindings):
1721         * platform/RuntimeApplicationChecks.h:
1722         * platform/RuntimeApplicationChecks.mm:
1723         (WebCore::IOSApplication::isFlipboard):
1724         Flipboard also has JavaScript content that calls initEvent with not enough arguments.
1725
1726 2016-12-16  Chris Dumez  <cdumez@apple.com>
1727
1728         [iOS] Align HTML from validation popover style with Copy/Paste callout bar
1729         https://bugs.webkit.org/show_bug.cgi?id=165973
1730         <rdar://problem/29336638>
1731
1732         Reviewed by Simon Fraser.
1733
1734         Tweak font size and padding of the HTML from validation popover to
1735         match the style of the Copy/Paste callout bar on iOS.
1736
1737         * platform/ios/ValidationBubbleIOS.mm:
1738         (WebCore::ValidationBubble::ValidationBubble):
1739
1740 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
1741
1742         Another attempt to fix the Windows build after r209936.
1743
1744         Unreviewed build fix.
1745
1746         * CMakeLists.txt:
1747
1748 2016-12-16  Andy Estes  <aestes@apple.com>
1749
1750         Add a setting to suppress keyboard input during provisional navigation
1751         https://bugs.webkit.org/show_bug.cgi?id=165830
1752
1753         Reviewed by Brent Fulgham.
1754
1755         Added a setting that suppresses keyboard input during provisional navigation. When the
1756         setting is enabled, DOM propogation of keyboard input events (KeyboardEvents,
1757         CompositionEvents, InputEvents, and some TextEvents) is suppressed, and text insertion is
1758         disabled in the editor.
1759
1760         Non-editing default event handling still occurs, for instance keyboard scrolling, access
1761         keys, and focus navigation.
1762
1763         Test: http/tests/navigation/keyboard-events-during-provisional-navigation.html
1764
1765         * dom/CompositionEvent.h: Added a type trait specialization.
1766         * dom/EventDispatcher.cpp:
1767         (WebCore::shouldSuppressEventDispatchInDOM): Added. Returns true if the event is trusted,
1768         FrameLoader::shouldSuppressKeyboardInput() returns true, and the event is a
1769         CompositionEvent, InputEvent, KeyboardEvent, or keyboard/composition TextEvent.
1770         (WebCore::EventDispatcher::dispatchEvent): Called stopPropogation() on the event if
1771         shouldSuppressEventDispatchInDOM() returns true.
1772         * dom/InputEvent.h: Removed the inline no-op destructor so that DataTransfer does not need
1773         to be a complete type in every translation unit that includes this header. Added a type
1774         trait specialization.
1775         * dom/TextEvent.h: Added isKeyboard() to determine if m_inputType is TextEventInputKeyboard.
1776         * editing/Editor.cpp:
1777         (WebCore::Editor::shouldInsertText): Returned false if
1778         FrameLoader::shouldSuppressKeyboardInput() returns true and the action is
1779         EditorInsertActionTyped.
1780         * loader/FrameLoader.cpp:
1781         (WebCore::FrameLoader::shouldSuppressKeyboardInput): Added. Returns true if
1782         Settings::shouldSuppressKeyboardInputDuringProvisionalNavigation() returns true and the
1783         state is FrameStateProvisional.
1784         * loader/FrameLoader.h: Declared shouldSuppressKeyboardInput().
1785         * page/EventHandler.h: Exported accessKeyModifiers().
1786         * page/Settings.in: Defined shouldSuppressKeyboardInputDuringProvisionalNavigation with an
1787         initial value of false.
1788         * testing/Internals.cpp:
1789         (WebCore::Internals::accessKeyModifiers): Added. Returns a vector of strings representing
1790         the access key modifiers.
1791         * testing/Internals.h: Declared accessKeyModifiers().
1792         * testing/Internals.idl: Exposed accessKeyModifiers() on the internals object.
1793
1794 2016-12-16  Brady Eidson  <beidson@apple.com>
1795
1796         More SQLiteIDBCursor refactoring.
1797         https://bugs.webkit.org/show_bug.cgi?id=165956
1798
1799         Reviewed by Tim Horton.
1800
1801         No new tests (No behavior change).
1802         
1803         This is a simple patch that encapsulates the current state of the cursor in one structure
1804         which will allow for storing multiple-such states in the future (to support prefetching).
1805
1806         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
1807         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
1808         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
1809         (WebCore::IDBServer::SQLiteIDBCursor::advance):
1810         (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique):
1811         (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored):
1812         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
1813         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
1814         
1815         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1816         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID):
1817         (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
1818         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
1819         (WebCore::IDBServer::SQLiteIDBCursor::currentValue):
1820         (WebCore::IDBServer::SQLiteIDBCursor::didComplete):
1821         (WebCore::IDBServer::SQLiteIDBCursor::didError):
1822
1823 2016-12-16  Jer Noble  <jer.noble@apple.com>
1824
1825         Follow-up build fix after r209936; also rename MockCDM -> LegacyMockCDM in
1826         CMakeLists.txt.
1827
1828         * CMakeLists.txt:
1829
1830 2016-12-16  Sam Weinig  <sam@webkit.org>
1831
1832         [Bindings] Remove use of Dictionary/ArrayValue in CDMSessionClearKey
1833         https://bugs.webkit.org/show_bug.cgi?id=165961
1834
1835         Reviewed by Darin Adler.
1836
1837         * CMakeLists.txt:
1838         * WebCore.xcodeproj/project.pbxproj:
1839         * bindings/js/JSBindingsAllInOne.cpp:
1840         Remove ArrayValue.h/cpp
1841
1842         * bindings/js/ArrayValue.cpp: Removed.
1843         * bindings/js/ArrayValue.h: Removed.
1844
1845         * bindings/js/Dictionary.cpp:
1846         * bindings/js/Dictionary.h:
1847         Remove support for ArrayValue.
1848
1849         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
1850         (WebCore::CDMSessionClearKey::update):
1851         Replace use of Dictionary/ArrayValue with direct JSObject functions. This
1852         should really be replaced with a JSON parser that does not require round
1853         tripping through JavaScript objects.
1854
1855 2016-12-13  Jer Noble  <jer.noble@apple.com>
1856
1857         Move existing CDM* implementations into modules/encryptedmedia/legacy
1858         https://bugs.webkit.org/show_bug.cgi?id=165823
1859
1860         Rubber-stamped by Sam Weinig.
1861
1862         * Modules/encryptedmedia/legacy/LegacyCDM.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.cpp.
1863         (WebCore::CDMFactory::CDMFactory):
1864         (WebCore::installedCDMFactories):
1865         (WebCore::CDM::registerCDMFactory):
1866         (WebCore::CDMFactoryForKeySystem):
1867         (WebCore::CDM::supportsKeySystem):
1868         (WebCore::CDM::keySystemSupportsMimeType):
1869         (WebCore::CDM::create):
1870         (WebCore::CDM::CDM):
1871         (WebCore::CDM::~CDM):
1872         (WebCore::CDM::supportsMIMEType):
1873         (WebCore::CDM::createSession):
1874         (WebCore::CDM::mediaPlayer):
1875         * Modules/encryptedmedia/legacy/LegacyCDM.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.h.
1876         (WebCore::CDMClient::~CDMClient):
1877         (WebCore::CDM::keySystem):
1878         (WebCore::CDM::client):
1879         (WebCore::CDM::setClient):
1880         * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivate.h.
1881         (WebCore::CDMPrivateInterface::CDMPrivateInterface):
1882         (WebCore::CDMPrivateInterface::~CDMPrivateInterface):
1883         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.cpp.
1884         (WebCore::CDMPrivateClearKey::supportsKeySystem):
1885         (WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType):
1886         (WebCore::CDMPrivateClearKey::supportsMIMEType):
1887         (WebCore::CDMPrivateClearKey::createSession):
1888         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.h.
1889         (WebCore::CDMPrivateClearKey::CDMPrivateClearKey):
1890         (WebCore::CDMPrivateClearKey::~CDMPrivateClearKey):
1891         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp.
1892         (WebCore::CDMPrivateMediaPlayer::supportsKeySystem):
1893         (WebCore::CDMPrivateMediaPlayer::supportsKeySystemAndMimeType):
1894         (WebCore::CDMPrivateMediaPlayer::supportsMIMEType):
1895         (WebCore::CDMPrivateMediaPlayer::createSession):
1896         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h.
1897         (WebCore::CDMPrivateMediaPlayer::CDMPrivateMediaPlayer):
1898         (WebCore::CDMPrivateMediaPlayer::~CDMPrivateMediaPlayer):
1899         (WebCore::CDMPrivateMediaPlayer::cdm):
1900         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp.
1901         (WebCore::clearKeyVM):
1902         (WebCore::CDMSessionClearKey::CDMSessionClearKey):
1903         (WebCore::CDMSessionClearKey::~CDMSessionClearKey):
1904         (WebCore::CDMSessionClearKey::generateKeyRequest):
1905         (WebCore::CDMSessionClearKey::releaseKeys):
1906         (WebCore::CDMSessionClearKey::update):
1907         (WebCore::CDMSessionClearKey::cachedKeyForKeyID):
1908         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h.
1909         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
1910         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
1911         * WebCore.xcodeproj/project.pbxproj:
1912         * platform/graphics/LegacyCDMSession.h: Renamed from Source/WebCore/platform/graphics/CDMSession.h.
1913         (WebCore::CDMSessionClient::~CDMSessionClient):
1914         (WebCore::CDMSession::CDMSession):
1915         (WebCore::CDMSession::~CDMSession):
1916         (WebCore::CDMSession::type):
1917         (WebCore::CDMSession::cachedKeyForKeyID):
1918         * platform/graphics/MediaPlayer.h:
1919         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
1920         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1921         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
1922         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
1923         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1924         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
1925         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
1926         * testing/Internals.cpp:
1927         * testing/LegacyMockCDM.cpp: Renamed from Source/WebCore/testing/MockCDM.cpp.
1928         (WebCore::MockCDMSession::~MockCDMSession):
1929         (WebCore::MockCDM::supportsKeySystem):
1930         (WebCore::MockCDM::supportsKeySystemAndMimeType):
1931         (WebCore::MockCDM::supportsMIMEType):
1932         (WebCore::MockCDM::createSession):
1933         (WebCore::initDataPrefix):
1934         (WebCore::keyPrefix):
1935         (WebCore::keyRequest):
1936         (WebCore::generateSessionId):
1937         (WebCore::MockCDMSession::MockCDMSession):
1938         (WebCore::MockCDMSession::generateKeyRequest):
1939         (WebCore::MockCDMSession::releaseKeys):
1940         (WebCore::MockCDMSession::update):
1941         * testing/LegacyMockCDM.h: Renamed from Source/WebCore/testing/MockCDM.h.
1942         (WebCore::MockCDM::MockCDM):
1943         (WebCore::MockCDM::~MockCDM):
1944
1945 2016-12-16  Andreas Kling  <akling@apple.com>
1946
1947         Subframes going into page cache don't need to resetScrollbars().
1948         <https://webkit.org/b/163750>
1949         <rdar://problem/29273020>
1950
1951         Reviewed by Antti Koivisto.
1952
1953         The main frame is the only frame that switches its FrameView when using the page cache,
1954         subframes just suspend their DOM and wait around to be either killed or restored.
1955
1956         Thus there is no reason for subframes to reset their FrameView's scrollbars when going
1957         into page cache, since nothing affects them while cached, and their layout should end up
1958         identical when restoring.
1959
1960         This was causing some flakiness with subframe scrollbars jumping between different sizes
1961         in when restoring from page cache in macOS/WK1. This change makes the behavior consistent
1962         in both WK1 and WK2, and removes the flakiness.
1963
1964         * dom/Document.cpp:
1965         (WebCore::Document::setPageCacheState):
1966
1967 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1968
1969         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
1970         https://bugs.webkit.org/show_bug.cgi?id=165767
1971         <rdar://problem/29602382>
1972
1973         Reviewed by Simon Fraser.
1974
1975         When changing the layout viewport override, mark viewport-constrained objects as needing layout. If only the
1976         width and height of the old and new layout viewports are compared, EditorState info (namely selection and caret
1977         rects) that depends on the document location of fixed elements may be stale immediately after the layout
1978         viewport override changes and before layout occurs.
1979
1980         This caused one of the tests (fixed-caret-position-after-scroll.html) to occasionally fail.
1981
1982         Tests: editing/caret/ios/absolute-caret-position-after-scroll.html
1983                editing/caret/ios/fixed-caret-position-after-scroll.html
1984                editing/selection/ios/absolute-selection-after-scroll.html
1985                editing/selection/ios/fixed-selection-after-scroll.html
1986
1987         * page/FrameView.cpp:
1988         (WebCore::FrameView::setLayoutViewportOverrideRect):
1989
1990 2016-12-14  Sam Weinig  <sam@webkit.org>
1991
1992         [ApplePay] Remove remaining custom bindings from the ApplePay code
1993         https://bugs.webkit.org/show_bug.cgi?id=165860
1994
1995         Reviewed by Darin Adler.
1996
1997         * DerivedSources.make:
1998         Add new IDL files.
1999
2000         * WebCore.xcodeproj/project.pbxproj:
2001         Add/remove files.
2002
2003         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp: Removed.
2004         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp: Removed.
2005         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp: Removed.
2006         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp: Removed.
2007         Remove custom bindings.
2008
2009         * Modules/applepay/ApplePayLineItem.h: Added.
2010         * Modules/applepay/ApplePayLineItem.idl: Added.
2011         * Modules/applepay/ApplePayPayment.h: Added.
2012         * Modules/applepay/ApplePayPayment.idl: Added.
2013         * Modules/applepay/ApplePayPaymentContact.h: Added.
2014         * Modules/applepay/ApplePayPaymentContact.idl: Added.
2015         * Modules/applepay/ApplePayPaymentMethod.h: Added.
2016         * Modules/applepay/ApplePayPaymentMethod.idl: Added.
2017         * Modules/applepay/ApplePayPaymentPass.h: Added.
2018         * Modules/applepay/ApplePayPaymentPass.idl: Added.
2019         * Modules/applepay/ApplePayPaymentRequest.h: Added.
2020         * Modules/applepay/ApplePayPaymentRequest.idl: Added.
2021         * Modules/applepay/ApplePayShippingMethod.h: Added.
2022         * Modules/applepay/ApplePayShippingMethod.idl: Added.
2023         Split out dictionaries and enums into separate files where needed.
2024
2025         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
2026         (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
2027         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
2028         * Modules/applepay/ApplePayPaymentAuthorizedEvent.idl:
2029         Convert the 'payment' property to return an ApplePayPayment dictionary, removing
2030         the need for custom bindings.
2031
2032         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp:
2033         (WebCore::ApplePayPaymentMethodSelectedEvent::ApplePayPaymentMethodSelectedEvent):
2034         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
2035         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl:
2036         Convert the 'paymentMethod' property to return an ApplePayPaymentMethod dictionary, removing
2037         the need for custom bindings.
2038
2039         * Modules/applepay/ApplePaySession.cpp:
2040         (WebCore::convertAndValidate):
2041         (WebCore::ApplePaySession::create):
2042         (WebCore::ApplePaySession::ApplePaySession):
2043         (WebCore::ApplePaySession::completeShippingMethodSelection):
2044         (WebCore::ApplePaySession::completeShippingContactSelection):
2045         (WebCore::ApplePaySession::completePaymentMethodSelection):
2046         (WebCore::ApplePaySession::didSelectShippingMethod):
2047         * Modules/applepay/ApplePaySession.h:
2048         Update for new names, remove need for ExecState in the create function, and simplify
2049         billingContact and shippingContact now that they are strongly typed.
2050
2051         * Modules/applepay/ApplePaySession.idl:
2052         Move dictionaries and enums to their own files.
2053
2054         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
2055         (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
2056         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
2057         * Modules/applepay/ApplePayShippingContactSelectedEvent.idl:
2058         Convert the 'shippingContact' property to return an ApplePayPaymentContact dictionary, removing
2059         the need for custom bindings.
2060
2061         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
2062         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
2063         * Modules/applepay/ApplePayShippingMethodSelectedEvent.idl:
2064         Convert the 'shippingMethod' property to return an ApplePayShippingMethod dictionary, removing
2065         the need for custom bindings.
2066
2067         * Modules/applepay/Payment.h:
2068         * Modules/applepay/PaymentContact.h:
2069         * Modules/applepay/PaymentMethod.h:
2070         * Modules/applepay/cocoa/PaymentCocoa.mm:
2071         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2072         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
2073         Replace toJS/fromJS functions with ones that convert to/from the associated dictionary type.
2074
2075         * bindings/generic/IDLTypes.h:
2076         (WebCore::IDLJSON::nullValue):
2077         (WebCore::IDLJSON::isNullValue):
2078         (WebCore::IDLJSON::extractValueFromNullable):
2079         * bindings/js/JSDOMConvert.h:
2080         (WebCore::Converter<IDLJSON>::convert):
2081         (WebCore::JSConverter<IDLJSON>::convert):
2082         Add a new custom type, JSON, which converts from a String to a JS object.
2083
2084         * bindings/scripts/CodeGenerator.pm:
2085         * bindings/scripts/CodeGeneratorJS.pm:
2086         Add support for the new JSON type, and improve scoped naming to allow for enums
2087         in dictionary only IDL files.
2088
2089         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2090         Update test result for improved scoped naming.
2091
2092 2016-12-16  Zalan Bujtas  <zalan@apple.com>
2093
2094         Defer certain accessibility callbacks until after layout is finished.
2095         https://bugs.webkit.org/show_bug.cgi?id=165861
2096         rdar://problem/29646301
2097
2098         Reviewed by Chris Fleizach.
2099
2100         Currently with certain AXObjectCache callbacks, we can end up in a layout while the render tree is being mutated.  
2101         This patch ensures that such callbacks are deferred until after tree mutation/layout is finished.
2102
2103         Test: accessibility/accessibility-crash-with-dynamic-inline-content.html
2104
2105         * accessibility/AXObjectCache.cpp:
2106         (WebCore::AXObjectCache::remove):
2107         (WebCore::AXObjectCache::performDeferredIsIgnoredChange):
2108         (WebCore::AXObjectCache::insertDeferredIsIgnoredChange):
2109         * accessibility/AXObjectCache.h:
2110         * page/FrameView.cpp:
2111         (WebCore::FrameView::performPostLayoutTasks):
2112         * rendering/RenderBlock.cpp:
2113         (WebCore::RenderBlock::deleteLines):
2114         * rendering/RenderBlockLineLayout.cpp:
2115         (WebCore::RenderBlockFlow::createAndAppendRootInlineBox):
2116
2117 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
2118
2119         Rebaseline bindings tests after r209897.
2120
2121         Unreviewed test gardening.
2122
2123         * bindings/scripts/test/JS/JSTestObj.cpp:
2124         (WebCore::JSTestObj::visitChildren):
2125         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2126         (WebCore::JSTestSerializedScriptValueInterface::visitChildren):
2127
2128 2016-12-15  Brent Fulgham  <bfulgham@apple.com>
2129
2130         Arguments called in wrong order
2131         https://bugs.webkit.org/show_bug.cgi?id=165923
2132
2133         Reviewed by Simon Fraser.
2134
2135         Correct the ordering of several function calls.
2136
2137         * Modules/mediasource/SourceBuffer.cpp:
2138         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): The 'nearestToPresentationStartTime'
2139         argument is being checked for validity, but 'nearestToPresentationEndTime' is being used in the
2140         calculation. This seems like a copy/paste error.
2141         * page/PrintContext.cpp:
2142         (WebCore::PrintContext::outputLinkedDestinations): FloatPoint::expandedTo returns a new object that
2143         has been expanded. This code continued using the 'unexpanded' point.
2144         * platform/graphics/GraphicsContext3D.cpp:
2145         (WebCore::GraphicsContext3D::computeImageSizeInBytes): The 'bytesPerComponent' and 'componentsPerPixel'
2146         variables were being passed in the wrong order.
2147         * platform/network/CacheValidation.cpp: The 'last-modified' header string was being concatenated with
2148         the following string, resulting in an incorrect 'last-modifiedproxy-authenticate' string value.
2149         * svg/SVGToOTFFontConversion.cpp:
2150         (WebCore::SVGToOTFFontConverter::firstGlyph): The ASSERT was assigning to the (by-value) input
2151         parameter 'codePoint', rather than comparing it to the firstGlyph value's codePoint.
2152
2153 2016-12-16  Youenn Fablet  <youenn@apple.com>
2154
2155         [Fetch API] Improve resource loading console logging
2156         https://bugs.webkit.org/show_bug.cgi?id=160546
2157
2158         Reviewed by Alex Christensen.
2159
2160         Covered by rebased tests.
2161
2162         Adding support for logging of resource loading failures in ThreadableLoader.
2163         This will allow doing consistent logging for clients such as fetch, XHR, event source...
2164
2165         Doing logging for Fetch API only at the moment in ThreadableLoader.
2166         Future patches should migrate XHR to this logging system.
2167
2168         Logging routine is implemented in ThreadableLoader.
2169         It is used directly by DocumentThreadableLoader before calling didFail client callback.
2170         DocumentThreadableLoader has a new option to not log errors, in the case the client is WorkerThreadableLoader::MainBridge.
2171         In that case, the logging is done in the worker context within WorkerThreadableLoader::MainBridge::didFail
2172
2173         * loader/DocumentThreadableLoader.cpp:
2174         (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Enable logging.
2175         (WebCore::DocumentThreadableLoader::create): Passing logging parameter to constructor.
2176         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Adding initialization of logging parameter.
2177         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Making use of the new logErrorAndFail helper routine.
2178         (WebCore::DocumentThreadableLoader::cancel): No need to log error if it is being cancelled.
2179         (WebCore::DocumentThreadableLoader::redirectReceived): Made the reportXX routines methods of DocumentThreadableLoaders and using logErrorAndFail internally.
2180         (WebCore::DocumentThreadableLoader::didFail): Wrapper around logErrorAndFail since cancel is not calling it anymore.
2181         (WebCore::DocumentThreadableLoader::preflightFailure):
2182         (WebCore::DocumentThreadableLoader::loadRequest):
2183         (WebCore::DocumentThreadableLoader::reportRedirectionWithBadScheme):
2184         (WebCore::DocumentThreadableLoader::reportContentSecurityPolicyError):
2185         (WebCore::DocumentThreadableLoader::reportCrossOriginResourceSharingError):
2186         (WebCore::DocumentThreadableLoader::logErrorAndFail):
2187         (WebCore::reportContentSecurityPolicyError): Deleted.
2188         (WebCore::reportCrossOriginResourceSharingError): Deleted.
2189         (WebCore::reportRedirectionWithBadScheme): Deleted.
2190         * loader/DocumentThreadableLoader.h:
2191         * loader/ThreadableLoader.cpp:
2192         (WebCore::ThreadableLoader::logError):
2193         * loader/ThreadableLoader.h:
2194         * loader/ThreadableLoaderClientWrapper.h:
2195         (WebCore::ThreadableLoaderClientWrapper::create):
2196         (WebCore::ThreadableLoaderClientWrapper::initiator):
2197         (WebCore::ThreadableLoaderClientWrapper::ThreadableLoaderClientWrapper):
2198         * loader/WorkerThreadableLoader.cpp:
2199         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
2200         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2201         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
2202
2203 2016-12-16  Enrique Ocaña González  <eocanha@igalia.com>
2204
2205         [GStreamer][MSE] Fix build warning in MediaPlayerPrivateGStreamer.cpp using gcc 6.2
2206         https://bugs.webkit.org/show_bug.cgi?id=165900
2207
2208         Reviewed by Žan Doberšek.
2209
2210         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2211         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs):
2212         Move the variable asignation out of the if condition.
2213
2214 2016-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2215
2216         [Readable Streams API] Implement ReadableByteStreamController cancel internal method
2217         https://bugs.webkit.org/show_bug.cgi?id=165798
2218
2219         Reviewed by Youenn Fablet.
2220
2221         Implemented cancel method of ReadableByteStreamController.
2222         Also fixed small inconsistency in readableByteStreamControllerClose.
2223
2224         Added one test to check cancel behaviour. More tests may be added as the API is implemented.
2225
2226         * Modules/streams/ReadableByteStreamInternals.js:
2227         (privateInitializeReadableByteStreamController): Define cancel internal method.
2228         (readableByteStreamControllerCancel): Added.
2229         (readableByteStreamControllerClose): Fixed behaviour (no value should be dequeued).
2230         * bindings/js/WebCoreBuiltinNames.h: Removed bytesFilled (previous addition was not needed).
2231
2232 2016-12-16  Youenn Fablet  <youennf@gmail.com>
2233
2234         svg/as-image/svg-image-with-data-uri-use-data-uri.svg is flaky after r207754
2235         https://bugs.webkit.org/show_bug.cgi?id=163887
2236         <rdar://problem/29266436>
2237
2238         Reviewed by Alex Christensen.
2239
2240         Test: http/tests/security/cross-origin-cached-images-with-memory-pressure.html
2241
2242         With the introduction of cached resource cloning, an Image may be referenced by several CachedImage.
2243         This did not work well with Image observer system as it mandates a one-to-one relationship.
2244
2245         Introducing CachedImageObserver to restore the one-to-one relationship between Image and its observer.
2246         CachedImageObserver can keep references for more than one CachedImage.
2247
2248         In the future, it might be better to split more clearly CachedImageObserver and its API from CachedImage.
2249         Or remove the concept of CachedResource cloning and find new ways to provide CachedResource origin information to clients.
2250
2251         * loader/cache/CachedImage.cpp:
2252         (WebCore::CachedImage::load): Moved boolean image observer fields to CachedImageObserver.
2253         (WebCore::CachedImage::setBodyDataFrom): Keeping a reference of the image observer when cloning the resource.
2254         (WebCore::CachedImage::createImage): Creating the observer when creating the image.
2255         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
2256         (WebCore::CachedImage::CachedImageObserver::decodedSizeChanged):
2257         (WebCore::CachedImage::CachedImageObserver::didDraw):
2258         (WebCore::CachedImage::CachedImageObserver::animationAdvanced):
2259         (WebCore::CachedImage::CachedImageObserver::changedInRect):
2260         (WebCore::CachedImage::clearImage):
2261         * loader/cache/CachedImage.h:
2262         * loader/cache/CachedResource.cpp:
2263         (WebCore::CachedResource::setBodyDataFrom): Now that each cached image receives decodedSizeChanged callback, we need to set its size correctly.
2264
2265 2016-12-15  Joonghun Park  <jh718.park@samsung.com>
2266
2267         [EFL] Fix debug build break since r209873. Unreviewed.
2268         https://bugs.webkit.org/show_bug.cgi?id=165945
2269
2270         No new tests, no new behaviours.
2271
2272         Use Primitive System Data Type uint64_t instead of unsigned long long.
2273
2274         * Modules/indexeddb/IDBFactory.cpp:
2275         (WebCore::IDBFactory::openInternal):
2276         * Modules/indexeddb/IDBFactory.h:
2277
2278 2016-12-15  Zalan Bujtas  <zalan@apple.com>
2279
2280         text-align: justify and word-spacing combine to overflow column
2281         https://bugs.webkit.org/show_bug.cgi?id=165796
2282         rdar://problem/29672168
2283
2284         Reviewed by Myles C. Maxfield.
2285
2286         The value of the word-spacing property is not applied on the inline-tree boxes (normal line layout)
2287         with kerning enabled. It causes hittest failures and selection/rendering glitches.
2288         We normally use the pre-computed 'WordMeasurements' values to figure out the run widths. However
2289         with kerning on, in some cases we need to re-measure a certain part of the text by calling RenderText::width().
2290         This function omits the word-spacing value for leading whitespace, so when this text fragment starts with a whitespace,
2291         (while it's not at the beginning of the run) we have to manually add the word-spacing value back.
2292         r146087 added this logic with the restriction of applying it only to whitespace-only runs.
2293
2294         Test: fast/css/word-spacing-with-normal-layout.html
2295
2296         * rendering/RenderBlockLineLayout.cpp:
2297         (WebCore::setLogicalWidthForTextRun):
2298
2299 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2300
2301         Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator
2302         https://bugs.webkit.org/show_bug.cgi?id=165931
2303
2304         Reviewed by Alex Christensen.
2305
2306         No new tests because there is no behavior change.
2307
2308         * dom/CharacterData.cpp:
2309         (WebCore::CharacterData::parserAppendData):
2310         * editing/TextCheckingHelper.cpp:
2311         (WebCore::findMisspellings):
2312         * editing/VisibleUnits.cpp:
2313         (WebCore::wordBreakIteratorForMinOffsetBoundary):
2314         (WebCore::wordBreakIteratorForMaxOffsetBoundary):
2315         (WebCore::isLogicalStartOfWord):
2316         (WebCore::islogicalEndOfWord):
2317         (WebCore::visualWordPosition):
2318         (WebCore::startSentenceBoundary):
2319         (WebCore::endSentenceBoundary):
2320         (WebCore::previousSentencePositionBoundary):
2321         (WebCore::nextSentencePositionBoundary):
2322         * html/HTMLInputElement.cpp:
2323         * html/HTMLTextAreaElement.cpp:
2324         * html/InputType.cpp:
2325         * html/TextFieldInputType.cpp:
2326         * html/TextInputType.cpp:
2327         * platform/graphics/StringTruncator.cpp:
2328         (WebCore::textBreakAtOrPreceding):
2329         (WebCore::boundedTextBreakFollowing):
2330         (WebCore::rightClipToWordBuffer):
2331         * platform/graphics/mac/ComplexTextController.cpp:
2332         (WebCore::ComplexTextController::offsetForPosition):
2333         * platform/text/TextBoundaries.cpp:
2334         (WebCore::findNextWordFromIndex):
2335         (WebCore::findWordBoundary):
2336         (WebCore::findEndWordBoundary):
2337         * platform/text/mac/TextBoundaries.mm:
2338         (WebCore::findNextWordFromIndex):
2339         * rendering/BreakLines.h:
2340         (WebCore::nextBreakablePositionNonLoosely):
2341         (WebCore::nextBreakablePositionLoosely):
2342         * rendering/RenderBlock.cpp:
2343         * rendering/RenderText.cpp:
2344         (WebCore::makeCapitalized):
2345         (WebCore::RenderText::previousOffset):
2346         (WebCore::RenderText::previousOffsetForBackwardDeletion):
2347         (WebCore::RenderText::nextOffset):
2348         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2349         * rendering/line/LineBreaker.h:
2350
2351 2016-12-15  Darin Adler  <darin@apple.com>
2352
2353         Use asString instead of toWTFString, toString, or getString when we already checked isString
2354         https://bugs.webkit.org/show_bug.cgi?id=165895
2355
2356         Reviewed by Yusuke Suzuki.
2357
2358         * Modules/fetch/FetchBody.cpp:
2359         (WebCore::FetchBody::extract): Use asString/value instead of toWTFString.
2360
2361         * Modules/mediastream/SDPProcessor.cpp:
2362         (WebCore::SDPProcessor::callScript): Use asString/value instead of getString.
2363
2364         * bindings/js/ArrayValue.cpp:
2365         (WebCore::ArrayValue::get): Use asString/value instead of toWTFString.
2366
2367         * bindings/js/IDBBindingUtilities.cpp:
2368         (WebCore::get): Use asString/length instead of toString/length.
2369         (WebCore::createIDBKeyFromValue): Use asString/value instead of toWTFString.
2370         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2371         (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): Ditto.
2372         * bindings/js/JSDataCueCustom.cpp:
2373         (WebCore::constructJSDataCue): Use asString/value instead of getString.
2374         * bindings/js/JSInspectorFrontendHostCustom.cpp:
2375         (WebCore::populateContextMenuItems): Use asString/value instead of toWTFString.
2376
2377         * bindings/js/ScriptController.cpp:
2378         (WebCore::jsValueToModuleKey): Use asString/toIdentifier instead of
2379         jsCast<JSString*>/value/Identifier::fromString.
2380
2381         * bindings/js/SerializedScriptValue.cpp:
2382         (WebCore::CloneSerializer::dumpIfTerminal): Streamline by getting rid of local variable.
2383
2384         * contentextensions/ContentExtensionParser.cpp:
2385         (WebCore::ContentExtensions::getDomainList): Use asString instead of jsCast<JSString*>.
2386         (WebCore::ContentExtensions::loadTrigger): Use asString/value instead of toWTFString.
2387         (WebCore::ContentExtensions::loadAction): Ditto.
2388
2389         * css/FontFace.cpp:
2390         (WebCore::FontFace::create): Use asString/value instead of getString.
2391
2392 2016-12-15  Zalan Bujtas  <zalan@apple.com>
2393
2394         Change ::computeLogicalHeight's computedValues out argument to the return value.
2395         https://bugs.webkit.org/show_bug.cgi?id=165789
2396
2397         Reviewed by Simon Fraser.
2398
2399         No change in functionality.
2400
2401         * html/shadow/SliderThumbElement.cpp:
2402         (WebCore::RenderSliderContainer::computeLogicalHeight):
2403         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
2404         (WebCore::RenderImageControlsButton::computeLogicalHeight):
2405         * html/shadow/mac/ImageControlsRootElementMac.cpp:
2406         (WebCore::RenderImageControls::computeLogicalHeight):
2407         * rendering/RenderBlock.cpp:
2408         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
2409         (WebCore::RenderBlock::estimateRegionRangeForBoxChild):
2410         * rendering/RenderBlockFlow.cpp:
2411         (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange):
2412         * rendering/RenderBox.cpp:
2413         (WebCore::RenderBox::updateLogicalHeight):
2414         (WebCore::RenderBox::computeLogicalHeight):
2415         (WebCore::RenderBox::computePercentageLogicalHeight):
2416         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
2417         (WebCore::RenderBox::availableLogicalHeightUsing):
2418         * rendering/RenderBox.h:
2419         (WebCore::RenderBox::ComputedMarginValues::ComputedMarginValues): Deleted.
2420         (WebCore::RenderBox::LogicalExtentComputedValues::LogicalExtentComputedValues): Deleted.
2421         * rendering/RenderFlexibleBox.cpp:
2422         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
2423         * rendering/RenderFlowThread.cpp:
2424         (WebCore::RenderFlowThread::computeLogicalHeight):
2425         * rendering/RenderFlowThread.h:
2426         * rendering/RenderListBox.cpp:
2427         (WebCore::RenderListBox::computeLogicalHeight):
2428         * rendering/RenderListBox.h:
2429         * rendering/RenderMeter.cpp:
2430         (WebCore::RenderMeter::computeLogicalHeight):
2431         * rendering/RenderMeter.h:
2432         * rendering/RenderMultiColumnFlowThread.cpp:
2433         (WebCore::RenderMultiColumnFlowThread::computeLogicalHeight):
2434         * rendering/RenderMultiColumnFlowThread.h:
2435         * rendering/RenderMultiColumnSet.cpp:
2436         (WebCore::RenderMultiColumnSet::computeLogicalHeight):
2437         * rendering/RenderMultiColumnSet.h:
2438         * rendering/RenderProgress.cpp:
2439         (WebCore::RenderProgress::computeLogicalHeight):
2440         * rendering/RenderProgress.h:
2441         * rendering/RenderTextControl.cpp:
2442         (WebCore::RenderTextControl::computeLogicalHeight):
2443         * rendering/RenderTextControl.h:
2444         * rendering/RenderView.cpp:
2445         (WebCore::RenderView::computeLogicalHeight):
2446         * rendering/RenderView.h:
2447         * rendering/svg/RenderSVGForeignObject.cpp:
2448         (WebCore::RenderSVGForeignObject::computeLogicalHeight):
2449         * rendering/svg/RenderSVGForeignObject.h:
2450
2451 2016-12-15  Chris Dumez  <cdumez@apple.com>
2452
2453         Make sure HTML validation bubble's state is updated after layout
2454         https://bugs.webkit.org/show_bug.cgi?id=165922
2455         <rdar://problem/29694730>
2456
2457         Reviewed by Simon Fraser.
2458
2459         Make sure HTML validation bubble's state is updated after layout.
2460         In particular, if the validation bubble's associated element has
2461         moved or is no longer visible, we now hide the bubble.
2462
2463         Tests: fast/forms/validation-bubble-disappears-when-input-detached.html
2464                fast/forms/validation-bubble-disappears-when-input-moved.html
2465                fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html
2466
2467         * page/FrameView.cpp:
2468         (WebCore::FrameView::viewportContentsChanged):
2469         * page/Page.cpp:
2470         (WebCore::Page::updateValidationBubbleStateIfNeeded):
2471         * page/Page.h:
2472         * page/ValidationMessageClient.h:
2473
2474 2016-12-15  Sam Weinig  <sam@webkit.org>
2475
2476         [WebIDL] Remove use of Dictionary from JSCryptoAlgorithmDictionary
2477         https://bugs.webkit.org/show_bug.cgi?id=165919
2478
2479         Reviewed by Darin Adler.
2480
2481         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2482         * bindings/js/JSCryptoAlgorithmDictionary.h:
2483         * bindings/js/JSCryptoOperationData.cpp:
2484         * bindings/js/JSCryptoOperationData.h:
2485         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2486         Replace simplistic use of Dictionary with simplistic use of direct JSObject
2487         functions. Also, pass the ExecState by reference.
2488
2489 2016-12-15  Filip Pizlo  <fpizlo@apple.com>
2490
2491         Get rid of HeapRootVisitor and make SlotVisitor less painful to use
2492         https://bugs.webkit.org/show_bug.cgi?id=165911
2493
2494         Reviewed by Geoffrey Garen.
2495
2496         No new tests because no new behavior.
2497         
2498         This updates WebCore code to new JSC API.
2499
2500         * bindings/js/JSDOMBinding.cpp:
2501         (WebCore::DOMConstructorJSBuiltinObject::visitChildren):
2502         * bindings/js/JSDOMGlobalObject.cpp:
2503         (WebCore::JSDOMGlobalObject::visitChildren):
2504         * bindings/js/JSDOMPromise.h:
2505         (WebCore::DeferredPromise::visitAggregate):
2506         * bindings/js/JSEventListener.cpp:
2507         (WebCore::JSEventListener::visitJSFunction):
2508         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2509         (WebCore::JSWorkerGlobalScopeBase::visitChildren):
2510         * bindings/scripts/CodeGeneratorJS.pm:
2511         (GenerateImplementation):
2512
2513 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2514
2515         Sort Xcode project files
2516         https://bugs.webkit.org/show_bug.cgi?id=165937
2517
2518         Reviewed by Simon Fraser.
2519
2520         No new tests because there is no behavior change.
2521
2522         * WebCore.xcodeproj/project.pbxproj:
2523
2524 2016-12-15  Chris Dumez  <cdumez@apple.com>
2525
2526         Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
2527         https://bugs.webkit.org/show_bug.cgi?id=165904
2528
2529         Reviewed by Sam Weinig.
2530
2531         Move 'charCode' / 'keyCode' attributes from UIEvent to KeyboardEvent and add
2532         'which' to KeyboardEvent to match the specification:
2533         - https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
2534
2535         We keep a 'which' attribute on UIEvent even though the specification does
2536         not say we should because Firefox and Chrome have 'which' on UIEvent still.
2537
2538         Specification:
2539         - 'charCode' / 'keyCode' / 'which' on KeyboardEvent only
2540
2541         Firefox:
2542         - 'charCode' / 'keyCode' on KeyboardEvent only
2543         - 'which' on UIEvent only
2544
2545         Chrome:
2546         - 'charCode' / 'keyCode' / 'which' on KeyboardEvent
2547         - 'which' on UIEvent as well
2548
2549         Old WebKit behavior:
2550         - 'charCode' / 'keyCode' / 'which' on UIEvent only
2551
2552         New WebKit behavior:
2553         - 'charCode' / 'keyCode' / 'which' on KeyboardEvent
2554         - 'which' on UIEvent as well
2555
2556         Our new behavior is identical to Chrome, much closer to the specification,
2557         and closer to Firefox as well.
2558
2559         No new tests, updated / rebaselined existing tests.
2560
2561         * dom/KeyboardEvent.cpp:
2562         (WebCore::KeyboardEvent::KeyboardEvent):
2563         (WebCore::KeyboardEvent::keyCode):
2564         (WebCore::KeyboardEvent::charCode):
2565         (WebCore::KeyboardEvent::which):
2566         * dom/KeyboardEvent.h:
2567         * dom/KeyboardEvent.idl:
2568         * dom/MouseEvent.cpp:
2569         (WebCore::MouseEvent::which):
2570         * dom/UIEvent.cpp:
2571         * dom/UIEvent.h:
2572         * dom/UIEvent.idl:
2573
2574 2016-12-15  Brady Eidson  <beidson@apple.com>
2575
2576         IndexedDB: Add an "IDBCursorRecord" struct.
2577         https://bugs.webkit.org/show_bug.cgi?id=165929
2578
2579         Reviewed by Alex Christensen.
2580
2581         No new tests (Refactor, no behavior change).
2582
2583         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
2584         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
2585         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
2586         (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique):
2587         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
2588         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
2589         
2590         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2591         (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
2592         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
2593         (WebCore::IDBServer::SQLiteIDBCursor::currentValue):
2594
2595         * Modules/indexeddb/shared/IDBCursorRecord.h: Added.
2596         (WebCore::IDBCursorRecord::encode):
2597         (WebCore::IDBCursorRecord::decode):
2598         
2599         * WebCore.xcodeproj/project.pbxproj:
2600
2601 2016-12-15  Keith Rollin  <krollin@apple.com>
2602
2603         Refactor Document::suspend/resume
2604         https://bugs.webkit.org/show_bug.cgi?id=165921
2605
2606         Reviewed by Chris Dumez.
2607
2608         Update Document::suspend to call Document::suspendScheduledTasks
2609         rather than duplicating the latter's code within itself. Similar
2610         treatment of Document::resume and Document::resumeScheduledTasks.
2611
2612         No new tests -- no new functionality, just refactoring existing code.
2613
2614         * dom/Document.cpp:
2615         (WebCore::Document::suspend):
2616         (WebCore::Document::resume):
2617
2618 2016-12-15  Alex Christensen  <achristensen@webkit.org>
2619
2620         Remove flex and bison build dependencies; commit generated XPath parser
2621         https://bugs.webkit.org/show_bug.cgi?id=165783
2622
2623         Reviewed by Brent Fulgham.
2624
2625         flex and bison are annoying to install and use, especially on Windows.
2626         Since only XPathGrammar uses them and that's not actively developed, let's just check in the one generated file
2627         and make building WebKit easier forever!
2628
2629         * CMakeLists.txt:
2630         * DerivedSources.make:
2631         * WebCore.xcodeproj/project.pbxproj:
2632         * css/makegrammar.pl: Removed.
2633         * xml/XPathGrammar.cpp: Added.
2634         (xpathyylex):
2635         (xpathyyerror):
2636         (yysyntax_error):
2637         * xml/XPathGrammar.h: Added.
2638         * xml/XPathGrammar.y: Rename TEXT to TEXT_ to fix a build error on Windows.  TEXT is already defined.
2639
2640 2016-12-15  Brady Eidson  <beidson@apple.com>
2641
2642         Enhance some of the logging statements just added for IndexedDB Operation scheduling.
2643
2644         Rubberstamped by Tim Horton.
2645
2646         No new tests (No behavior change).
2647
2648         * Modules/indexeddb/IDBTransaction.cpp:
2649         (WebCore::IDBTransaction::iterateCursor):
2650         (WebCore::IDBTransaction::requestGetRecord):
2651         (WebCore::IDBTransaction::requestIndexRecord):
2652         (WebCore::IDBTransaction::requestPutOrAdd):
2653         
2654         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2655         (WebCore::IDBCursorInfo::loggingString):
2656         
2657         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
2658         (WebCore::IDBIterateCursorData::loggingString):
2659
2660 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2661
2662         [Cocoa] Implement font-synthesis: small-caps
2663         https://bugs.webkit.org/show_bug.cgi?id=165892
2664
2665         Reviewed by David Hyatt.
2666
2667         The CSS Fonts level 4 spec adds a new value to the "font-synthesis"
2668         property which controls whether or not small-caps is allowed to be
2669         synthesized. Luckily, we already have an implementation of this
2670         straightforward, so the implementation is quite simple.
2671
2672         Tests: css3/font-synthesis-small-caps.html
2673                fast/text/font-synthesis-parsing.html
2674
2675         * css/CSSComputedStyleDeclaration.cpp:
2676         (WebCore::fontSynthesisFromStyle):
2677         * css/StyleBuilderConverter.h:
2678         (WebCore::StyleBuilderConverter::convertFontSynthesis):
2679         * css/parser/CSSPropertyParser.cpp:
2680         (WebCore::consumeFontSynthesis):
2681         * platform/graphics/FontCache.h:
2682         (WebCore::FontDescriptionKey::makeFlagsKey):
2683         * platform/graphics/FontDescription.cpp:
2684         (WebCore::FontDescription::FontDescription):
2685         * platform/graphics/FontDescription.h:
2686         (WebCore::FontCascadeDescription::initialFontSynthesis):
2687         * platform/graphics/mac/ComplexTextController.cpp:
2688         (WebCore::shouldSynthesize):
2689         (WebCore::ComplexTextController::collectComplexTextRuns):
2690
2691 2016-12-15  Brady Eidson  <beidson@apple.com>
2692
2693         Add a new Logging Channel for IndexedDB Operation scheduling.
2694         https://bugs.webkit.org/show_bug.cgi?id=165912
2695
2696         Reviewed by Alex Christensen.
2697
2698         No new tests (No behavior change).
2699
2700         * Modules/indexeddb/IDBDatabase.cpp:
2701         (WebCore::IDBDatabase::transaction):
2702         
2703         * Modules/indexeddb/IDBFactory.cpp:
2704         (WebCore::IDBFactory::openInternal):
2705         (WebCore::IDBFactory::deleteDatabase):
2706         
2707         * Modules/indexeddb/IDBTransaction.cpp:
2708         (WebCore::IDBTransaction::internalAbort):
2709         (WebCore::IDBTransaction::commit):
2710         (WebCore::IDBTransaction::createObjectStore):
2711         (WebCore::IDBTransaction::renameObjectStore):
2712         (WebCore::IDBTransaction::createIndex):
2713         (WebCore::IDBTransaction::renameIndex):
2714         (WebCore::IDBTransaction::doRequestOpenCursor):
2715         (WebCore::IDBTransaction::iterateCursor):
2716         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
2717         (WebCore::IDBTransaction::requestGetAllIndexRecords):
2718         (WebCore::IDBTransaction::requestGetRecord):
2719         (WebCore::IDBTransaction::requestIndexRecord):
2720         (WebCore::IDBTransaction::requestCount):
2721         (WebCore::IDBTransaction::requestDeleteRecord):
2722         (WebCore::IDBTransaction::requestClearObjectStore):
2723         (WebCore::IDBTransaction::requestPutOrAdd):
2724         (WebCore::IDBTransaction::deleteObjectStore):
2725         (WebCore::IDBTransaction::deleteIndex):
2726         
2727         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2728         (WebCore::IDBCursorInfo::loggingString):
2729         * Modules/indexeddb/shared/IDBCursorInfo.h:
2730         
2731         * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
2732         (WebCore::IDBGetAllRecordsData::loggingString):
2733         * Modules/indexeddb/shared/IDBGetAllRecordsData.h:
2734         
2735         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
2736         (WebCore::IDBGetRecordData::loggingString):
2737         * Modules/indexeddb/shared/IDBGetRecordData.h:
2738         
2739         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
2740         (WebCore::IDBIndexInfo::condensedLoggingString):
2741         * Modules/indexeddb/shared/IDBIndexInfo.h:
2742         
2743         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
2744         (WebCore::IDBIterateCursorData::loggingString):
2745         * Modules/indexeddb/shared/IDBIterateCursorData.h:
2746         
2747         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
2748         (WebCore::IDBObjectStoreInfo::condensedLoggingString):
2749         * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
2750         
2751         * platform/Logging.h:
2752
2753 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
2754
2755         Added missing override and final specifiers
2756         https://bugs.webkit.org/show_bug.cgi?id=165903
2757
2758         Reviewed by Darin Adler.
2759
2760         No new tests needed.
2761
2762         * Modules/mediastream/OverconstrainedErrorEvent.h:
2763         * bindings/js/JSCallbackData.h:
2764         * bindings/js/JSCustomXPathNSResolver.h:
2765         * bindings/js/JSErrorHandler.h:
2766         * css/StyleRuleImport.h:
2767         * dom/SecurityPolicyViolationEvent.h:
2768         * editing/CreateLinkCommand.h:
2769         * editing/DeleteSelectionCommand.h:
2770         * editing/DictationCommand.h:
2771         * editing/Editor.cpp:
2772         * editing/FormatBlockCommand.h:
2773         * editing/IndentOutdentCommand.h:
2774         * editing/InsertLineBreakCommand.h:
2775         * editing/InsertParagraphSeparatorCommand.h:
2776         * editing/ModifySelectionListLevel.h:
2777         * editing/MoveSelectionCommand.h:
2778         * editing/RemoveFormatCommand.h:
2779         * editing/RemoveNodePreservingChildrenCommand.h:
2780         * editing/ReplaceSelectionCommand.h:
2781         * editing/SimplifyMarkupCommand.h:
2782         * editing/SplitTextNodeContainingElementCommand.h:
2783         * editing/UnlinkCommand.h:
2784         * fileapi/FileReaderLoader.h:
2785         * html/canvas/ANGLEInstancedArrays.h:
2786         * html/canvas/WebGLVertexArrayObjectBase.h:
2787         * loader/SinkDocument.h:
2788         * loader/archive/mhtml/MHTMLArchive.h:
2789         * page/animation/CSSPropertyAnimation.cpp:
2790         * platform/audio/MultiChannelResampler.cpp:
2791         * platform/audio/SincResampler.cpp:
2792         * platform/audio/gstreamer/AudioDestinationGStreamer.h:
2793         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
2794         * platform/graphics/TextTrackRepresentation.cpp:
2795         * platform/graphics/displaylists/DisplayListItems.h:
2796         * platform/graphics/filters/FEBlend.h:
2797         * platform/graphics/filters/FEColorMatrix.h:
2798         * platform/graphics/filters/FEComponentTransfer.h:
2799         * platform/graphics/filters/FEConvolveMatrix.h:
2800         * platform/graphics/filters/FEDiffuseLighting.h:
2801         * platform/graphics/filters/FEDropShadow.h:
2802         * platform/graphics/filters/FEGaussianBlur.h:
2803         * platform/graphics/filters/FELighting.h:
2804         * platform/graphics/filters/FEMerge.h:
2805         * platform/graphics/filters/FEMorphology.h:
2806         * platform/graphics/filters/FEOffset.h:
2807         * platform/graphics/filters/FESpecularLighting.h:
2808         * platform/graphics/filters/FETile.h:
2809         * platform/graphics/filters/FETurbulence.h:
2810         * platform/graphics/filters/SourceAlpha.h:
2811         * platform/graphics/filters/SourceGraphic.h:
2812         * platform/graphics/opengl/Extensions3DOpenGL.h:
2813         * platform/graphics/opengl/Extensions3DOpenGLCommon.h:
2814         * platform/graphics/texmap/TextureMapperBackingStore.h:
2815         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
2816         * platform/mock/GeolocationClientMock.h:
2817         * platform/text/TextCodecICU.h:
2818         * platform/text/TextCodecLatin1.h:
2819         * platform/text/TextCodecUTF16.h:
2820         * platform/text/TextCodecUTF8.h:
2821         * platform/text/TextCodecUserDefined.h:
2822         * rendering/RenderFullScreen.cpp:
2823         * storage/StorageEvent.h:
2824         * svg/properties/SVGListProperty.h:
2825         * svg/properties/SVGStaticListPropertyTearOff.h:
2826         * svg/properties/SVGStaticPropertyTearOff.h:
2827         * xml/NativeXPathNSResolver.h:
2828         * xml/XMLHttpRequestProgressEvent.h:
2829         * xml/XMLHttpRequestProgressEventThrottle.h:
2830         * xml/XPathVariableReference.h:
2831         * xml/XSLImportRule.h:
2832
2833 2016-12-15  Chris Dumez  <cdumez@apple.com>
2834
2835         Inline Document::existingAXObjectCache()
2836         https://bugs.webkit.org/show_bug.cgi?id=165906
2837
2838         Reviewed by Darin Adler.
2839
2840         Inline Document::existingAXObjectCache() to avoid paying function call
2841         cost in the common case where AX is disabled.
2842
2843         * dom/Document.cpp:
2844         (WebCore::Document::existingAXObjectCacheSlow):
2845         (WebCore::Document::existingAXObjectCache): Deleted.
2846         * dom/Document.h:
2847         (WebCore::Document::existingAXObjectCache):
2848
2849 2016-12-15  Ryan Haddad  <ryanhaddad@apple.com>
2850
2851         Rebaseline bindings tests after r209864.
2852
2853         Unreviewed test gardening.
2854
2855         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2856         (WebCore::convertDictionary<DictionaryImplName>):
2857
2858 2016-12-15  Andreas Kling  <akling@apple.com>
2859
2860         Always clear RenderLayer backing stores when going into page cache.
2861         <https://webkit.org/b/165901>
2862
2863         Reviewed by Simon Fraser.
2864
2865         We were already doing this for the iOS and GTK+ ports, let's do it everywhere
2866         for consistency, and a bit of memory usage improvement.
2867
2868         This patch just removes the setting and always calls FrameView::clearBackingStores()
2869         when there is composited content going into page cache.
2870
2871         * history/CachedFrame.cpp:
2872         (WebCore::CachedFrame::CachedFrame):
2873         * history/PageCache.h:
2874         (WebCore::PageCache::shouldClearBackingStores): Deleted.
2875         (WebCore::PageCache::setShouldClearBackingStores): Deleted.
2876
2877 2016-12-15  Darin Adler  <darin@apple.com>
2878
2879         Remove custom binding for MediaDevices
2880         https://bugs.webkit.org/show_bug.cgi?id=165894
2881
2882         Reviewed by Eric Carlson.
2883
2884         Removes the explicit code to parse the MediaStreamConstraints and
2885         MediaTrackConstraints. Next step could be to change the internal
2886         code to use the structs from bindings directly so we don't need
2887         code to convert to an internal format.
2888
2889         * CMakeLists.txt: Added MediaTrackConstraints.idl and MediaTrackConstraints.cpp,
2890         removed JSMediaDevicesCustom.cpp.
2891
2892         * DerivedSources.make: Added MediaTrackConstraints.idl.
2893         Also sorted list of IDL files and fixed use of tabs.
2894
2895         * Modules/mediastream/MediaDevices.cpp:
2896         (WebCore::createMediaConstraintsImpl): Added.
2897         (WebCore::MediaDevices::getUserMedia): Changed this function to take arguments that
2898         are generated by the bindings script, and call createMediaConstraintsImpl to convert
2899         into the internal data structure.
2900         * Modules/mediastream/MediaDevices.h: Added StreamConstraints struct and changed
2901         getUserMedia to take that as specified in the IDL.
2902         * Modules/mediastream/MediaDevices.idl: Added definition of the MediaStreamConstraints
2903         dictionary. Removed [Custom] from getUserMedia.
2904
2905         * Modules/mediastream/MediaStream.cpp:
2906         (WebCore::MediaStream::MediaStream): Pass a reference to addObserver.
2907         (WebCore::MediaStream::~MediaStream): Pass a rference to removeObserver.
2908         (WebCore::MediaStream::internalAddTrack): Ditto.
2909         (WebCore::MediaStream::internalRemoveTrack): Ditto.
2910
2911         * Modules/mediastream/MediaStreamTrack.cpp:
2912         (WebCore::createMediaConstraintsImpl): Added.
2913         (WebCore::MediaStreamTrack::applyConstraints): Changed to take an optional
2914         MediaTrackConstraints argument and call createMediaConstraintsImpl to convert
2915         into the internal data structure. Also merged the multiple overloads of this
2916         all into a single function, used auto to make the code easier to read, and
2917         moved the code that stores new constrains into the success handling, since the
2918         specification says that's the only case where we should store it.
2919         (WebCore::MediaStreamTrack::addObserver): Take a reference instead of a pointer.
2920         (WebCore::MediaStreamTrack::removeObserver): Ditto.
2921         * Modules/mediastream/MediaStreamTrack.h: Removed many unneeded includes.
2922         Changed getConstraints to return const MediaTrackConstraints&, applyConstraints
2923         to take an optional MediaTrackConstraints, add/removeObserver to take a reference
2924         rather than a pointer, and changed m_constraints to be a MediaTrackConstraints
2925         instead of a RefPtr<MediaConstraints>.
2926         * Modules/mediastream/MediaStreamTrack.idl: Removed [Custom] from getConstraints
2927         and applyConstraints.
2928
2929         * Modules/mediastream/MediaTrackConstraints.cpp: Added.
2930         (WebCore::set): Overloaded function to set constriaints in a
2931         MediaTrackConstraintSetMap.
2932         (WebCore::convertToInternalForm): Helper function that takes a
2933         MediaTrackConstraintSet and turns it into a MediaTrackConstraintSetMap.
2934         (WebCore::convertAdvancedToInternalForm): More of the same, but for vectors.
2935         (WebCore::createMediaConstraintsImpl): Top level function. Calls the other
2936         functions and then MediaConstraintsImpl::create.
2937         * Modules/mediastream/MediaTrackConstraints.h: Added. Contains all the structures
2938         and type definitions for the dictionaries defined in the IDL file, and also the
2939         createMediaConstraintsImpl function declaration.
2940         * Modules/mediastream/MediaTrackConstraints.idl: Added. Contains the
2941         MediaTrackConstraints and all the other dictionaries and typedefs that are needed
2942         to define that dictionary.
2943         * Modules/mediastream/UserMediaRequest.cpp:
2944         (WebCore::UserMediaRequest::start): Changed to not depend on MediaDevices::Promise.
2945         (WebCore::UserMediaRequest::UserMediaRequest): Ditto.
2946         (WebCore::isSecure): Rearranged to be easier to understand.
2947         (WebCore::UserMediaRequest::start): Removed a local variable for simplicity.
2948         (WebCore::UserMediaRequest::document): Removed a redundant null check.
2949         * Modules/mediastream/UserMediaRequest.h: Reduced includes, changed to not depend
2950         on MediaDevices::Promise, removing the reason to include MediaDevices.h.
2951
2952         * WebCore.xcodeproj/project.pbxproj: Updated to remove old files and add new ones.
2953
2954         * bindings/js/JSBindingsAllInOne.cpp: Removed JSMediaDevicesCustom.cpp.
2955
2956         * bindings/js/JSMediaDevicesCustom.cpp: Removed.
2957         * bindings/js/JSMediaDevicesCustom.h: Removed.
2958
2959         * bindings/js/JSMediaStreamTrackCustom.cpp:
2960         (WebCore::JSMediaStreamTrack::applyConstraints): Deleted.
2961         (WebCore::JSMediaStreamTrack::getConstraints): Deleted.
2962
2963         * bindings/scripts/CodeGenerator.pm:
2964         (ProcessDocument): Updated to allow multiple standalone dictionaries, as long as
2965         the name of one of the dictionaries matches the name of the file.
2966
2967         * bindings/scripts/CodeGeneratorJS.pm:
2968         (GenerateDictionary): Added "other dictionaries" argument so we can support
2969         files with multiple dictionaries in them.
2970         (GenerateDictionariesHeaderContent): Completed support for dictionaries that
2971         are not named after a top level interface by added one more check for a missing
2972         $interface in a place that otherwise would not handle it correctly.
2973         (GenerateImplementation): Removed code that set $currentCachedAttribute and
2974         $cacheIndex, since no was reading the value of either any longer.
2975         (GenerateDictionaryHeader): Added "other dictionaries".
2976         (GenerateDictionaryImplementation): Ditto.
2977         (WriteData): Removed unnnecessarily indirect code that was using FileNamePrefix
2978         and a local variable named $prefix instead of just writing "JS".
2979
2980         * bindings/scripts/generate-bindings.pl: Corrected the use of the fileparse
2981         function from the Path::Basename module; after reading the documentation for
2982         this it is clear that there is no need to first call basename, and fileparse
2983         should also be used instead of basename.
2984
2985         * platform/mediastream/MediaConstraints.h: Removed unneeded includes.
2986         (WebCore::StringConstraint::appendExact): Removed an incorrect use of clear
2987         here that would mess up cases where there is supposed to be more than one
2988         exact value.
2989
2990         * platform/mediastream/MediaStreamTrackPrivate.cpp: Remvoed unneeded includes.
2991         (WebCore::MediaStreamTrackPrivate::clone): Removed code to copy m_constraints.
2992         (WebCore::MediaStreamTrackPrivate::constraints): Deleted.
2993         * platform/mediastream/MediaStreamTrackPrivate.h: Removed the constraints
2994         function member and the m_constraints data member.
2995
2996 2016-12-15  Dave Hyatt  <hyatt@apple.com>
2997
2998         [CSS Parser] Enable CSS Deferred Parsing
2999         https://bugs.webkit.org/show_bug.cgi?id=165869
3000
3001         Reviewed by Sam Weinig.
3002
3003         Enable CSS deferred parsing once again. It's now behind a pref,
3004         so it's easy to flip off and on.
3005
3006         To address the memory regression that caused the previous rollout,
3007         the tokenizer is no longer retained. Instead the sheet text and escaped
3008         strings are retained by CSSDeferredParser, and then DeferredStyleProperties
3009         and DeferredStyleGroupRuleList make copies of the tokens from the original
3010         tokenization process. As the rules get parsed, these tokens get thrown
3011         away.
3012
3013         This means that instead of the entire set of tokens staying in memory
3014         as long as even one unparsed rule remained, now only the tokens that
3015         still need parsing will remain alive.
3016
3017         Unparsed rules will consume slightly more memory than parsed rules, but
3018         the more unparsed rules you have, the bigger the performance win as
3019         well, so this is a tradeoff. Given that the parsing speed is going up
3020         by anywhere from 25-40% on cold loads of pages (where all stylesheets
3021         have to parse), this seems worth it to me.
3022
3023         * css/parser/CSSParserMode.h:
3024         * page/Settings.in:
3025
3026 2016-12-15  Alejandro G. Castro  <alex@igalia.com>
3027
3028         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
3029         https://bugs.webkit.org/show_bug.cgi?id=165316
3030
3031         Reviewed by Philippe Normand.
3032
3033         Fixed the ended support of the video element in the OWR player and
3034         fixed the videoTracks support. Now the OW player properly adds and
3035         removes the audio and video tracks. Added the getSettings support
3036         to the mediastream interface. Solved also the size handling in
3037         some of the enable/muted situations.
3038
3039         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
3040
3041         * platform/GStreamer.cmake: Added the new
3042         RealtimeMediaSourceOwr.cpp with the new code handling the
3043         settings.
3044         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
3045         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
3046         Release the new video and audio maps that creates a relationship
3047         of the mediastream tracks with the mediatracks of the video element.
3048         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
3049         false when we start playing.
3050         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
3051         tracks to the player so that the videoTracks API returns it, and
3052         add an entry in the map to be able to restore it using the
3053         mediastream track.
3054         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
3055         Move some part of the stop function to this one in order to use it
3056         in pause method and avoid changing the video selection in that
3057         case.
3058         (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
3059         function disableMediaTracks and we also change teh selected
3060         videoTrack.
3061         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
3062         videoTrack reset the size and the selected element. In case there
3063         is no media playing we Make sure we set the ended variable to true
3064         and call the timeChange to modify the state of the player.
3065         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
3066         Handle properly the situation when the user changed the enabled
3067         value, we disable the media.
3068         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the
3069         size of the source.
3070         (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided
3071         to make sure we return a size even when the sample is not ready
3072         for gst.
3073         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
3074         Added the ended attribute and the maps.
3075         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
3076         (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new
3077         realtime video and audio sources classes, this new classes
3078         implement the settings of each type of media element.
3079         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3080         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
3081         Use the new audio and video source classes instead of the general
3082         one in order to handle the settings properly.
3083         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added
3084         (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the
3085         subclass and return the new currentSettings attribute.
3086         (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the
3087         subclass initialization of the supportedSettings.
3088         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3089         (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to
3090         initialize the settings before returning the value. Implemented in
3091         the subclass.
3092         (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints):
3093         Added to initialize the supported settings of the
3094         media. Implemented in the subclass.
3095         (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp
3096         file, implemented using the initialize functions of the subclass
3097         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added
3098         this new class to handle the settings of the video elements. The
3099         class initializes the settings and the supportedSettings.
3100         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added
3101         this new class to handle the settings of the audio elements. The
3102         class initializes the settings and the supportedSettings.
3103
3104
3105 2016-12-15  Alex Christensen  <achristensen@webkit.org>
3106
3107         REGRESSION (r208902) Null pointer dereference in wkIsPublicSuffix
3108         https://bugs.webkit.org/show_bug.cgi?id=165885
3109         <rdar://problem/29476917>
3110
3111         Reviewed by Darin Adler.
3112
3113         wkIsPublicSuffix crashes if you give it a nil NSString*.
3114         This was possible before IDN2008 adoption, but it's more common now
3115         because domains like "r4---asdf.example.com" fail in uidna_nameToASCII but not in uidna_IDNToASCII.
3116         decodeHostName can return a nil NSString.  We can't use it unchecked, so instead we use an algorithm that allows
3117         for decoding failures while still finding top privately controlled domains correctly.
3118
3119         Tested by new API tests which crash before this change and verify the behavior matches behavior before r208902.
3120
3121         * platform/mac/PublicSuffixMac.mm:
3122         (WebCore::isPublicSuffix):
3123         (WebCore::topPrivatelyControlledDomain):
3124
3125 2016-12-15  Alex Christensen  <achristensen@webkit.org>
3126
3127         Fix Windows WebGL build after r209832
3128
3129         * CMakeLists.txt:
3130
3131 2016-12-14  Hunseop Jeong  <hs85.jeong@samsung.com>
3132
3133         Unreviewed build fix after r209832
3134
3135         * platform/graphics/PlatformDisplay.cpp: 
3136         (WebCore::PlatformDisplay::sharedDisplay): Added the guard for the clang
3137
3138 2016-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
3139
3140         [GTK] Support latest SubtleCrypto HMAC APIs
3141         https://bugs.webkit.org/show_bug.cgi?id=165863
3142
3143         Reviewed by Sam Weinig.
3144
3145         SubtleCrypto spec is updated, and new delegate implementations are required to support these interfaces.
3146         This patch implements platformSign and platformVerify with WorkQueues for gcrypt backend.
3147
3148         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
3149         (WebCore::calculateSignature):
3150         (WebCore::CryptoAlgorithmHMAC::platformSign):
3151         (WebCore::CryptoAlgorithmHMAC::platformVerify):
3152
3153 2016-12-14  Chris Dumez  <cdumez@apple.com>
3154
3155         Unreviewed, rolling out r209415.
3156
3157         This workaround is no longer needed now that
3158         <rdar://problem/29518605> has been fixed
3159
3160         Reverted changeset:
3161
3162         "Add HTML interactive form validation blacklist for some
3163         WebKit-specific sites"
3164         https://bugs.webkit.org/show_bug.cgi?id=165470
3165         http://trac.webkit.org/changeset/209415
3166
3167 2016-12-14  Dean Jackson  <dino@apple.com>
3168
3169         Update prefers-reduced-motion syntax
3170         https://bugs.webkit.org/show_bug.cgi?id=165880
3171         <rdar://problems/29671807>
3172
3173         Reviewed by Sam Weinig.
3174
3175         After discussion in:
3176         https://github.com/w3c/csswg-drafts/issues/442
3177         ... the syntax of prefers-reduced-motion was changed
3178         to accept "reduce" or "no-preference".
3179
3180         Updated the tests in fast/media.
3181
3182         * css/CSSValueKeywords.in: Add no-preference keyword.
3183         * css/MediaQueryEvaluator.cpp:
3184         (WebCore::prefersReducedMotionEvaluate):
3185
3186 2016-12-14  Sam Weinig  <sam@webkit.org>
3187
3188         REGRESSION (204679): Google notifications never load (expecting DOMStringList rather than JS array for Location.ancestorOrigins)
3189         <rdar://problem/29573563>
3190         https://bugs.webkit.org/show_bug.cgi?id=165872
3191
3192         Reviewed by Chris Dumez.
3193
3194         Revert the Location.ancestorOrigins part of r204679 because google.com is relying on
3195         it returning a DOMStringList (or at least something with a .item() function), rather
3196         than a frozen javascript array.
3197         
3198         Spec changes are tracked with https://github.com/whatwg/html/issues/2179.
3199
3200         * page/Location.cpp:
3201         (WebCore::Location::ancestorOrigins):
3202         * page/Location.h:
3203         * page/Location.idl:
3204         Change Location.ancestorOrigins back to returning a DOMStringList.
3205
3206 2016-12-14  Dave Hyatt  <hyatt@apple.com>
3207
3208         [CSS Parser] Rename StyleKeyframe to StyleRuleKeyframe
3209         https://bugs.webkit.org/show_bug.cgi?id=165876
3210
3211         Reviewed by Simon Fraser.
3212
3213         * css/CSSKeyframeRule.cpp:
3214         (WebCore::StyleRuleKeyframe::StyleRuleKeyframe):
3215         (WebCore::StyleRuleKeyframe::~StyleRuleKeyframe):
3216         (WebCore::StyleRuleKeyframe::mutableProperties):
3217         (WebCore::StyleRuleKeyframe::keyText):
3218         (WebCore::StyleRuleKeyframe::setKeyText):
3219         (WebCore::StyleRuleKeyframe::cssText):
3220         (WebCore::CSSKeyframeRule::CSSKeyframeRule):
3221         (WebCore::StyleKeyframe::StyleKeyframe): Deleted.
3222         (WebCore::StyleKeyframe::~StyleKeyframe): Deleted.
3223         (WebCore::StyleKeyframe::mutableProperties): Deleted.
3224         (WebCore::StyleKeyframe::keyText): Deleted.
3225         (WebCore::StyleKeyframe::setKeyText): Deleted.
3226         (WebCore::StyleKeyframe::cssText): Deleted.
3227         * css/CSSKeyframeRule.h:
3228         * css/CSSKeyframesRule.cpp:
3229         (WebCore::StyleRuleKeyframes::keyframes):
3230         (WebCore::StyleRuleKeyframes::parserAppendKeyframe):
3231         (WebCore::StyleRuleKeyframes::wrapperAppendKeyframe):
3232         (WebCore::CSSKeyframesRule::appendRule):
3233         (WebCore::CSSKeyframesRule::item):
3234         * css/CSSKeyframesRule.h:
3235         * css/StyleResolver.cpp:
3236         (WebCore::StyleResolver::styleForKeyframe):
3237         (WebCore::StyleResolver::keyframeStylesForAnimation):
3238         * css/StyleResolver.h:
3239         * css/StyleRule.cpp:
3240         (WebCore::StyleRuleBase::destroy):
3241         * css/StyleRule.h:
3242         * css/parser/CSSParser.cpp:
3243         (WebCore::CSSParser::parseKeyframeRule):
3244         * css/parser/CSSParser.h:
3245         * css/parser/CSSParserImpl.cpp:
3246         (WebCore::CSSParserImpl::parseDeferredKeyframeList):
3247         (WebCore::CSSParserImpl::consumeKeyframesRule):
3248         (WebCore::CSSParserImpl::consumeKeyframeStyleRule):
3249         * css/parser/CSSParserImpl.h:
3250
3251 2016-12-14  Dave Hyatt  <hyatt@apple.com>
3252
3253         [CSS Parser] Make deferred parsing retain the sheet text. Fix invalidation to avoid deferred parsing.
3254         https://bugs.webkit.org/show_bug.cgi?id=165868
3255
3256         Reviewed by Simon Fraser.
3257
3258         With this new model of token copying, the sheet text needs to be retained. The tokenizer did this,
3259         but we're no longer keeping it around.
3260
3261         StyleInvalidation is also aggressively crawling media rules, even unsupported ones, so fix it
3262         to avoid deferred parsing.
3263
3264         * css/StyleInvalidationAnalysis.cpp:
3265         (WebCore::shouldDirtyAllStyle):
3266         * css/parser/CSSDeferredParser.cpp:
3267         (WebCore::CSSDeferredParser::CSSDeferredParser):
3268         * css/parser/CSSDeferredParser.h:
3269         (WebCore::CSSDeferredParser::create):
3270         * css/parser/CSSParserImpl.cpp:
3271         (WebCore::CSSParserImpl::CSSParserImpl):
3272
3273 2016-12-14  Ryosuke Niwa  <rniwa@webkit.org>
3274
3275         iOS: An element with tabindex is not focusable unless there is no mouse event handler
3276         https://bugs.webkit.org/show_bug.cgi?id=165843
3277
3278         Reviewed by Antti Koivisto.
3279
3280         The bug was caused by ancestorRespondingToClickEvents not checking the precense of tabindex attribute.
3281         Check that condition along with event listeners.
3282
3283         Test: fast/events/focusing-element-with-tabindex-by-tap-or-click.html
3284
3285         * page/ios/FrameIOS.mm:
3286         (WebCore::ancestorRespondingToClickEvents):
3287
3288 2016-12-14  Alex Christensen  <achristensen@webkit.org>
3289
3290         Progress towards using ANGLE to do WebGL rendering
3291         https://bugs.webkit.org/show_bug.cgi?id=165864
3292
3293         Reviewed by Dean Jackson.
3294
3295         No new tests, no change in behavior.
3296         Just compile fixes for a configuration that will soon be standard
3297         that can be landed now without breaking anything.
3298
3299         * platform/graphics/PlatformDisplay.cpp:
3300         (WebCore::PlatformDisplay::sharedDisplay):
3301         Ignore some clang warnings that will cause problems when this is compiled on Mac.
3302
3303 2016-12-14  Dean Jackson  <dino@apple.com>
3304
3305         [iOS] MediaDocuments have controls on the bottom of the page
3306         https://bugs.webkit.org/show_bug.cgi?id=165865
3307         <rdar://problem/28757268>
3308
3309         Reviewed by Jon Lee.
3310
3311         MediaDocuments on iOS are incorrectly placing the controls at
3312         the bottom of the page. This is due to the <video> element
3313         getting a height of 100%. It should be "auto" instead.
3314
3315         * html/MediaDocument.cpp:
3316         (WebCore::MediaDocumentParser::createDocumentStructure):
3317
3318 2016-12-14  Dave Hyatt  <hyatt@apple.com>
3319
3320         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
3321         https://bugs.webkit.org/show_bug.cgi?id=165743
3322
3323         Reviewed by Dean Jackson.
3324
3325         Added new tests in fast/css/deferred-parsing.
3326
3327         This patch implements deferred parsing in CSS. By default, when parsing
3328         author stylesheets, the parser goes into a deferred mode where it leaves
3329         the declaration block of all style rules unparsed initially. Instead of
3330         creating and setting an ImmutableStyleProperties object on the StyleRule,
3331         the parser creates a DeferredStyleProperties object instead that is
3332         capable of calling into CSSDeferredParser to parse the properties and values
3333         only when the properties are finally asked for.
3334
3335         In addition, this patch defers the parsing of the interior of @media,
3336         @supports, and @keyframes rules. @media blocks that are never matched will
3337         never parse any of the rules inside. @supports conditions for unsupported
3338         features will also not be parsed. For @keyframes, if the animation is never
3339         referenced/used, then the @keyframes child rules will never be parsed.
3340
3341         * CMakeLists.txt:
3342         * WebCore.xcodeproj/project.pbxproj:
3343         Add CSSDeferredParser to the build.
3344
3345         * css/CSSFontFaceSet.cpp:
3346         (WebCore::CSSFontFaceSet::matchingFaces):
3347         Patched to drop the StyleSheetContents* argument from parseValue, since it
3348         is no longer needed.
3349
3350         * css/CSSKeyframesRule.cpp:
3351         (WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
3352         (WebCore::StyleRuleKeyframes::parseDeferredRulesIfNeeded):
3353         (WebCore::StyleRuleKeyframes::keyframes):
3354         (WebCore::StyleRuleKeyframes::wrapperAppendKeyframe):
3355         (WebCore::StyleRuleKeyframes::wrapperRemoveKeyframe):
3356         (WebCore::StyleRuleKeyframes::findKeyframeIndex):
3357         * css/CSSKeyframesRule.h:
3358         Keyframes now hold both a keyframes Vector and a DeferredStyleGroupRuleList
3359         object. The keyframes vector won't be populated until it is needed, and the
3360         population is done by DeferredStyleGroupRuleList, which holds both the original
3361         tokens of the keyframes rule interior, and a references to the
3362         CSSDeferredParser that will do the parsing.
3363
3364         * css/DOMCSSNamespace.cpp:
3365         (WebCore::DOMCSSNamespace::supports):
3366         Patched to drop the StyleSheetContents* argument from parseValue, since it
3367         is no longer needed.
3368
3369         * css/ElementRuleCollector.cpp:
3370         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
3371         ElementRuleCollector tests to see if a rule is empty by counting properties(),
3372         but we don't want to initiate deferred parsing just to check this. Instead we
3373         invoke propertiesWithoutDeferredParsing, which will hand back a nullptr if
3374         the properties haven't been parsed yet. In order to ensure this optimization
3375         continues to work, any rules whose interiors consist of only whitespace do
3376         not get deferred.
3377
3378         * css/FontFace.cpp:
3379         (WebCore::FontFace::setVariant):
3380         * css/PropertySetCSSStyleDeclaration.cpp:
3381         (WebCore::PropertySetCSSStyleDeclaration::setProperty):
3382         (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
3383         Patched to drop the StyleSheetContents* argument from parseValue, since it
3384         is no longer needed.
3385
3386         * css/StyleProperties.cpp:
3387         (WebCore::MutableStyleProperties::MutableStyleProperties):
3388         (WebCore::MutableStyleProperties::setProperty):
3389         (WebCore::DeferredStyleProperties::create):
3390         (WebCore::DeferredStyleProperties::DeferredStyleProperties):
3391         (WebCore::DeferredStyleProperties::~DeferredStyleProperties):
3392         (WebCore::DeferredStyleProperties::parseDeferredProperties):
3393         * css/StyleProperties.h:
3394         (WebCore::StylePropertiesBase::type):
3395         (WebCore::StylePropertiesBase::cssParserMode):
3396         (WebCore::StylePropertiesBase::StylePropertiesBase):
3397         (WebCore::StyleProperties::isMutable):
3398         (WebCore::StyleProperties::StyleProperties):
3399         (WebCore::StylePropertiesBase::deref):
3400         (isType):
3401         (WebCore::StyleProperties::cssParserMode): Deleted.
3402         (WebCore::StyleProperties::deref): Deleted.
3403         Right now StyleProperties has two subclasses, ImmutableStyleProperties (which
3404         is created by the parser when not deferring), and MutableStyleProperties (used
3405         when making changes and doing DOM Manipulations).
3406
3407         This patch adds a new base class called StylePropertiesBase, and StyleProperties
3408         now derives from it. DeferredStyleProperties derives from this base. The members
3409         of StyleProperties have been moved up into StylePropertiesBase.
3410
3411         The m_isMutable bit, used to determine the type for downcasting has been enhanced
3412         to m_type (2 bits), since there are now three possible subclasses.
3413
3414         * css/StyleRule.cpp:
3415         (WebCore::StyleRule::StyleRule):
3416         (WebCore::StyleRule::properties):
3417         (WebCore::StyleRule::mutableProperties):
3418         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
3419         Patched to ensure that when properties() are accessed, that if the current
3420         stored StylePropertyBase in the rule is a DeferredStyleProperties, we then
3421         parse and&nbs