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