869733c1804dcfadfd0c83febaae85a6048024ee
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
2
3         Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource
4         https://bugs.webkit.org/show_bug.cgi?id=165569
5         <rdar://problem/29607569>
6
7         Reviewed by Youenn Fablet.
8
9         Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
10
11         * Modules/fetch/FetchLoader.cpp:
12         (WebCore::FetchLoader::start):
13         * loader/DocumentThreadableLoader.cpp:
14         (WebCore::DocumentThreadableLoader::didReceiveResponse):
15         * loader/ThreadableLoader.cpp:
16         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
17         * loader/ThreadableLoader.h:
18         * loader/WorkerThreadableLoader.cpp:
19         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
20         Add a new ThreadableLoader option to avoid filtering the response.
21
22         * workers/WorkerScriptLoader.cpp:
23         (WebCore::WorkerScriptLoader::loadSynchronously):
24         (WebCore::WorkerScriptLoader::loadAsynchronously):
25         Disable filtering of the response. This is an internal load, we
26         don't want to filter data that would be valuable later.
27
28 2017-01-03  Sam Weinig  <sam@webkit.org>
29
30         Remove final custom binding from IDBRequest
31         https://bugs.webkit.org/show_bug.cgi?id=166671
32
33         Reviewed by Alex Christensen.
34
35         * CMakeLists.txt:
36         * WebCore.xcodeproj/project.pbxproj:
37         Remove JSIDBRequestCustom.cpp
38
39         * bindings/js/JSIDBRequestCustom.cpp: Removed.
40
41         * Modules/indexeddb/IDBRequest.cpp:
42         (WebCore::IDBRequest::IDBRequest):
43         (WebCore::IDBRequest::~IDBRequest):
44         (WebCore::IDBRequest::result):
45         (WebCore::IDBRequest::setSource):
46         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
47         (WebCore::IDBRequest::sourceIndexIdentifier):
48         (WebCore::IDBRequest::requestedIndexRecordType):
49         (WebCore::IDBRequest::setResult):
50         (WebCore::IDBRequest::setResultToStructuredClone):
51         (WebCore::IDBRequest::setResultToUndefined):
52         (WebCore::IDBRequest::resultCursor):
53         (WebCore::IDBRequest::willIterateCursor):
54         (WebCore::IDBRequest::didOpenOrIterateCursor):
55         (WebCore::IDBRequest::source): Deleted.
56         (WebCore::IDBRequest::clearResult): Deleted.
57         * Modules/indexeddb/IDBRequest.h:
58         (WebCore::IDBRequest::source):
59         (WebCore::IDBRequest::cursorResult): Deleted.
60         (WebCore::IDBRequest::databaseResult): Deleted.
61         (WebCore::IDBRequest::scriptResult): Deleted.
62         Replace multiple member variables with Variants for source and result. Add a result
63         member function that properly sets an exception if not "done".
64
65         * Modules/indexeddb/IDBRequest.idl:
66         Remove CustomGetter annotation and add type.
67
68         * bindings/generic/IDLTypes.h:
69         (WebCore::IDLAny::nullValue):
70         (WebCore::IDLAny::isNullValue):
71         (WebCore::IDLAny::extractValueFromNullable):
72         * bindings/js/JSDOMConvert.h:
73         (WebCore::Converter<IDLAny>::convert):
74         Flesh out IDLAny to be implemented as a Strong<Unknown> when used in aggregate types,
75         but still work with JSValue when passing as a parameter.
76
77         * inspector/InspectorIndexedDBAgent.cpp:
78         Update for new return value of IDBRequest::result().
79
80 2017-01-04  Tim Horton  <timothy_horton@apple.com>
81
82         Provide a setting for clients to always prefer low-power WebGL
83         https://bugs.webkit.org/show_bug.cgi?id=166675
84         <rdar://problem/29834093>
85
86         Reviewed by Dan Bernstein.
87
88         No new tests; as noted in r204664, we don't know how to reliably test
89         automatic graphics switching. One could use the manual test introduced
90         in that commit; after this commit, with the setting switched on, on a
91         dual-GPU machine that is actively using integrated graphics, that test
92         should return the same result for both contexts.
93
94         * page/Settings.in:
95         Add a setting to prefer low-power WebGL.
96
97         * html/canvas/WebGLRenderingContextBase.cpp:
98         (WebCore::WebGLRenderingContextBase::create):
99         If said setting is enabled, set preferLowPowerToHighPerformance.
100
101 2017-01-03  Ryosuke Niwa  <rniwa@webkit.org>
102
103         label element with tabindex >= 0 is not focusable
104         https://bugs.webkit.org/show_bug.cgi?id=102780
105         <rdar://problem/29796608>
106
107         Reviewed by Darin Adler.
108
109         Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false.
110
111         This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome
112         and Firefox.
113
114         Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused
115         the associated form control when there is one even if the element itself is focusable. Without this fix,
116         traversing from control with shift+tab would break since focusing the label would move the focus back
117         to the input element inside the label element.
118
119         Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first.
120
121         The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb
122
123         Test: fast/events/focus-label-legend-elements-with-tabindex.html
124
125         * html/HTMLLabelElement.cpp:
126         (WebCore::HTMLLabelElement::focus):
127         (WebCore::HTMLLabelElement::isFocusable): Deleted.
128         * html/HTMLLabelElement.h:
129         * html/HTMLLegendElement.cpp:
130         (WebCore::HTMLLegendElement::focus):
131
132 2017-01-03  Tim Horton  <timothy_horton@apple.com>
133
134         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
135         https://bugs.webkit.org/show_bug.cgi?id=166450
136         <rdar://problem/29447824>
137
138         Reviewed by Darin Adler.
139
140         Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
141
142         * editing/AlternativeTextController.cpp:
143         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
144         (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
145         * editing/AlternativeTextController.h:
146         Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
147         a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
148         of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
149
150         * editing/Editor.cpp:
151         (WebCore::Editor::markAndReplaceFor):
152         Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
153
154         (WebCore::Editor::changeBackToReplacedString):
155         Adopt recordAutocorrectionResponse.
156
157         * page/AlternativeTextClient.h:
158         Add an "AutocorrectionAccepted" response type.
159
160 2017-01-03  Nan Wang  <n_wang@apple.com>
161
162         AX: Focus should jump into modal dialogs when one appears
163         https://bugs.webkit.org/show_bug.cgi?id=166670
164
165         Reviewed by Chris Fleizach.
166
167         Added a timer to let focus jump into a modal dialog if the web
168         author didn't handle the focus movement.
169
170         Test: accessibility/mac/aria-modal-auto-focus.html
171
172         * accessibility/AXObjectCache.cpp:
173         (WebCore::AXObjectCache::AXObjectCache):
174         (WebCore::AXObjectCache::~AXObjectCache):
175         (WebCore::firstFocusableChild):
176         (WebCore::AXObjectCache::focusAriaModalNode):
177         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired):
178         (WebCore::AXObjectCache::handleAriaModalChange):
179         * accessibility/AXObjectCache.h:
180         (WebCore::AXObjectCache::focusAriaModalNode):
181
182 2017-01-03  Andy Estes  <aestes@apple.com>
183
184         Rename SharedBufferMac.mm to SharedBufferCocoa.mm
185         https://bugs.webkit.org/show_bug.cgi?id=166666
186
187         Reviewed by Tim Horton.
188
189         * PlatformMac.cmake:
190         * WebCore.xcodeproj/project.pbxproj:
191         * platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.
192
193 2017-01-03  Sam Weinig  <sam@webkit.org>
194
195         Re-implement ExceptionOr on top of WTF::Expected
196         https://bugs.webkit.org/show_bug.cgi?id=166668
197
198         Reviewed by Alex Christensen.
199
200         As a first step towards using WTF::Expected instead of ExceptionOr,
201         use Expected as an implementation detail, rather than Variant/std::optional. 
202
203         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
204         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
205         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
206         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
207         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
208         Add missing #include of Variant.h
209
210         * dom/ExceptionOr.h:
211         (WebCore::ExceptionOr<ReturnType>::ExceptionOr):
212         (WebCore::ExceptionOr<ReturnType>::hasException):
213         (WebCore::ExceptionOr<ReturnType>::releaseException):
214         (WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
215         (WebCore::ExceptionOr<void>::ExceptionOr):
216         (WebCore::ExceptionOr<void>::hasException):
217         (WebCore::ExceptionOr<void>::releaseException):
218         Re-implement on top of Expected.
219
220 2017-01-03  Chris Dumez  <cdumez@apple.com>
221
222         Make setting Event's cancelBubble to false a no-op
223         https://bugs.webkit.org/show_bug.cgi?id=166018
224
225         Reviewed by Ryosuke Niwa.
226
227         Align behavior of Event.cancelBubble with the latest DOM specification:
228         - https://dom.spec.whatwg.org/#dom-event-cancelbubble
229
230         Setting it to true sets the 'stop propagation' flag to true and setting
231         it to false is now a no-op.
232
233         Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
234                imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
235                imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html
236
237         * Modules/indexeddb/IDBEventDispatcher.cpp:
238         (WebCore::IDBEventDispatcher::dispatch):
239         * dom/Event.h:
240         (WebCore::Event::cancelBubble):
241         (WebCore::Event::setCancelBubble):
242         * dom/EventDispatcher.cpp:
243         (WebCore::dispatchEventInDOM):
244
245 2017-01-03  Jer Noble  <jer.noble@apple.com>
246
247         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
248         https://bugs.webkit.org/show_bug.cgi?id=166421
249         <rdar://problem/29782862>
250
251         Reviewed by Dan Bernstein.
252
253         Follow up after r210099; fix the __has_include directive to include the framework and fix the #import inside #if.
254
255         * platform/spi/mac/AVFoundationSPI.h:
256
257 2017-01-03  Andreas Kling  <akling@apple.com>
258
259         REGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes under GuardMalloc
260         <https://webkit.org/b/166657>
261         <rdar://problem/29848806>
262
263         Reviewed by Antti Koivisto.
264
265         The problem was that tearDownRenderers() would cause commit Widget hierarchy updates
266         before returning, which is just before Document clears its m_renderView pointer.
267         This led to an awkward callback into Page::setActivityState() which ended up trying
268         to clear the selection inside a partially dead render tree.
269
270         Fix this by adding a WidgetHierarchyUpdatesSuspensionScope to Document::destroyRenderTree()
271         which ensures that Widget updates don't happen until after Document::m_renderView is cleared.
272
273         * dom/Document.cpp:
274         (WebCore::Document::destroyRenderTree):
275
276 2017-01-03  Andreas Kling  <akling@apple.com>
277
278         Placeholder style mechanism leaks CSSFontSelector for first Document styled.
279         <https://webkit.org/b/166652>
280
281         Reviewed by Antti Koivisto.
282
283         The placeholder style is used when we're resolving style for a non-rendered
284         element, or any element before stylesheets have loaded.
285
286         An old optimization had us reusing the same style each time, which meant that
287         since it was initialized with a font selector the first time, it kept that
288         font selector alive forever.
289
290         As we have to clone the style anyway, fix this by just making a new style
291         each time, using the current document's font selector.
292
293         * style/StyleTreeResolver.cpp:
294         (WebCore::Style::makePlaceholderStyle):
295         (WebCore::Style::TreeResolver::TreeResolver):
296         (WebCore::Style::TreeResolver::styleForElement):
297         (WebCore::Style::ensurePlaceholderStyle): Deleted.
298         (WebCore::Style::isPlaceholderStyle): Deleted.
299         * style/StyleTreeResolver.h:
300
301 2017-01-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
302
303         A floating element within <li> overlaps with the marker
304         https://bugs.webkit.org/show_bug.cgi?id=166528
305
306         Reviewed by Zalan Bujtas.
307
308         Merged from Blink (patch by trobhogan@gmail.com):
309         https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
310         https://crbug.com/548616
311
312         Establish a list marker's offset before floats have been added to its line.
313
314         Computing the offset for a list marker after the rest of the objects on the line
315         it is on have been laid out, means it will avoid floats it ought not to.
316
317         Instead, compute the offset when laying out the marker and cache it for use later.
318
319         Tests: fast/lists/list-marker-before-float-nested-rtl.html
320                fast/lists/list-marker-before-float-nested.html
321                fast/lists/list-marker-before-float-rtl.html
322                fast/lists/list-marker-before-float.html
323
324         * rendering/RenderListItem.cpp:
325         (WebCore::RenderListItem::positionListMarker):
326         * rendering/RenderListMarker.cpp:
327         (WebCore::RenderListMarker::RenderListMarker):
328         (WebCore::RenderListMarker::layout):
329         * rendering/RenderListMarker.h:
330
331 2017-01-03  Per Arne Vollan  <pvollan@apple.com>
332
333         [Win] Some xmlhttprequest tests are failing.
334         https://bugs.webkit.org/show_bug.cgi?id=166638
335
336         Reviewed by Darin Adler.
337
338         The tests are failing because the request timeout is set to zero.
339         When the timeout is set to zero, we should use the default timeout.
340
341         * platform/network/cf/ResourceRequestCFNet.cpp:
342         (WebCore::ResourceRequest::doUpdatePlatformRequest):
343         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
344
345 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
346
347         Unreviewed, follow-up fix for r210227
348         https://bugs.webkit.org/show_bug.cgi?id=166586
349
350         Suggested in the above bug.
351
352         * bindings/scripts/StaticString.pm:
353         (GenerateStrings):
354
355 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
356
357         Use StaticStringImpl instead of StaticASCIILiteral
358         https://bugs.webkit.org/show_bug.cgi?id=166586
359
360         Reviewed by Darin Adler.
361
362         * bindings/scripts/StaticString.pm:
363         (GenerateStrings):
364
365 2017-01-02  Andreas Kling  <akling@apple.com>
366
367         Drop the render tree for documents in the page cache.
368         <https://webkit.org/b/121798>
369
370         Reviewed by Antti Koivisto.
371
372         To save memory and reduce complexity, have documents tear down their render tree
373         when entering the page cache. I've wanted to do this for a long time and it seems
374         like we can actually do it now.
375
376         This patch will enable a number of clean-ups since it's no longer valid for renderers
377         to exist while the document is in page cache.
378
379         * dom/Document.cpp:
380         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
381         since we will now be tearing down render trees right as they enter the page cache.
382
383         * dom/PageCache.cpp:
384         (WebCore::destroyRenderTree):
385         (WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting
386         the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the
387         main frame renderers die last.
388
389         * history/CachedFrame.cpp:
390         (WebCore::CachedFrameBase::restore):
391         * page/FrameView.h:
392         * page/FrameView.cpp:
393         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring
394         a frame from the page cache. This dirties the scrolling tree, which was covered by tests.
395
396         * page/animation/AnimationBase.cpp:
397         (WebCore::AnimationBase::setNeedsStyleRecalc):
398         * page/animation/AnimationController.cpp:
399         (WebCore::AnimationController::cancelAnimations): Make these no-ops if called
400         while the render tree is being torn down. This fixes some assertion failures
401         on layout tests and avoids pointless style invalidation.
402
403 2017-01-02  Andreas Kling  <akling@apple.com>
404
405         Discard media controls JS/CSS caches under memory pressure.
406         <https://webkit.org/b/166639>
407
408         Reviewed by Antti Koivisto.
409
410         Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations
411         to drop their cached media controls JS/CSS strings there. The strings are only cleared
412         if nothing else is referencing them, which gives us a decent "weak cache" behavior.
413
414         This sheds ~300kB memory on iOS with the current media controls.
415
416         * page/MemoryRelease.cpp:
417         (WebCore::releaseNoncriticalMemory):
418         * rendering/RenderTheme.h:
419         (WebCore::RenderTheme::purgeCaches):
420         * rendering/RenderThemeIOS.h:
421         * rendering/RenderThemeIOS.mm:
422         (WebCore::RenderThemeIOS::purgeCaches):
423         * rendering/RenderThemeMac.h:
424         * rendering/RenderThemeMac.mm:
425         (WebCore::RenderThemeMac::purgeCaches):
426
427 2017-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
428
429         [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls
430         https://bugs.webkit.org/show_bug.cgi?id=164052
431
432         Reviewed by Michael Catanzaro.
433
434         Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that
435         much.
436
437         * platform/linux/MemoryPressureHandlerLinux.cpp:
438         (WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller):
439
440 2017-01-02  Chris Fleizach  <cfleizach@apple.com>
441
442         AX: Expose block quote level to iOS API
443         https://bugs.webkit.org/show_bug.cgi?id=166629
444         <rdar://problem/29834793>
445
446         Reviewed by Darin Adler.
447
448         Expose the blockquote level to iOS Accessbility API.
449         Change the return type of blockquote level to unsigned.
450
451         Test: accessibility/ios-simulator/blockquote-level.html
452
453         * accessibility/AccessibilityObject.cpp:
454         (WebCore::AccessibilityObject::blockquoteLevel):
455         * accessibility/AccessibilityObject.h:
456         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
457         (-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
458         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
459         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
460
461 2017-01-01  Jeff Miller  <jeffm@apple.com>
462
463         Update user-visible copyright strings to include 2017
464         https://bugs.webkit.org/show_bug.cgi?id=166278
465
466         Reviewed by Dan Bernstein.
467
468         * Info.plist:
469
470 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
471
472         GraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
473         https://bugs.webkit.org/show_bug.cgi?id=166539
474
475         Reviewed by Michael Catanzaro.
476
477         * platform/graphics/cairo/GraphicsContextCairo.cpp:
478         (WebCore::GraphicsContext::setMiterLimit): Call the setMiterLimit() method on the
479         m_displayListRecorder object when the GraphicsContext object is in recording mode.
480
481 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
482
483         Clean up GraphicsContext3D forward declarations, header inclusion
484         https://bugs.webkit.org/show_bug.cgi?id=166537
485
486         Reviewed by Alex Christensen.
487
488         Remove two unnecessary GraphicsContext3D forward declarations from the
489         EmptyClients and ChromeClient header files, and remove the unnecessary
490         GraphicsContext3D.h header inclusion from RenderLayerBacking.
491
492         No changes in behavior.
493
494         * loader/EmptyClients.h:
495         * page/ChromeClient.h:
496         * rendering/RenderLayerBacking.cpp:
497
498 2016-12-31  Michael Catanzaro  <mcatanzaro@igalia.com>
499
500         SecurityOrigin::create triplet constructor does not canonicalize port
501         https://bugs.webkit.org/show_bug.cgi?id=166624
502
503         Reviewed by Daniel Bates.
504
505         It is currently possible to create two different unequal SecurityOrigin objects that
506         represent the same security origin. The SecurityOrigin create functions that take URL and
507         String parameters convert the port to nullopt if it is the default port for the protocol,
508         but the separate protocol/host/port constructor doesn't. Change it to parallel the other
509         constructors.
510
511         * page/SecurityOrigin.cpp:
512         (WebCore::SecurityOrigin::create):
513         * page/SecurityOrigin.h: Export isSameOriginAs for use by tests.
514
515 2016-12-25  Darin Adler  <darin@apple.com>
516
517         Remove setDOMException and a few custom bindings
518         https://bugs.webkit.org/show_bug.cgi?id=166002
519
520         Reviewed by Sam Weinig.
521
522         * CMakeLists.txt: Removed JSFileReaderCustom.cpp.
523
524         * WebCore.xcodeproj/project.pbxproj: Removed JSFileReaderCustom.cpp.
525
526         * bindings/js/CallbackFunction.cpp:
527         (WebCore::checkFunctionOnlyCallback): Use throwTypeMismatchError instead
528         of calling setDOMException with TYPE_MISMATCH_ERR.
529
530         * bindings/js/JSBindingsAllInOne.cpp: Removed JSFileReaderCustom.cpp.
531
532         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
533         (WebCore::JSCSSStyleDeclaration::putDelegate): Pass a throw scope in to
534         propagateException.
535
536         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
537         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
538         Renamed from getAlgorithmIdentifier. Got rid of bool return value, instead
539         use a conventional return value and conventional JavaScript exception
540         handling. Added a ThrowScope argument.
541         (WebCore::optionalHashAlgorithm): Added. Returns an optional hash algorithm.
542         Also makes the same changes as above, conventional exception handling and
543         ThrowScope argument.
544         (WebCore::requiredHashAlgorithm): Added. Like the above but throws an
545         exception if the algorithm is omitted.
546         (WebCore::getHashAlgorithm): Deleted. Replaced by the two functions above.
547         (WebCore::createAesCbcParams): Updated for above changes.
548         (WebCore::createHmacParams): Ditto.
549         (WebCore::createHmacKeyParams): Ditto.
550         (WebCore::createRsaKeyGenParams): Ditto.
551         (WebCore::createRsaOaepParams): Ditto.
552         (WebCore::createRsaSsaParams): Ditto.
553         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Added
554         a ThrowScope argument, and changed to use throwNotSupportedError instead
555         of setDOMException with NOT_SUPPORTED_ERROR.
556         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
557         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Ditto.
558         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
559         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Ditto.
560         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
561         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
562         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
563         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Ditto.
564         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Ditto.
565         * bindings/js/JSCryptoAlgorithmDictionary.h: Updated for the above changes.
566
567         * bindings/js/JSCryptoOperationData.cpp:
568         (WebCore::cryptoOperationDataFromJSValue): Got rid of bool return value and
569         instead use a conventional return value and conventional JS exception handling.
570         Added a ThrowScope argument.
571         * bindings/js/JSCryptoOperationData.h: Updated for the above.
572
573         * bindings/js/JSCustomXPathNSResolver.cpp:
574         (WebCore::JSCustomXPathNSResolver::create): Use ExceptionOr.
575         (WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver): Take a VM&
576         rather than an ExecState*.
577         * bindings/js/JSCustomXPathNSResolver.h: Updated for the changes above.
578         Also marked class final and fixed indentation.
579
580         * bindings/js/JSDOMBinding.cpp:
581         (WebCore::createDOMException): Updated comment.
582         (WebCore::throwDOMException): Deleted.
583         (WebCore::propagateException): Deleted non-inline overload that does not take
584         a throw scope, now that all callers pass a throw scope.
585         (WebCore::setDOMExceptionSlow): Deleted.
586         (WebCore::setDOMException): Deleted.
587         (WebCore::throwNotSupportedError): Added.
588         (WebCore::throwDOMSyntaxError): Added.
589         (WebCore::throwDataCloneError): Added.
590         (WebCore::throwIndexSizeError): Added.
591         (WebCore::throwTypeMismatchError): Added.
592         * bindings/js/JSDOMBinding.h: Updated for the additions and removals
593         above. Also grouped the standard DOM exception throwing functions separately
594         from the special ones for getters and setters, and sorted them alphabetically.
595
596         * bindings/js/JSDataCueCustom.cpp:
597         (WebCore::createJSDataCue): Added, helper function for the below.
598         (WebCore::constructJSDataCue): Tightened and tweaked a bit.
599
600         * bindings/js/JSFileReaderCustom.cpp: Removed.
601
602         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
603         (WebCore::JSHTMLOptionsCollection::setLength): Use throwIndexSizeError instead
604         of setDOMException with INDEX_SIZE_ERR.
605         * bindings/js/JSHTMLSelectElementCustom.cpp:
606         (WebCore::selectElementIndexSetter): Use throwTypeMismatchError instead of
607         setDOMExceptoin with TYPEMISMATCH_ERR.
608
609         * bindings/js/JSIDBRequestCustom.cpp:
610         (WebCore::JSIDBRequest::result): Pass a throw scope in to
611         propagateException.
612
613         * bindings/js/JSSQLResultSetRowListCustom.cpp:
614         (WebCore::JSSQLResultSetRowList::item): Use throwTypeMismatchError and
615         throwIndexSizeError instead of setDOMException with TYPE_MISMATCH_ERR and
616         INDEX_ERR. This required adding a throw scope.
617
618         * bindings/js/JSSQLTransactionCustom.cpp:
619         (WebCore::JSSQLTransaction::executeSql): Use throwDOMSyntaxError and
620         throwTypeMismatchError instead of setDOMException with SYNTAX_ERR and
621         TYPE_MISMATCH_ERR.
622
623         * bindings/js/JSStorageCustom.cpp:
624         (WebCore::JSStorage::nameGetter): Pass a throw scope in to
625         propagateException.
626
627         * bindings/js/JSSubtleCryptoCustom.cpp:
628         (WebCore::normalizeCryptoAlgorithmParameters): Use throwNotSupportedError
629         instead of setDOMException with NOT_SUPPORTED_ERR.
630         (WebCore::createAlgorithm): Deleted.
631         (WebCore::supportExportKeyThrow): Added ThrowScope argument and use
632         throwNotSupportedError instead of setDOMException with NOT_SUPPORTED_ERR.
633         (WebCore::jsSubtleCryptoFunctionEncryptPromise): Updated for above changes,
634         throwing a not supported exception at this level rather than in a helper.
635         (WebCore::jsSubtleCryptoFunctionDecryptPromise): Ditto.
636         (WebCore::jsSubtleCryptoFunctionSignPromise): Ditto.
637         (WebCore::jsSubtleCryptoFunctionVerifyPromise): Ditto.
638         (WebCore::jsSubtleCryptoFunctionDigestPromise): Ditto.
639         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Ditto.
640         (WebCore::jsSubtleCryptoFunctionImportKeyPromise): Ditto.
641         (WebCore::jsSubtleCryptoFunctionExportKeyPromise): Ditto.
642         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): Ditto.
643         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise): Ditto.
644
645         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
646         (WebCore::createAlgorithmFromJSValue): Got rid of bool return value and
647         instead use a conventional return value and conventional JS exception handling.
648         Added a ThrowScope argument.
649         (WebCore::cryptoKeyFormatFromJSValue): Ditto.
650         (WebCore::cryptoKeyUsagesFromJSValue): Ditto.
651         (WebCore::JSWebKitSubtleCrypto::encrypt): Updated for above changes.
652         (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
653         (WebCore::JSWebKitSubtleCrypto::sign): Ditto.
654         (WebCore::JSWebKitSubtleCrypto::verify): Ditto.
655         (WebCore::JSWebKitSubtleCrypto::digest): Ditto.
656         (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
657         (WebCore::JSWebKitSubtleCrypto::importKey): Ditto.
658         (WebCore::JSWebKitSubtleCrypto::exportKey): Ditto.
659         (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
660         (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.
661
662         * bindings/js/JSXMLHttpRequestCustom.cpp:
663         (WebCore::JSXMLHttpRequest::send): Pass a throw scope in to
664         propagateException.
665         (WebCore::JSXMLHttpRequest::responseText): Ditto.
666
667         * bindings/js/JSXPathNSResolverCustom.cpp:
668         (WebCore::JSXPathNSResolver::toWrapped): Updated since
669         JSCustomXPathNSResolver::create now uses ExceptionOr.
670
671         * bindings/js/SerializedScriptValue.cpp:
672         (WebCore::maybeThrowExceptionIfSerializationFailed): Updated to take
673         a reference instead of a pointer. Fixed the handling of success to be
674         simpler; no need to check the code twice. Use throwDataCloneError instead
675         of setDOMException with DATA_CLONE_ERR.
676         (WebCore::SerializedScriptValue::create): Updated for above.
677         (WebCore::SerializedScriptValue::deserialize): Ditto.
678
679         * bindings/js/StructuredClone.cpp:
680         (WebCore::structuredCloneArrayBuffer): Use throwDataCloneError instead of
681         setDOMException with DATA_CLONE_ERR.
682         (WebCore::structuredCloneArrayBufferView): Ditto.
683
684         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed unneeded empty
685         constructor.
686         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Ditto,
687         moving initialization to where the data member is defined.
688         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Ditto.
689         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Ditto.
690
691         * fileapi/FileReader.cpp:
692         (WebCore::FileReader::result): Added. Returns a combination of optional
693         and variant that matches what the ID specifies. Moved the code from the
694         two following functions in here.
695         (WebCore::FileReader::arrayBufferResult): Deleted.
696         (WebCore::FileReader::stringResult): Deleted.
697         * fileapi/FileReader.h: Updated for the above.
698         * fileapi/FileReader.idl: Removed [Custom] from the result attribute and
699         declared it with the type mentioned in the specification, a nullable union.
700
701 2016-12-30  Darin Adler  <darin@apple.com>
702
703         Remove PassRefPtr use from the "dom" directory, related cleanup
704         https://bugs.webkit.org/show_bug.cgi?id=166569
705
706         Reviewed by Alex Christensen.
707
708         * CMakeLists.txt: Removed DocumentMarker.cpp.
709         * WebCore.xcodeproj/project.pbxproj: Ditto.
710
711         * bindings/js/JSPopStateEventCustom.cpp:
712         (WebCore::JSPopStateEvent::state): Pass ExecState by reference.
713
714         * dom/CharacterData.cpp:
715         (WebCore::CharacterData::dispatchModifiedEvent): Use auto.
716
717         * dom/DOMAllInOne.cpp: Removed DocumentMarker.cpp.
718
719         * dom/DOMNamedFlowCollection.cpp:
720         (WebCore::DOMNamedFlowCollection::DOMNamedFlowCollection): Updated to take
721         ownership of the passed in vector.
722         (WebCore::DOMNamedFlowCollection::create): Moved here from header.
723         (WebCore::DOMNamedFlowCollection::~DOMNamedFlowCollection): Moved here so we
724         don't need to include "WebKitNamedFlow.h" in the header.
725         (WebCore::DOMNamedFlowCollection::item): Rewrote to use Vector.
726         (WebCore::DOMNamedFlowCollection::namedItem): Rewrote to use a HashSet that
727         we build from the Vector. Uses a set of hash functions defined right here.
728         Note that the privor version of this class had incorrect use of ListHashSet
729         with safeToCompareToEmptyOrDeleted inaccurately set to true.
730         (WebCore::DOMNamedFlowCollection::supportedPropertyNames): Added this.
731         Old version just had an empty placeholder.
732         * dom/DOMNamedFlowCollection.h: Changed to no longer use ListHashSet, not
733         the right data structure for this. Removed incorrect use of "long" and
734         made some other simplifications.
735         * dom/DOMNamedFlowCollection.idl: Changed return types of item and namedItem
736         to accurately reflect the fact that they return null when the index or name
737         not found in the collection.
738
739         * dom/DataTransfer.h: Remove indentation. Remove unimplemented
740         incorrect declarations of items for ENABLE(DATA_TRANSFER_ITEMS).
741         Will be added back when someone implements that feature, or perhaps
742         ENABLE(DATA_TRANSFER_ITEMS) should be entirely removed for now?
743
744         * dom/DataTransferItem.h: Changed return type for getAsFile to
745         RefPtr. Again, part of ENABLE(DATA_TRANSFER_ITEMS), so dead code for now.
746
747         * dom/Document.cpp:
748         (WebCore::canonicalizedTitle): Removed incorrect comment claiming we
749         convert control characters to spaces. Simplified logic, removing two
750         extra loops. Changed to work on just a String rather than StringWithDirection.
751         (WebCore::Document::updateTitle): Updated to call the function above.
752         Also updated since StringWithDirection is now a struct instead of a class.
753         Call displayBuffer on the encoding directly instead of calling a member
754         function named displayBufferModifiedByEncoding.
755         (WebCore::Document::updateTitleFromTitleElement): Updated since
756         StringWithDirection is now a struct.
757         (WebCore::Document::setTitle): Removed code that unnecessarily calls
758         updateTitle twice; once indirectly by calling setTextContent on the
759         title elmeent and once by directly calling updateTitle.
760         (WebCore::Document::setWindowAttributeEventListener): Take a RefPtr&&.
761         (WebCore::Document::statePopped): Take a Ref&&.
762         (WebCore::Document::displayStringModifiedByEncoding): Deleted unused overload.
763         (WebCore::Document::displayBufferModifiedByEncodingInternal): Deleted.
764         (WebCore::Document::requestAnimationFrame): Take a Ref&&.
765         * dom/Document.h: Updated for changes above. Also changed the title function
766         to return a const String& to slightly cut down on reference count churn.
767         (WebCore::Document::displayBufferModifiedByEncoding): Deleted.
768
769         * dom/DocumentMarker.cpp: Removed.
770         * dom/DocumentMarker.h: Reworked the DocumentMarker class to use a variant
771         instead of a separate reference counted DocumentMarkerDetails object.
772
773         * dom/DocumentMarkerController.cpp:
774         (WebCore::DocumentMarkerController::addMarkerToNode): Changed argument
775         type to DocumentMarker::Data&&.
776         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
777         clearDetails -> clearData
778         (DocumentMarkerController::showMarkers): activeMatch -> isActiveMatch
779         * dom/DocumentMarkerController.h: Updated for the above.
780
781         * dom/DocumentParser.h: Fixed incorrect reference to PassRefPtr in a comment.
782
783         * dom/Element.cpp:
784         (WebCore::Element::willModifyAttribute): Use auto.
785
786         * dom/Event.cpp:
787         (WebCore::Event::isDragEvent): Deleted. Unused.
788         (WebCore::Event::cloneFor): Deleted. Unused function left over from the
789         start of an implementation of seamless frames.
790         * dom/Event.h: Updated for the above.
791
792         * dom/EventContext.cpp: Tweaked blank lines.
793         * dom/EventContext.h: Removed unnecessary includes and forward declarations.
794         Changed setRelatedTarget to take a raw pointer instead of PassRefPtr since
795         callers aren't passing ownership. Moved TouchEventContext::touchList body
796         out of the class definition since it's a bit long. Deleted unused
797         toTouchEventContext functions. FIxed incorrect comment.
798
799         * dom/MessageEvent.cpp:
800         (WebCore::MessageEvent::initMessageEvent): Removed unused overload.
801         * dom/MessageEvent.h: Updated for above. Also changed the
802         dataAsSerializedScriptValue function to return a raw pointer instead of
803         PassRefPtr since it is not passing ownership.
804
805         * dom/MouseEvent.cpp:
806         (WebCore::MouseEvent::create): Use raw pointer instead of PassRefPtr for
807         data transfer and related target arguments.
808         (WebCore::MouseEvent::MouseEvent): Ditto. Also use IntPoint instead of
809         separate ints for the various X/Y pairs.
810         (WebCore::MouseEvent::initMouseEvent): Take a raw pointer for event target.
811         (WebCore::MouseEvent::isDragEvent): Reformatted, sorted alphabetically,
812         added comment about why this function probably needs to go.
813         (WebCore::adjustedClientX): Deleted.
814         (WebCore::adjustedClientY): Deleted.
815         (WebCore::MouseEvent::cloneFor): Deleted.
816         * dom/MouseEvent.h: Updated for the above. Also made more functions private
817         and final and initialized more of the data members.
818
819         * dom/MutationEvent.cpp:
820         (WebCore::MutationEvent::MutationEvent): Pass related node as a raw pointer.
821         (WebCore::MutationEvent::initMutationEvent): Ditto.
822         * dom/MutationEvent.h: Updated for the above. Fixed indentation. Removed
823         unnecessary explicit destructor; default generated one is fine. Initialize
824         m_attrChange in the class definition.
825
826         * dom/MutationObserver.cpp:
827         (WebCore::MutationObserver::observe): Pass reference.
828         (WebCore::MutationObserver::disconnect): Call unregisterMutationObserver
829         directly instead of calling unregisterAndDelete.
830
831         * dom/MutationObserverInterestGroup.cpp:
832         (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup):
833         Take an rvalue reference to the HashMap and use move.
834         (WebCore::MutationObserverInterestGroup::createIfNeeded): Updated to call
835         registeredMutationObservers.
836         * dom/MutationObserverInterestGroup.h: Updated for the above.
837
838         * dom/MutationObserverRegistration.cpp:
839         (WebCore::MutationObserverRegistration::MutationObserverRegistration):
840         Take a reference to the observer instead of PassRefPtr. Also take a
841         refererence to the node rather than a pointer.
842         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
843         Updated to use references instead of pointers.
844         (WebCore::MutationObserverRegistration::clearTransientRegistrations): Ditto.
845         (WebCore::MutationObserverRegistration::unregisterAndDelete): Deleted.
846         (WebCore::MutationObserverRegistration::shouldReceiveMutationFrom): Ditto.
847         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet): Ditto.
848         * dom/MutationObserverRegistration.h: Updated for above changes. Also added
849         a node member function. Changed m_observer to a Ref and m_node to a reference.
850         Removed the NodeHashSet typedef.
851
852         * dom/NamedFlowCollection.cpp:
853         (WebCore::NamedFlowCollection::createCSSOMSnapshot): Pass a vector of Ref
854         instead of a vector of raw pointers and pass it as an rvalue reference so
855         it can be taken over by the named flow collection wrapper.
856
857         * dom/Node.cpp:
858         (WebCore::Node::mutationObserverRegistry): Use auto and nullptr.
859         (WebCore::Node::transientMutationObserverRegistry): Ditto.
860         (WebCore::collectMatchingObserversForMutation): Use references instead of pointers.
861         (WebCore::Node::registeredMutationObservers): Changed to return a map instead of
862         filling one in and renamed to remove "get" from name.
863         (WebCore::Node::registerMutationObserver): Use references instead of pointers.
864         (WebCore::Node::unregisterMutationObserver): Ditto.
865         (WebCore::Node::registerTransientMutationObserver): Ditto.
866         (WebCore::Node::unregisterTransientMutationObserver): Ditto.
867         (WebCore::Node::notifyMutationObserversNodeWillDetach): Ditto.
868         * dom/Node.h: Updated for the above.
869
870         * dom/PopStateEvent.cpp:
871         (WebCore::PopStateEvent::PopStateEvent): Use RefPtr&& instead of PassRefPtr.
872         (WebCore::PopStateEvent::create): Use a raw pointer instead of PassRefPtr.
873         (WebCore::PopStateEvent::trySerializeState): Take a reference to ExecState.
874         * dom/PopStateEvent.h: Updated for the above.
875
876         * dom/Position.cpp:
877         (WebCore::Position::Position): Take a raw pointer instead of PassRefPtr.
878         (WebCore::Position::moveToPosition): Ditto.
879         * dom/Position.h: Updated for the above, also changed createLegacyEditingPosition
880         in the same way and got rid of the LegacyEditingPosition class.
881
882         * dom/Range.cpp:
883         (WebCore::Range::Range): Changed startContainer and endContainer to RefPtr<Node>&&.
884         Later this needs to be changed more, but for now this keeps code changes to a minimum.
885         (WebCore::Range::create): Changed startContainer and endContainer to Node*.
886         * dom/Range.h: Updated for the above.
887
888         * dom/ScopedEventQueue.cpp:
889         (WebCore::ScopedEventQueue::dispatchEvent): Removed a comment that talks about
890         PassRefPtr, and simplified the code since the comment is no longer valid.
891
892         * dom/ScriptExecutionContext.cpp:
893         (WebCore::ScriptExecutionContext::PendingException::PendingException):
894         Take a RefPtr&& instead of a PassRefPtr.
895         (WebCore::ScriptExecutionContext::ScriptExecutionContext): Moved initialization
896         of all the data members up to the class definition.
897         (WebCore::ScriptExecutionContext::sanitizeScriptError): Use ASCIILiteral.
898         (WebCore::ScriptExecutionContext::reportException): Use WTFMove when passing
899         arguments to the PendingException constructor and using a value from the
900         PendingException just before destroying it.
901
902         * dom/ScriptExecutionContext.h: Changed addTimeout to take a reference rather
903         than a PassRefPtr to the timer. Callers were not passing ownership. Also
904         initialize all the data members here in the class definition.
905
906         * dom/ScriptedAnimationController.cpp:
907         (WebCore::ScriptedAnimationController::registerCallback): Take a Ref&&.
908         * dom/ScriptedAnimationController.h: Updated for the above.
909
910         * dom/SimulatedClick.cpp:
911         (WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Updated since MouseEvent
912         constructor arguments changed to use IntPoint.
913         * dom/WheelEvent.cpp:
914         (WebCore::WheelEvent::WheelEvent): Ditto. Also removed some unneeded initializers
915         now that the header does more.
916         (WebCore::WheelEvent::initWheelEvent): Tweaed style a bit.
917         (WebCore::WheelEvent::initWebKitWheelEvent): Deleted. Moved to the header since it's
918         just an inline that forwards to initWheelEvent.
919         * dom/WheelEvent.h: Updated for the above.
920
921         * dom/make_event_factory.pl:
922         (generateImplementation): Use RefPtr instead of PassRefPtr. A couple other tweaks.
923
924         * editing/AlternativeTextController.cpp:
925         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use the data
926         insetad of details.
927         (WebCore::AlternativeTextController::removeDictationAlternativesForMarker):
928         Ditto, also changed to take reference instead of pointer.
929         (WebCore::AlternativeTextController::dictationAlternativesForMarker): Ditto.
930         (WebCore::AlternativeTextController::applyDictationAlternative): Ditto.
931         * editing/AlternativeTextController.h: Updated for the above.
932
933         * editing/ApplyBlockElementCommand.cpp:
934         (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
935         Updated since Position now takes a raw pointer.
936         * editing/ApplyStyleCommand.cpp:
937         (WebCore::ApplyStyleCommand::joinChildTextNodes): Ditto.
938         * editing/CompositeEditCommand.cpp:
939         (WebCore::CompositeEditCommand::replaceSelectedTextInNode): Ditto.
940         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Ditto.
941
942         * editing/DictationCommand.cpp:
943         (WebCore::DictationMarkerSupplier::addMarkersToTextNode): Updated to use the
944         DictationData struct.
945
946         * editing/Editor.cpp:
947         (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Pass a reference.
948         (WebCore::Editor::dictationAlternativesForMarker): Take a reference.
949         * editing/Editor.h: Updated for the above.
950
951         * editing/InsertTextCommand.cpp:
952         (WebCore::InsertTextCommand::performOverwrite): Updated since Position now takes
953         a raw pointer.
954         (WebCore::InsertTextCommand::doApply): Ditto.
955         (WebCore::InsertTextCommand::insertTab): Ditto.
956         * editing/ReplaceSelectionCommand.cpp:
957         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition): Ditto.
958
959         * html/HTMLTitleElement.cpp:
960         (WebCore::HTMLTitleElement::computedTextWithDirection): Updated since
961         StringWithDirection is now a struct.
962
963         * loader/FrameLoader.cpp:
964         (WebCore::FrameLoader::submitForm): Use Ref&& for the form submission.
965         (WebCore::FrameLoader::receivedFirstData): Updated for change to StringWithDirection.
966         (WebCore::FrameLoader::commitProvisionalLoad):
967         (WebCore::FrameLoader::didBeginDocument): Pass a reference.
968         (WebCore::FrameLoader::loadURLIntoChildFrame): Pass a Ref to loadArchive.
969         (WebCore::FrameLoader::loadArchive): Take a Ref&& for the archive.
970         (WebCore::FrameLoader::loadInSameDocument): Take a raw pointer for the
971         serialized script value state object. No one was passing ownership.
972         But pass it along to statePopped as a Ref since we need to pass ownership
973         of the null value, at least for now.
974         (WebCore::FrameLoader::loadFrameRequest): Take a raw pointer for form state.
975         No one was passing ownership.
976         (WebCore::FrameLoader::loadURL): Ditto.
977         (WebCore::FrameLoader::load): Ditto.
978         (WebCore::FrameLoader::loadWithNavigationAction): Ditto.
979         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
980         (WebCore::FrameLoader::loadPostRequest): Ditto.
981         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
982         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Ditto.
983         * loader/FrameLoader.h: Updated for the above and to remove an unneeded forward
984         declaration of StringWithDirection, which is not used here.
985
986         * loader/FrameLoaderClient.h: Updated forward declaration of StringWithDirection.
987         Also sorted the others and removed unneeded conditionals.
988
989         * loader/HistoryController.cpp:
990         (WebCore::HistoryController::setCurrentItemTitle): Updated to use struct.
991         (WebCore::HistoryController::initializeItem): Ditto.
992         * loader/HistoryController.h: Updated forward declaration of StringWithDirection.
993
994         * loader/PolicyCallback.cpp:
995         (WebCore::PolicyCallback::PolicyCallback): Deleted. Default works fine.
996         (WebCore::PolicyCallback::~PolicyCallback): Ditto.
997         (WebCore::PolicyCallback::set): Take a raw pointer to form state.
998         * loader/PolicyCallback.h: Use raw pointer for form state.
999
1000         * loader/PolicyChecker.cpp:
1001         (WebCore::PolicyChecker::checkNavigationPolicy): Take a raw pointer for form state.
1002         (WebCore::PolicyChecker::checkNewWindowPolicy): Ditto.
1003         * loader/PolicyChecker.h: Updated for the above.
1004
1005         * page/DOMTimer.cpp:
1006         (WebCore::DOMTimer::DOMTimer): Pass reference to addTimeout function.
1007
1008         * page/DOMWindow.cpp:
1009         (WebCore::DOMWindow::requestAnimationFrame): Use Ref&& for callback.
1010         (WebCore::DOMWindow::webkitRequestAnimationFrame): Ditto.
1011         (WebCore::DOMWindow::cancelAnimationFrame): Tweak coding style.
1012         * page/DOMWindow.h: Updated for the above.
1013
1014         * platform/PlatformWheelEvent.h: Use pragma once. Tweaked header indentation.
1015         Simplified constructors by initializing data members.
1016
1017         * platform/text/StringWithDirection.h: Use pragma once. Use struct instead of class.
1018
1019         * rendering/HitTestResult.cpp:
1020         (WebCore::HitTestResult::dictationAlternatives): Pass a reference.
1021
1022         * rendering/InlineTextBox.cpp:
1023         (WebCore::InlineTextBox::paintTextMatchMarker): activeMatch -> isActiveMatch
1024
1025 2016-12-30  Darin Adler  <darin@apple.com>
1026
1027         Remove PassRefPtr use from the "css" directory, related cleanup
1028         https://bugs.webkit.org/show_bug.cgi?id=166628
1029
1030         Reviewed by Alex Christensen.
1031
1032         * css/CSSCalculationValue.cpp:
1033         (WebCore::CSSCalcBinaryOperation::create): Take RefPtr&& instead of PassRefPtr.
1034         Also added some checks for null. Code here is really inconsistent about null;
1035         probably should change from RefPtr to Ref at some point.
1036         (WebCore::CSSCalcBinaryOperation::createSimplified): Ditto.
1037         (WebCore::CSSCalcBinaryOperation::CSSCalcBinaryOperation): Take Ref&& instead
1038         of PassRefPtr.
1039
1040         * css/CSSCrossfadeValue.cpp:
1041         (WebCore::subimageKnownToBeOpaque): Take a reference instead of a pointer.
1042         (WebCore::CSSCrossfadeValue::SubimageObserver::SubimageObserver): Moved here
1043         from the header, and renamed.
1044         (WebCore::CSSCrossfadeValue::SubimageObserver::imageChanged): Ditto.
1045         (WebCore::CSSCrossfadeValue::CSSCrossfadeValue): Moved here from the header.
1046         (WebCore::CSSCrossfadeValue::create): Ditto.
1047         (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue): Updated for data member name change.
1048         (WebCore::CSSCrossfadeValue::fixedSize): Take a reference. Also rewrote size math to
1049         take advantage of FloatSize multiplication and addition operators.
1050         (WebCore::CSSCrossfadeValue::knownToBeOpaque): Take a reference.
1051         (WebCore::CSSCrossfadeValue::loadSubimages): Set m_subimagesAreReady rather than
1052         calling setReady on the subimage observer.
1053         (WebCore::CSSCrossfadeValue::image): Return a raw pointer rather than a RefPtr.
1054         Take a reference instead of a pointer.
1055         (WebCore::CSSCrossfadeValue::crossfadeChanged): Removed unused rect argument.
1056         Rewrote to use modern for loop.
1057         * css/CSSCrossfadeValue.h: Updated for above changes.
1058
1059         * css/CSSGradientValue.cpp:
1060         (WebCore::createGradient): Added. Helper so the function below can use Ref rather
1061         than RefPtr, and it's also nice to factor out this "poor man's virtual function".
1062         (WebCore::CSSGradientValue::image): Take a reference rather than a pointer.
1063         (WebCore::clone): Added. Helper like createGradient above.
1064         (WebCore::CSSGradientValue::gradientWithStylesResolved): Take a reference rather
1065         than a pointer. Simplified by using the helper above.
1066         (WebCore::CSSGradientValue::knownToBeOpaque): Removed unused argument. Rewrote to
1067         use a modern for loop.
1068         * css/CSSGradientValue.h: Updated for above changes.
1069
1070         * css/CSSImageGeneratorValue.cpp: Moved the CachedGeneratedImage class in here
1071         from the header. Also changed it to use const and Ref.
1072         (WebCore::CSSImageGeneratorValue::addClient): Take a reference rather than a pointer.
1073         (WebCore::CSSImageGeneratorValue::removeClient): Ditto.
1074         (WebCore::CSSImageGeneratorValue::cachedImageForSize): Updated since image now returns
1075         a reference rather than a pointer.
1076         (WebCore::CSSImageGeneratorValue::saveCachedImageForSize): Take a reference rather
1077         than PassRefPtr.
1078         (WebCore::CSSImageGeneratorValue::image): Take a reference rather than a pointer.
1079         (WebCore::CSSImageGeneratorValue::fixedSize): Ditto.
1080         (WebCore::CSSImageGeneratorValue::knownToBeOpaque): Ditto.
1081         * css/CSSImageGeneratorValue.h: Updated for above changes.
1082
1083         * css/CSSValuePool.cpp:
1084         (WebCore::CSSValuePool::createFontFaceValue): Return a RefPtr rather than PassRefPtr.
1085         * css/CSSValuePool.h: Updated for the above.
1086
1087         * css/StyleBuilderConverter.h: Change convertStyleImage and convertShapeValue to
1088         return RefPtr instead of PassRefPtr.
1089
1090         * css/StyleBuilderCustom.h:
1091         (WebCore::StyleBuilderCustom::applyValueContent): Since gradientWithStylesResolved
1092         returns a Ref now, no need to dereference it any more. This also removes reference
1093         count churn since we are now passing a Ref temporary to a Ref&&.
1094         * css/StyleResolver.cpp:
1095         (WebCore::StyleResolver::styleImage): Ditto.
1096
1097         * platform/graphics/GradientImage.cpp:
1098         (WebCore::GradientImage::GradientImage): Pass generator as a reference rather than
1099         as a PassRefPtr.
1100         (WebCore::GradientImage::draw): Updated since m_gradient is now a Ref rather than
1101         a RefPtr.
1102         (WebCore::GradientImage::drawPattern): Ditto.
1103         * platform/graphics/GradientImage.h: Updated for the above changes. Make things
1104         private rather than protected since this class is final.
1105
1106         * rendering/style/StyleGeneratedImage.cpp:
1107         (WebCore::StyleGeneratedImage::imageSize): Pass renderer as a reference. Later, we
1108         should change the interface to this function, too.
1109         (WebCore::StyleGeneratedImage::addClient): Ditto.
1110         (WebCore::StyleGeneratedImage::removeClient): Ditto.
1111         (WebCore::StyleGeneratedImage::image): Ditto.
1112         (WebCore::StyleGeneratedImage::knownToBeOpaque): Ditto.
1113
1114 2016-12-30  Olivier Blin  <olivier.blin@softathome.com>
1115
1116         [EFL] fix buffer over-read in RenderThemeEfl::mediaControlsStyleSheet()
1117         https://bugs.webkit.org/show_bug.cgi?id=166622
1118
1119         Reviewed by Gyuyoung Kim.
1120
1121         This has been detected by a charactersAreAllASCII() assert failure.
1122         Initially in WebKitForWayland (WPE), but the code was likely borrowed from EFL.
1123
1124         This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
1125         mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
1126         It is thus incorrect to use StringImpl::createFromLiteral() that calls
1127         strlen() to get the string length.
1128
1129         The String::ConstructFromLiteral constructor can not be used, since it
1130         skips the last character.
1131
1132         * rendering/RenderThemeEfl.cpp:
1133         (WebCore::RenderThemeEfl::mediaControlsStyleSheet):
1134         Explicitely pass the size to the String constructor.
1135
1136 2016-12-30  Commit Queue  <commit-queue@webkit.org>
1137
1138         Unreviewed, rolling out r210206.
1139         https://bugs.webkit.org/show_bug.cgi?id=166621
1140
1141         Crashes on macOS PLT (Requested by kling on #webkit).
1142
1143         Reverted changeset:
1144
1145         "Drop the render tree for documents in the page cache."
1146         https://bugs.webkit.org/show_bug.cgi?id=121798
1147         http://trac.webkit.org/changeset/210206
1148
1149 2016-12-28  Sergio Villar Senin  <svillar@igalia.com>
1150
1151         [css-grid] Isolate instrinsic size computation from layout
1152         https://bugs.webkit.org/show_bug.cgi?id=166530
1153
1154         Reviewed by Darin Adler.
1155
1156         This is the last patch of the items placement data refactoring. By using a different Grid
1157         instance in computeIntrinsicLogicalWidths we effectively isolate the intrinsic size
1158         computation from the layout. They are now using different data structures so they don't
1159         interfere each other.
1160
1161         This also means that we no longer reuse the placement of items done in the intrinsic size
1162         computation. That shouldn't be a big issue once we make m_grid persistent on RenderGrid.
1163
1164         Last but not least, this patch finally removes the ugly const_cast's we had in
1165         computeIntrinsicLogicalWidths() as we no longer modify the internal state of RenderGrid.
1166
1167         Tests: fast/css-grid-layout/grid-auto-repeat-intrinsic.html
1168                fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html
1169
1170         * rendering/RenderGrid.cpp:
1171         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use a new instance of Grid.
1172         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): Fixed a missing m_grid -> grid
1173         rename.
1174         (WebCore::RenderGrid::placeItemsOnGrid): Constify it. It nows repositions the items if the
1175         number of auto repeat tracks has changed.
1176         * rendering/RenderGrid.h:
1177
1178 2016-12-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1179
1180         [GTK] Improve user agent construction
1181         https://bugs.webkit.org/show_bug.cgi?id=142074
1182
1183         Reviewed by Carlos Garcia Campos.
1184
1185         Using the macOS quirk rather than the Chrome quirk for Google domains was a mistake: it
1186         broke Hangouts in a different way than the Chrome quirk, and also prevents use of the nice
1187         Earth mode on Google Maps. Google is making it really hard to develop a sane quirk.
1188         Eventually I settled on the combination of two quirks: (1) Firefox browser, and (2) Linux
1189         x86_64 platform. See the bug for full discussion on why these quirks are the best way to
1190         make Google domains work properly in WebKit. This is an extremely sad state of affairs, but
1191         I'm confident it is the best option. Note this effectively includes a rollout of r210168.
1192
1193         Also, fix a bug that caused an extra space to be inserted in the middle of the user agent.
1194
1195         * platform/UserAgentQuirks.cpp:
1196         (WebCore::isGoogle):
1197         (WebCore::urlRequiresFirefoxBrowser):
1198         (WebCore::urlRequiresMacintoshPlatform):
1199         (WebCore::urlRequiresLinuxDesktopPlatform):
1200         (WebCore::UserAgentQuirks::quirksForURL):
1201         (WebCore::UserAgentQuirks::stringForQuirk):
1202         (WebCore::UserAgentQuirks::firefoxRevisionString):
1203         * platform/UserAgentQuirks.h:
1204         * platform/gtk/UserAgentGtk.cpp:
1205         (WebCore::buildUserAgentString):
1206
1207 2016-12-30  Andreas Kling  <akling@apple.com>
1208
1209         Drop the render tree for documents in the page cache.
1210         <https://webkit.org/b/121798>
1211
1212         Reviewed by Darin Adler.
1213
1214         To save memory and reduce complexity, have documents tear down their render tree
1215         when entering the page cache. I've wanted to do this for a long time and it seems
1216         like we can actually do it now.
1217
1218         This patch will enable a number of clean-ups since it's no longer valid for renderers
1219         to exist while the document is in page cache.
1220
1221         * dom/Document.cpp:
1222         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
1223         since we will now be tearing down render trees right as they enter the page cache.
1224
1225         (WebCore::Document::setPageCacheState): Tear down the render tree right before setting
1226         the in-cache flag. From now on, there should not exist render objects for documents in
1227         the page cache.
1228
1229         * history/CachedFrame.cpp:
1230         (WebCore::CachedFrameBase::restore):
1231         * page/FrameView.h:
1232         * page/FrameView.cpp:
1233         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring a
1234         frame from the page cache. This dirties the scrolling tree, which was covered by tests.
1235
1236         * page/animation/AnimationBase.cpp:
1237         (WebCore::AnimationBase::setNeedsStyleRecalc): Make this a no-op if the render tree is being
1238         torn down. This fixes assertions firing on animation tests.
1239
1240 2016-12-29  Chris Fleizach  <cfleizach@apple.com>
1241
1242         AX: Need to expose frames to iOS Accessibility
1243         https://bugs.webkit.org/show_bug.cgi?id=166571
1244         <rdar://problem/29823724>
1245
1246         Reviewed by Darin Adler.
1247
1248         To support navigation by frame for VoiceOver on iOS, we need to expose the frame ancestor. 
1249
1250         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1251         (-[WebAccessibilityObjectWrapper _accessibilityFrameAncestor]):
1252
1253 2016-12-09  Sergio Villar Senin  <svillar@igalia.com>
1254
1255         [css-grid] Move Grid into GridSizingData
1256         https://bugs.webkit.org/show_bug.cgi?id=165654
1257
1258         Reviewed by Darin Adler.
1259
1260         The grid track sizing algorithm has been using the m_grid attribute from RenderGrid to
1261         compute the sizes of the tracks unconditionally. However the goal is to make it work against
1262         a generic instance of the Grid class, so that the intrinsic size computation and the layout
1263         processes could be effectively decoupled.
1264
1265         Instead of passing the Grid as a new argument to all the track sizing algorithm methods we
1266         leverage the existence of GridSizingData which is already passed to all of them. This data
1267         structure holds from now on a reference to the Grid instance so that the track sizing
1268         algorithm could use it.
1269
1270         No new tests as this is a refactoring.
1271
1272         * rendering/RenderGrid.cpp:
1273         (WebCore::RenderGrid::GridSizingData::GridSizingData):
1274         (WebCore::RenderGrid::GridSizingData::grid):
1275         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
1276         (WebCore::RenderGrid::computeTrackSizesForDirection):
1277         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
1278         (WebCore::RenderGrid::layoutBlock):
1279         (WebCore::RenderGrid::guttersSize):
1280         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
1281         (WebCore::RenderGrid::computeIntrinsicLogicalHeight):
1282         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
1283         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
1284         (WebCore::RenderGrid::computeFlexFactorUnitSize):
1285         (WebCore::RenderGrid::findFlexFactorUnitSize):
1286         (WebCore::RenderGrid::rawGridTrackSize):
1287         (WebCore::RenderGrid::gridTrackSize):
1288         (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks):
1289         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
1290         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
1291         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
1292         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
1293         (WebCore::RenderGrid::trackSizesForComputedStyle):
1294         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
1295         (WebCore::RenderGrid::layoutGridItems):
1296         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1297         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
1298         (WebCore::RenderGrid::gridAreaBreadthForChild):
1299         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
1300         (WebCore::RenderGrid::populateGridPositionsForDirection):
1301         (WebCore::RenderGrid::columnAxisOffsetForChild):
1302         (WebCore::RenderGrid::rowAxisOffsetForChild):
1303         (WebCore::RenderGrid::findChildLogicalPosition):
1304         (WebCore::RenderGrid::numTracks):
1305         (WebCore::RenderGrid::paintChildren):
1306         * rendering/RenderGrid.h:
1307
1308 2016-12-27  Michael Catanzaro  <mcatanzaro@igalia.com>
1309
1310         [GTK] Improve user agent construction
1311         https://bugs.webkit.org/show_bug.cgi?id=142074
1312
1313         Reviewed by Carlos Garcia Campos.
1314
1315         Use the macOS rather than the Chrome quirk for Google domains, to avoid problems with
1316         Google Calendar and Google Maps.
1317
1318         * platform/UserAgentQuirks.cpp:
1319         (WebCore::urlRequiresChromeBrowser):
1320         (WebCore::urlRequiresMacintoshPlatform):
1321
1322 2016-12-26  Zalan Bujtas  <zalan@apple.com>
1323
1324         ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
1325         https://bugs.webkit.org/show_bug.cgi?id=163461
1326
1327         Reviewed by Darin Adler.
1328
1329         Make sure we don't paint empty rects.
1330
1331         Test: fast/lists/assert-on-empty-list-marker.html
1332
1333         * rendering/RenderListMarker.cpp:
1334         (WebCore::RenderListMarker::paint):
1335
1336 2016-12-25  Chris Fleizach  <cfleizach@apple.com>
1337
1338         AX: Headers of table not read by VoiceOver
1339         https://bugs.webkit.org/show_bug.cgi?id=158693
1340         <rdar://problem/26771065>
1341
1342         Reviewed by Darin Adler.
1343
1344         If a table cell header is hidden, by pushing off screen then the content won't be accessible.
1345         It seems that unless specifically requested (such as using aria-hidden), we should try to return
1346         that table cell header.
1347
1348         Test: accessibility/hidden-th-still-column-header.html
1349
1350         * accessibility/AccessibilityTableColumn.cpp:
1351         (WebCore::AccessibilityTableColumn::headerObjectForSection):
1352
1353 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
1354
1355         Propagate the source origin as much as possible
1356         https://bugs.webkit.org/show_bug.cgi?id=166348
1357
1358         Reviewed by Darin Adler.
1359
1360         * bindings/js/CachedScriptSourceProvider.h:
1361         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
1362         * bindings/js/JSLazyEventListener.cpp:
1363         (WebCore::JSLazyEventListener::initializeJSFunction):
1364         * bindings/js/ScriptSourceCode.h:
1365         (WebCore::ScriptSourceCode::ScriptSourceCode):
1366         * bridge/NP_jsobject.cpp:
1367         (_NPN_Evaluate):
1368         * bridge/objc/WebScriptObject.mm:
1369         (-[WebScriptObject evaluateWebScript:]):
1370
1371 2016-12-24  Sam Weinig  <sam@webkit.org>
1372
1373         [WebIDL] Remove (most) custom bindings for the IndexedDB code
1374         https://bugs.webkit.org/show_bug.cgi?id=166451
1375
1376         Reviewed by Darin Adler.
1377
1378         Removes the custom bindings for all but one attribute (IDBRequest.result) in
1379         the IndexedDB code.
1380         - Adds a new WebIDL extension type, IDBKey, to represent the complex key conversion
1381           rules IndexedDB specifies.
1382         - Replaces custom bindings for IDBCursor.source with use of a union.
1383         - Replaces custom enum type checking for IDBCursor.direction with a WebIDL enum.
1384         - Replaces custom code generation for IDBKeyPaths with a union.
1385
1386         * CMakeLists.txt:
1387         * DerivedSources.make:
1388         * WebCore.xcodeproj/project.pbxproj:
1389         Add new files.
1390
1391         * Modules/indexeddb/IDBCursor.cpp:
1392         (WebCore::IDBCursor::source):
1393         (WebCore::IDBCursor::direction):
1394         (WebCore::IDBCursor::directionNext): Deleted.
1395         (WebCore::IDBCursor::directionNextUnique): Deleted.
1396         (WebCore::IDBCursor::directionPrev): Deleted.
1397         (WebCore::IDBCursor::directionPrevUnique): Deleted.
1398         (WebCore::IDBCursor::stringToDirection): Deleted.
1399         (WebCore::IDBCursor::directionToString): Deleted.
1400         * Modules/indexeddb/IDBCursor.h:
1401         (WebCore::IDBCursor::objectStore): Deleted.
1402         (WebCore::IDBCursor::index): Deleted.
1403         Replace custom enum checking with direct use of the enum, letting the generator
1404         handle the checks. Also adds source function which returns a Variant.
1405
1406         * Modules/indexeddb/IDBCursor.idl:
1407         Remove custom annotation and use correct types.
1408
1409         * Modules/indexeddb/IDBCursorDirection.h: Added.
1410         * Modules/indexeddb/IDBCursorDirection.idl: Added.
1411
1412         * Modules/indexeddb/IDBIndex.cpp:
1413         (WebCore::IDBIndex::openCursor):
1414         (WebCore::IDBIndex::openKeyCursor):
1415         * Modules/indexeddb/IDBIndex.h:
1416         * Modules/indexeddb/IDBIndex.idl:
1417         * Modules/indexeddb/IDBObjectStore.cpp:
1418         (WebCore::IDBObjectStore::openCursor):
1419         (WebCore::IDBObjectStore::openKeyCursor):
1420         * Modules/indexeddb/IDBObjectStore.h:
1421         * Modules/indexeddb/IDBObjectStore.idl:
1422         Replace Strings with IDBCursorDirection enums.
1423
1424         * Modules/indexeddb/IDBKeyRange.idl:
1425         Remove annotation and use new IDBKey extension type.
1426
1427         * Modules/indexeddb/IDBOpenDBRequest.cpp:
1428         (WebCore::IDBOpenDBRequest::onSuccess):
1429         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
1430         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
1431         Use ReadyState enum in place of the old m_isDone boolean.
1432
1433         * Modules/indexeddb/IDBRequest.cpp:
1434         (WebCore::IDBRequest::IDBRequest):
1435         (WebCore::IDBRequest::error):
1436         (WebCore::IDBRequest::source):
1437         (WebCore::IDBRequest::dispatchEvent):
1438         (WebCore::IDBRequest::willIterateCursor):
1439         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
1440         (WebCore::IDBRequest::readyState): Deleted.
1441         * Modules/indexeddb/IDBRequest.h:
1442         (WebCore::IDBRequest::readyState):
1443         (WebCore::IDBRequest::isDone):
1444         (WebCore::IDBRequest::objectStoreSource): Deleted.
1445         (WebCore::IDBRequest::indexSource): Deleted.
1446         (WebCore::IDBRequest::cursorSource): Deleted.
1447         * Modules/indexeddb/IDBRequest.idl:
1448         Replace the readyState String with a enum, and the custom source binding with a
1449         source function that returns a Variant.
1450
1451         * Modules/indexeddb/IndexedDB.h:
1452         Add the missing values to CursorDirection to make it comply with the IDL definition.
1453
1454         * bindings/generic/IDLTypes.h:
1455         * bindings/js/JSDOMConvert.h:
1456         (WebCore::JSConverter<IDLIDBKey<T>>::convert):
1457         Add new extension type IDLIDBKey.
1458
1459         * bindings/js/JSIDBCursorCustom.cpp:
1460         (WebCore::JSIDBCursor::source): Deleted.
1461         * bindings/js/JSIDBRequestCustom.cpp:
1462         (WebCore::JSIDBRequest::source): Deleted.
1463         Remove custom bindings.
1464
1465         * bindings/scripts/CodeGenerator.pm:
1466         (IsBuiltinType):
1467         * bindings/scripts/CodeGeneratorJS.pm:
1468         (GetBaseIDLType):
1469         (NativeToJSValueDOMConvertNeedsState):
1470         (NativeToJSValueDOMConvertNeedsGlobalObject):
1471         (NativeToJSValue):
1472         Add support for IDBKey, and remove custom code for IndexedDB in core conversion logic.
1473
1474         * bindings/scripts/IDLAttributes.txt:
1475         Remove now unused ImplementationReturnType attribute.
1476
1477         * inspector/InspectorIndexedDBAgent.cpp:
1478         Update to work with new functions taking enums rather than strings.
1479
1480 2016-12-23  Simon Fraser  <simon.fraser@apple.com>
1481
1482         REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
1483         https://bugs.webkit.org/show_bug.cgi?id=166472
1484         rdar://problem/29675551
1485
1486         Reviewed by Tim Horton.
1487
1488         r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible()
1489         to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since
1490         the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested.
1491
1492         This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles
1493         in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need
1494         the separate visibleRectRelativeToDocument parameter.
1495
1496         Tests: fast/events/autoscroll-main-document.html
1497                fast/events/autoscroll-when-zoomed.html
1498                fast/events/drag-select-when-zoomed-with-header.html
1499                fast/events/drag-select-when-zoomed.html
1500                fast/scrolling/scroll-to-anchor-zoomed-header.html
1501
1502         * rendering/RenderLayer.cpp:
1503         (WebCore::RenderLayer::scrollRectToVisible):
1504         (WebCore::RenderLayer::getRectToExpose):
1505         * rendering/RenderLayer.h:
1506
1507 2016-12-24  Zalan Bujtas  <zalan@apple.com>
1508
1509         RenderBlockFlow::moveFloatsTo does not move floats.
1510         https://bugs.webkit.org/show_bug.cgi?id=166467
1511
1512         Reviewed by Darin Adler.
1513
1514         RenderBlockFlow::moveFloatsTo name is misleading. Floats are not moved from "this" to
1515         the new RenderBlockFlow parent, but rather they are copied so that overhanging floats
1516         don't get lost.
1517
1518         Covered by existing tests.
1519
1520         * rendering/FloatingObjects.cpp:
1521         (WebCore::FloatingObject::cloneForNewParent):
1522         (WebCore::FloatingObject::unsafeClone): Deleted.
1523         * rendering/FloatingObjects.h:
1524         * rendering/RenderBlockFlow.cpp:
1525         (WebCore::RenderBlockFlow::addFloatsToNewParent):
1526         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
1527         (WebCore::RenderBlockFlow::moveFloatsTo): Deleted.
1528         * rendering/RenderBlockFlow.h:
1529         * rendering/RenderRubyBase.cpp:
1530         (WebCore::RenderRubyBase::mergeChildrenWithBase):
1531         * rendering/RenderRubyBase.h:
1532         * rendering/RenderRubyRun.cpp:
1533         (WebCore::RenderRubyRun::removeChild):
1534
1535 2016-12-23  Andreas Kling  <akling@apple.com>
1536
1537         REGRESSION(r209865): Crash when navigating back to some pages with compositing layers.
1538         <https://webkit.org/b/166469>
1539         <rdar://problem/29109053>
1540
1541         Reviewed by Darin Adler.
1542
1543         Remove the old WK1-era clear/restoreBackingStores optimization from the page cache.
1544         When enabling it on non-iOS platforms, we started hitting lots of assertions,
1545         and none of our memory tests showed any significant improvement anyway.
1546
1547         Test: compositing/page-cache-back-crash.html
1548
1549         * history/CachedFrame.cpp:
1550         (WebCore::CachedFrameBase::CachedFrameBase):
1551         (WebCore::CachedFrameBase::restore):
1552         (WebCore::CachedFrame::CachedFrame):
1553         * history/CachedFrame.h:
1554         * page/FrameView.cpp:
1555         (WebCore::FrameView::restoreBackingStores): Deleted.
1556         * page/FrameView.h:
1557
1558 2016-12-23  Sam Weinig  <sam@webkit.org>
1559
1560         Add missing std::optional to ApplePayPaymentRequest.lineItems
1561         https://bugs.webkit.org/show_bug.cgi?id=166468
1562
1563         Reviewed by Alexey Proskuryakov.
1564
1565         No functional change, but is more consistent.
1566
1567         * Modules/applepay/ApplePayPaymentRequest.h:
1568         Remove unnecessary #include of <heap/Strong.h>, add std::optional to lineItems.
1569
1570         * Modules/applepay/ApplePaySession.cpp:
1571         (WebCore::convertAndValidate):
1572         Update to deal with optional line items, remove unnecessary comment.
1573
1574         * Modules/applepay/ApplePaySession.h:
1575         Remove unneeded forward declarations.
1576
1577 2016-12-22  Sam Weinig  <sam@webkit.org>
1578
1579         [WebIDL] Remove custom bindings for WebSQL code
1580         https://bugs.webkit.org/show_bug.cgi?id=166441
1581
1582         Reviewed by Darin Adler.
1583
1584         - Replace custom variant type SQLValue with a type alias of a Variant.
1585         - Use the newly representable SQLValue to remove custom bindings for 
1586           SQLResultSetRowList::item and SQLTransaction::executeSql.
1587
1588         * CMakeLists.txt:
1589         * WebCore.xcodeproj/project.pbxproj:
1590         * bindings/js/JSBindingsAllInOne.cpp:
1591         * bindings/js/JSSQLResultSetRowListCustom.cpp: Removed.
1592         * bindings/js/JSSQLTransactionCustom.cpp: Removed.
1593         * platform/sql/SQLValue.cpp: Removed.
1594         Remove files.
1595
1596         * Modules/webdatabase/SQLResultSetRowList.cpp:
1597         (WebCore::SQLResultSetRowList::length):
1598         (WebCore::SQLResultSetRowList::item):
1599         * Modules/webdatabase/SQLResultSetRowList.h:
1600         * Modules/webdatabase/SQLResultSetRowList.idl:
1601         Sink the implementation of item() into the implementation. Use a
1602         record type to bridge to javascript.
1603
1604         * Modules/webdatabase/SQLStatement.cpp:
1605         (WebCore::SQLStatement::SQLStatement):
1606         * Modules/webdatabase/SQLStatement.h:
1607         Update to take arguments by rvalue reference.
1608
1609         * Modules/webdatabase/SQLTransaction.cpp:
1610         (WebCore::SQLTransaction::executeSql):
1611         * Modules/webdatabase/SQLTransaction.h:
1612         * Modules/webdatabase/SQLTransaction.idl:
1613         Remove custom annotation, and update signature to match the IDL.
1614
1615         * Modules/webdatabase/SQLTransactionBackend.cpp:
1616         * Modules/webdatabase/SQLTransactionBackend.h:
1617         Remove unneeded #includes of SQLValue.h
1618
1619         * bindings/js/JSDOMConvert.h:
1620         (WebCore::Converter<IDLNull>::convert):
1621         (WebCore::JSConverter<IDLNull>::convert):
1622         Implement conversion for the null type so it can be used in the SQLValue union.
1623
1624         * inspector/InspectorDatabaseAgent.cpp:
1625         * platform/sql/SQLiteStatement.cpp:
1626         (WebCore::SQLiteStatement::bindValue):
1627         (WebCore::SQLiteStatement::getColumnValue):
1628         * platform/sql/SQLiteStatement.h:
1629         Replace old switch with a WTF::switchOn that operates on the new variant.
1630
1631         * platform/sql/SQLValue.h:
1632         (WebCore::SQLValue::SQLValue): Deleted.
1633         (WebCore::SQLValue::type): Deleted.
1634         Replace implementation with a Variant.
1635
1636 2016-12-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1637
1638         [GTK] GLES build broken since r208997
1639         https://bugs.webkit.org/show_bug.cgi?id=166455
1640
1641         Unreviewed. Fix the preprocessor guards here; this code is incompatible with GLES2.
1642
1643         Looks like it's been broken for a month. Typical!
1644
1645         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1646         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
1647
1648 2016-12-23  Zan Dobersek  <zdobersek@igalia.com>
1649
1650         [EME][GStreamer] Enable various code paths for ENCRYPTED_MEDIA
1651         https://bugs.webkit.org/show_bug.cgi?id=166054
1652
1653         Reviewed by Xabier Rodriguez-Calvar.
1654
1655         Add ENABLE_ENCRYPTED_MEDIA build guards in various places in GStreamer
1656         code to enable decryption-related GStreamer elements and the proper
1657         decryptor handling in AppendPipeline.
1658
1659         * platform/GStreamer.cmake:
1660         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1661         * platform/graphics/gstreamer/GStreamerUtilities.h:
1662         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1663         (WebCore::registerWebKitGStreamerElements):
1664         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1665         Only call needKey() if LEGACY_ENCRYPTED_MEDIA is enabled, since this is
1666         the way the legacy EME system expects to be notified of key necessity.
1667         It's very likely ENCRYPTED_MEDIA will do this differently.
1668         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1669         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
1670         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1671         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
1672         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1673         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1674         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1675         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
1676         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1677
1678 2016-12-23  Ryosuke Niwa  <rniwa@webkit.org>
1679
1680         Eliminate the use of lastChild in TextIterator
1681         https://bugs.webkit.org/show_bug.cgi?id=166456
1682
1683         Reviewed by Antti Koivisto.
1684
1685         Just use the node we just existed in TextIterator::exitNode and in emitting additional new line
1686         to eliminate the use of Node::lastChild.
1687
1688         Also initialize member variables in the declaration instead of the constructor to modernize the code.
1689
1690         * editing/TextIterator.cpp:
1691         (WebCore::TextIterator::TextIterator):
1692         (WebCore::TextIterator::advance):
1693         (WebCore::TextIterator::exitNode):
1694         * editing/TextIterator.h:
1695
1696 2016-12-22  Andy Estes  <aestes@apple.com>
1697
1698         Reduce QuickLook.h include overhead
1699         https://bugs.webkit.org/show_bug.cgi?id=166454
1700
1701         Reviewed by Andreas Kling.
1702
1703         * dom/Document.cpp: Included QuickLook.h for QLPreviewProtocol().
1704         * loader/DocumentLoader.cpp:
1705         (WebCore::DocumentLoader::setQuickLookHandle): Moved from DocumentLoader.h to here.
1706         * loader/DocumentLoader.h: Stopped including QuickLook.h and forward-declared
1707         QuickLookHandle.
1708         (WebCore::DocumentLoader::setQuickLookHandle): Moved definition out-of-line since it
1709         requires QuickLookHandle to be a complete type.
1710         * loader/ios/QuickLook.h: Updated to use #pragma once. Cleaned up includes and forward
1711         declarations.
1712         * platform/network/ResourceHandle.cpp: Included QuickLook.h so that QuickLookHandle is a
1713         complete type in the ResourceHandle constructor.
1714         * platform/network/ResourceHandle.h: Stopped including QuickLook.h and forward-declared
1715         QuickLookHandle.
1716         (WebCore::ResourceHandle::setQuickLookHandle): Moved definition out-of-line since it
1717         requires QuickLookHandle to be a complete type.
1718         * platform/network/mac/ResourceHandleMac.mm:
1719         (WebCore::ResourceHandle::setQuickLookHandle): Moved from ResourceHandle.h to here.
1720         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Included QuickLook.h for
1721         QuickLookHandle.
1722
1723 2016-12-22  Andy Estes  <aestes@apple.com>
1724
1725         [iOS] Move QuickLook from WebCore/platform to WebCore/loader
1726         https://bugs.webkit.org/show_bug.cgi?id=166449
1727
1728         Reviewed by Darin Adler.
1729
1730         QuickLook.mm knows about ResourceLoader, so it's a layering violation to have it in
1731         platform/. Move it to loader/ios/.
1732
1733         * WebCore.xcodeproj/project.pbxproj:
1734         * loader/ios/QuickLook.h: Renamed from Source/WebCore/platform/network/ios/QuickLook.h.
1735         * loader/ios/QuickLook.mm: Renamed from Source/WebCore/platform/network/ios/QuickLook.mm.
1736
1737 2016-12-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1738
1739         Unreviewed, fix unused parameter warning in GLES build
1740
1741         Looks like it's been here since 2012. Impressive!
1742
1743         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1744         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
1745
1746 2016-12-22  Alex Christensen  <achristensen@webkit.org>
1747
1748         Move GraphicsContext3DWin to GraphicsContext3DOpenGLES
1749         https://bugs.webkit.org/show_bug.cgi?id=166425
1750
1751         Reviewed by Tim Horton.
1752
1753         Move code which is GLES-specific not Windows-specific to the GLES-specific file
1754         so I can use it on Cocoa, with a temporary PLATFORM macro that I plan to remove once
1755         all platforms use ANGLE's GLES implementation. There is another copy of this code in
1756         GraphicsContext3DCairo, which will also be united with this code here soon.
1757         Also remove the PlatformCALayerWin, which was never used for anything.
1758
1759         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1760         (WebCore::GraphicsContext3D::create):
1761         (WebCore::GraphicsContext3D::GraphicsContext3D):
1762         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1763         (WebCore::GraphicsContext3D::setContextLostCallback):
1764         (WebCore::GraphicsContext3D::setErrorMessageCallback):
1765         (WebCore::GraphicsContext3D::makeContextCurrent):
1766         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary):
1767         (WebCore::GraphicsContext3D::platformGraphicsContext3D):
1768         (WebCore::GraphicsContext3D::platformTexture):
1769         (WebCore::GraphicsContext3D::isGLES2Compliant):
1770         (WebCore::GraphicsContext3D::platformLayer):
1771         * platform/graphics/win/GraphicsContext3DWin.cpp: Removed.
1772         * PlatformMac.cmake:
1773         Include the egl directory.  I'll need this, too, once Mac starts using ANGLE's EGL implementation.
1774
1775 2016-12-22  Brent Fulgham  <bfulgham@apple.com>
1776
1777         Nested calls to setDocument can omit firing 'unload' events
1778         https://bugs.webkit.org/show_bug.cgi?id=166422
1779         <rdar://problem/29763012>
1780
1781         Reviewed by Alex Christensen.
1782
1783         Test: fast/loader/nested-document-handling.html
1784
1785         Only allow a single document change to be taking place during a given runloop cycle.
1786
1787         * bindings/js/ScriptController.cpp:
1788         (WebCore::ScriptController::executeIfJavaScriptURL): Block script changing the document
1789         when we are in the middle of changing the document.
1790         * page/Frame.cpp:
1791         (WebCore::Frame::setDocument): Keep track of document change state.
1792         * page/Frame.h:
1793
1794 2016-12-22  Tim Horton  <timothy_horton@apple.com>
1795
1796         TileGrid creates new cohorts even when not using temporarilyRetainTileCohorts mode
1797         https://bugs.webkit.org/show_bug.cgi?id=166440
1798
1799         Reviewed by Simon Fraser.
1800
1801         No new tests.
1802
1803         * platform/graphics/ca/TileGrid.cpp:
1804         (WebCore::TileGrid::revalidateTiles):
1805         If we are not temporarily retaining unparented tile cohorts (e.g. on
1806         iOS WebKit2), instead immediately removing all tiles that would go into
1807         the new cohort, avoid starting the cohort at all.
1808
1809 2016-12-22  Zalan Bujtas  <zalan@apple.com>
1810
1811         Do not destroy the RenderNamedFlowFragment as leftover anonymous block.
1812         https://bugs.webkit.org/show_bug.cgi?id=166436
1813         rdar://problem/29772233
1814
1815         Reviewed by Simon Fraser.
1816
1817         When as the result of certain style change, the generated anonymous block is not needed anymore, we
1818         move its descendants up to the parent and destroy the generated box. While RenderNamedFlowFragment is a generated
1819         block, the cleanup code should just ignore it the same way we ignore boxes like multicolumn, mathml etc. 
1820
1821         Test: fast/regions/flow-fragment-as-anonymous-block-crash.html
1822
1823         * rendering/RenderObject.h:
1824         (WebCore::RenderObject::isAnonymousBlock):
1825
1826 2016-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1827
1828         CSS Scroll Snap does not work if scrollbar is hidden
1829         https://bugs.webkit.org/show_bug.cgi?id=160442
1830         <rdar://problem/23317034>
1831
1832         Reviewed by Simon Fraser.
1833
1834         Currently, the only reason scroll snapping works in overflow scrolling containers without forcing layout is
1835         because we would initialize the scrolling container's ScrollAnimator in the process of updating scrollbars. If
1836         there are no scrollbars to render, we won't bother creating a ScrollAnimator. Without an existing
1837         ScrollAnimator, ScrollableArea::updateScrollSnapState will simply bail instead of setting up the scroll snap
1838         state. Instead, we should take setting a non-empty vector of scroll offsets on the ScrollableArea as a cue that
1839         the ScrollableArea also needs a ScrollAnimator, and initialize it there if necessary.
1840
1841         Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-hidden-scrollbars.html
1842
1843         * platform/ScrollableArea.cpp:
1844         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
1845         (WebCore::ScrollableArea::setVerticalSnapOffsets):
1846
1847 2016-12-22  Daniel Bates  <dabates@apple.com>
1848
1849         Bypass pop-up blocker from cross-origin or sandboxed frame
1850         https://bugs.webkit.org/show_bug.cgi?id=166290
1851         <rdar://problem/29742039>
1852
1853         Reviewed by Darin Adler.
1854
1855         Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html
1856                fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html
1857                fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html
1858
1859         * page/DOMWindow.cpp:
1860         (WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the
1861         target frame to navigate with respect to the active document just as we do in WebCore::createWindow().
1862
1863 2016-12-22  Andy Estes  <aestes@apple.com>
1864
1865         Make WebCore::EditorInsertAction an enum class
1866         https://bugs.webkit.org/show_bug.cgi?id=166424
1867
1868         Reviewed by Brent Fulgham.
1869
1870         * editing/AlternativeTextController.cpp:
1871         (WebCore::AlternativeTextController::applyDictationAlternative):
1872         * editing/Editor.cpp:
1873         (WebCore::Editor::pasteAsPlainTextWithPasteboard):
1874         (WebCore::Editor::shouldInsertText):
1875         (WebCore::Editor::insertTextWithoutSendingTextEvent):
1876         (WebCore::Editor::insertLineBreak):
1877         (WebCore::Editor::insertParagraphSeparator):
1878         (WebCore::Editor::markMisspellingsAfterTypingToWord):
1879         (WebCore::Editor::markAndReplaceFor):
1880         (WebCore::Editor::changeBackToReplacedString):
1881         (WebCore::Editor::transpose):
1882         (WebCore::Editor::handleAcceptedCandidate):
1883         * editing/EditorInsertAction.h:
1884         (): Deleted.
1885         * editing/gtk/EditorGtk.cpp:
1886         (WebCore::Editor::pasteWithPasteboard):
1887         * editing/ios/EditorIOS.mm:
1888         (WebCore::Editor::pasteWithPasteboard):
1889         (WebCore::Editor::replaceSelectionWithAttributedString):
1890         * editing/mac/EditorMac.mm:
1891         (WebCore::Editor::pasteWithPasteboard):
1892         (WebCore::Editor::replaceNodeFromPasteboard):
1893         (WebCore::Editor::replaceSelectionWithAttributedString):
1894         * editing/win/EditorWin.cpp:
1895         (WebCore::Editor::pasteWithPasteboard):
1896         * page/ContextMenuController.cpp:
1897         (WebCore::insertUnicodeCharacter):
1898         (WebCore::ContextMenuController::contextMenuItemSelected):
1899         * page/DragController.cpp:
1900         (WebCore::DragController::concludeEditDrag):
1901
1902 2016-12-22  Jer Noble  <jer.noble@apple.com>
1903
1904         Only include those parts of AVFoundation.framework which are strictly needed.
1905         https://bugs.webkit.org/show_bug.cgi?id=166423
1906
1907         Reviewed by Eric Carlson.
1908
1909         * Modules/plugins/QuickTimePluginReplacement.mm:
1910         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1911         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
1912         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
1913         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1914         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1915         * platform/mac/SerializedPlatformRepresentationMac.mm:
1916         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1917         * platform/mac/WebVideoFullscreenController.mm:
1918         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1919         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1920         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1921         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1922
1923 2016-12-22  Jer Noble  <jer.noble@apple.com>
1924
1925         NULL-deref CRASH in WebCore::PlatformMediaSession::mediaType
1926         https://bugs.webkit.org/show_bug.cgi?id=166407
1927
1928         Reviewed by Darin Adler.
1929
1930         In r207688, we added a facility in PlatformMediaSessionManager for safely walking through a
1931         list of PlatformMediaSessions by replacing entries of deleted sessions with nullptr. We now
1932         need to use those new iteration falicities in MediaSessionManageriOS.
1933
1934         In addition to the existing iterators, add one which takes a predicate, and returns the first
1935         session which matches the predicate, or nullptr, if none do.
1936
1937         * platform/audio/PlatformMediaSessionManager.cpp:
1938         (WebCore::PlatformMediaSessionManager::findSession):
1939         (WebCore::PlatformMediaSessionManager::anyOfSessions):
1940         * platform/audio/PlatformMediaSessionManager.h:
1941         (WebCore::PlatformMediaSessionManager::sessions): Deleted.
1942         * platform/audio/ios/MediaSessionManagerIOS.mm:
1943         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
1944         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession):
1945         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
1946         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground):
1947         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground):
1948
1949 2016-12-22  Jer Noble  <jer.noble@apple.com>
1950
1951         Muted media element playback should not interrupt other audio playback
1952         https://bugs.webkit.org/show_bug.cgi?id=166347
1953
1954         Reviewed by Eric Carlson.
1955
1956         Test: TestWebKitAPI/WebKit/ios/AudioSessionCategoryIOS.mm
1957
1958         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1959         (PlatformMediaSessionManager::updateSessionState):
1960
1961 2016-12-22  Jer Noble  <jer.noble@apple.com>
1962
1963         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
1964         https://bugs.webkit.org/show_bug.cgi?id=166421
1965
1966         Reviewed by Eric Carlson.
1967
1968         * platform/spi/mac/AVFoundationSPI.h:
1969
1970 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
1971
1972         AVPlayerLayer isn't available on every system
1973         https://bugs.webkit.org/show_bug.cgi?id=166399
1974
1975         Reviewed by Jer Noble.
1976
1977         No new tests, prevents a crash that can't be reproduced on a test system.
1978
1979         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Use SOFT_LINK_CLASS_OPTIONAL.
1980
1981 2016-12-21  Tim Horton  <timothy_horton@apple.com>
1982
1983         TileGrid revalidates tiles twice during flush, first with wrong visible rect
1984         https://bugs.webkit.org/show_bug.cgi?id=166406
1985
1986         Reviewed by Simon Fraser.
1987
1988         No new tests; existing tests cover this code, this is just a perf win,
1989         specifically reducing the amount of layer churn during zooming.
1990
1991         * platform/graphics/ca/TileGrid.cpp:
1992         (WebCore::TileGrid::setScale):
1993         Schedule a revalidation, which will happen later in the same flush,
1994         instead of doing it immediately. Doing it immediately is problematic,
1995         because we're currently in the middle of a GraphicsLayer tree flush,
1996         and don't have the complete picture of the new state yet. We're guaranteed
1997         to get the new scale *before* the flush calls revalidateTiles.
1998
1999 2016-12-21  Tim Horton  <timothy_horton@apple.com>
2000
2001         TileGrid creates new tiles when there are recyclable tiles about to be removed
2002         https://bugs.webkit.org/show_bug.cgi?id=166408
2003
2004         Reviewed by Simon Fraser.
2005
2006         No new tests; existing tests cover this code, this is just a perf win,
2007         specifically reducing the amount of layer churn during zooming.
2008
2009         * platform/graphics/ca/TileGrid.cpp:
2010         (WebCore::TileGrid::revalidateTiles):
2011         Remove all the tiles that will be removed first, then add new tiles.
2012         Strictly ordering it this way means that tiles will be removed, go into
2013         the LayerPool, then be pulled back out of the LayerPool to sit in the
2014         newly-covered areas. Previously, we would sometimes make new layers
2015         for newly-covered areas, and then remove unneeded but otherwise recyclable
2016         tiles, which would then just go sit in the LayerPool (and often get
2017         pruned, wastefully).
2018
2019 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
2020
2021         [MediaStream] Update media-stream-event-constructor test
2022         https://bugs.webkit.org/show_bug.cgi?id=166398
2023
2024         Reviewed by Jer Noble.
2025
2026         No new tests, updated existing test.
2027
2028         * Modules/mediastream/MediaStreamEvent.idl: Mark eventInitDict as optional.
2029
2030 2016-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2031
2032         WebKit should set Original URL of a download request correctly
2033         https://bugs.webkit.org/show_bug.cgi?id=166394
2034         <rdar://problem/25391382>
2035
2036         Reviewed by Alex Christensen.
2037
2038         WebKit should set Original URL of a download request correctly if the download
2039         is initiated by clicking on a link with target=_blank.
2040
2041         Manually tested as the requested test infrastructure doesn't exist yet. We need actual
2042         loading process for API test such that we could simulate the real situation which
2043         PolicyDownload is only set when we receive responds. Currently we can only set
2044         PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate
2045         the following process: load starts -> PolicyUse -> creates a new WebView ->
2046         respond receives -> PolicyDownload -> downloads.
2047
2048         * loader/FrameLoader.cpp:
2049         (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
2050
2051 2016-12-21  Sam Weinig  <sam@webkit.org>
2052
2053         [WebIDL] Remove custom binding for ErrorEvent
2054         https://bugs.webkit.org/show_bug.cgi?id=166345
2055
2056         Reviewed by Anders Carlsson.
2057
2058         * CMakeLists.txt:
2059         * WebCore.xcodeproj/project.pbxproj:
2060         * bindings/js/JSBindingsAllInOne.cpp:
2061         * bindings/js/JSErrorEventCustom.cpp: Removed.
2062         Remove JSErrorEventCustom.cpp
2063
2064         * ForwardingHeaders/heap/HandleTypes.h: Added.
2065         Add forwarding header for HandleTypes.h
2066
2067         * bindings/js/JSErrorHandler.cpp:
2068         (WebCore::JSErrorHandler::handleEvent):
2069         Switch to using JSDOMConvert and call the updated name for the error getter.
2070
2071         * bindings/js/ScriptController.h:
2072         * bindings/js/SerializedScriptValue.h:
2073         Remove unnecessary forward declaration of ScriptValue.
2074
2075         * bindings/js/WorkerScriptController.cpp:
2076         (WebCore::WorkerScriptController::evaluate):
2077         * dom/ScriptExecutionContext.cpp:
2078         (WebCore::ScriptExecutionContext::sanitizeScriptError):
2079         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
2080         * dom/ScriptExecutionContext.h:
2081         * workers/WorkerMessagingProxy.cpp:
2082         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
2083         Update type that sanitizeScriptError takes from a ScriptValue to a Strong<Unknown>.
2084
2085         * bindings/scripts/CodeGeneratorJS.pm:
2086         (GenerateCallWith):
2087         * bindings/scripts/IDLAttributes.txt:
2088         Add a new extended attributes option for the CallWith, GlobalObject, that passes the global object.
2089
2090         * dom/ErrorEvent.cpp:
2091         (WebCore::ErrorEvent::ErrorEvent):
2092         (WebCore::ErrorEvent::error):
2093         (WebCore::ErrorEvent::trySerializeError):
2094         (WebCore::ErrorEvent::sanitizedErrorValue): Deleted.
2095         * dom/ErrorEvent.h:
2096         Store a Strong<Unknown> directly, rather than a ScriptValue. Rename sanitizedErrorValue to 
2097         just error to match the IDL.
2098
2099         * dom/ErrorEvent.idl:
2100         Remove CustomGetter.
2101
2102 2016-12-21  Ryosuke Niwa  <rniwa@webkit.org>
2103
2104         Modernize findPlainText
2105         https://bugs.webkit.org/show_bug.cgi?id=166299
2106
2107         Reviewed by Sam Weinig.
2108
2109         Modernized findPlainText by merging the static version of it into it
2110         and extracting the main nested loop out as findPlainTextOffset.
2111
2112         No new tests since there should be no behavioral change.
2113
2114         * editing/TextIterator.cpp:
2115         (WebCore::findPlainTextOffset):
2116         (WebCore::findPlainText):
2117
2118 2016-12-21  John Wilander  <wilander@apple.com>
2119
2120         Switch to a blacklist model for restricted Accept headers in simple CORS requests
2121         https://bugs.webkit.org/show_bug.cgi?id=166363
2122
2123         Reviewed by Alex Christensen.
2124
2125         Updated existing tests.
2126
2127         * platform/network/HTTPParsers.cpp:
2128         (WebCore::isDelimiterCharacter):
2129             Convenience function for checking delimiter characters according to:
2130             https://tools.ietf.org/html/rfc7230#section-3.2.6 
2131         (WebCore::isValidAcceptHeaderValue):
2132             Now uses WebCore::isDelimiterCharacter() to blacklist delimiter characters
2133             instead of a whitelist of accepted non-alphanumeric characters.
2134
2135 2016-12-21  Beth Dakin  <bdakin@apple.com>
2136
2137         Holding down on candidates in the TouchBar should show panel on screen
2138         https://bugs.webkit.org/show_bug.cgi?id=166367
2139         -and corresponding-
2140         <rdar://problem/28479236>
2141
2142         Reviewed by Tim Horton.
2143
2144         Expose the version of setCandidates: that takes a rect.
2145         * platform/spi/cocoa/NSTouchBarSPI.h:
2146
2147 2016-12-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2148
2149         Extensions3DOpenGL[ES] constructor should not be explicit
2150         https://bugs.webkit.org/show_bug.cgi?id=166296
2151
2152         Reviewed by Darin Adler.
2153
2154         These constructors used to only have one parameter. Now they have two and they're both
2155         mandatory.
2156
2157         * platform/graphics/opengl/Extensions3DOpenGL.h:
2158         * platform/graphics/opengl/Extensions3DOpenGLES.h:
2159
2160 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
2161
2162         [MediaStream] MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer can be called before it has a media stream
2163         https://bugs.webkit.org/show_bug.cgi?id=166344
2164         <rdar://problem/29763143>
2165
2166         Reviewed by Jer Noble.
2167
2168         There is a very narrow window during which a MediaStream player can be asked for its layer 
2169         before it has a steam, resulting in a NULL dereference and crash. Don't do that.
2170
2171         Unable to reproduce.
2172
2173         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2174         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
2175
2176 2016-12-21  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2177
2178         [Readable Streams API] Fix test in readableByteStreamCallPullIfNeeded
2179         https://bugs.webkit.org/show_bug.cgi?id=166312
2180
2181         Reviewed by Youenn Fablet.
2182
2183         Add a new function to evaluate if calling a pull function is
2184         required as per specification.
2185
2186         No new test required.
2187
2188         * Modules/streams/ReadableByteStreamInternals.js:
2189         (readableByteStreamControllerShouldCallPull): Added.
2190         (readableByteStreamControllerCallPullIfNeeded):
2191
2192 2016-12-21  Simon Fraser  <simon.fraser@apple.com>
2193
2194         Fixed bars are positioned incorrectly when there are header and footer banners
2195         https://bugs.webkit.org/show_bug.cgi?id=166302
2196         rdar://problem/29727145
2197
2198         Reviewed by Tim Horton.
2199         
2200         The computation of the visual viewport was wrong in the presence of header and footer
2201         banners. It needs to take into account the fact that "visibleContentRect" applies to the
2202         scroll view contents, which includes header and footer (unscaled), and the potentially scaled
2203         document, and we need to return a rectangle in unscaled document coordinates.
2204         
2205         Make a static method in FrameView to do this computation, and call it from FrameView::visualViewportRect()
2206         and ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition().
2207         
2208         layoutViewportForScrollPosition() is only called on Mac, so remove the #ifdeffing related to scaling, 
2209         and pass in an unscaled scroll position.
2210
2211         Test: fast/visual-viewport/zoomed-fixed-header-and-footer.html
2212
2213         * page/FrameView.cpp:
2214         (WebCore::FrameView::updateLayoutViewport):
2215         (WebCore::FrameView::maxStableLayoutViewportOrigin):
2216         (WebCore::FrameView::visibleDocumentRect):
2217         (WebCore::FrameView::visualViewportRect):
2218         * page/FrameView.h:
2219         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2220         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
2221         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2222         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
2223
2224 2016-12-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2225
2226         [CMake] Remove remaining INDIE_UI related entries.
2227         https://bugs.webkit.org/show_bug.cgi?id=165881
2228
2229         Unreviewed.
2230
2231         * CMakeLists.txt:
2232
2233 2016-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2234
2235         [Cairo] Conditional jump or move depends on uninitialised value(s)
2236         https://bugs.webkit.org/show_bug.cgi?id=166058
2237
2238         Reviewed by Michael Catanzaro.
2239
2240         Initialize x and y members of cairo_glyph_t struct before passing it to cairo_glyph_path.
2241
2242         * platform/graphics/cairo/FontCairo.cpp:
2243         (WebCore::CairoGlyphToPathTranslator::path):
2244
2245 2016-12-20  Myles C. Maxfield  <mmaxfield@apple.com>
2246
2247         Skia lighter wght variation looks bolder than regular
2248         https://bugs.webkit.org/show_bug.cgi?id=165948
2249
2250         Reviewed by Antti Koivisto.
2251
2252         Test: fast/text/variations/default-value.html
2253
2254         This patch inspects the font's information regarding variations. It uses this information
2255         to work around a bug in CoreText where default variation values were not getting applied.
2256         This workaround is placed behind a version check and the macro name
2257         "WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG" so we know to delete it whenever
2258         possible. It also uses the minimum and maximum supported values for the axis to clamp our
2259         variation values to the closest supported point, which is in line with a recent edit to
2260         the fonts spec:
2261         https://github.com/w3c/csswg-drafts/commit/52b802ac38619286a30662dceb71b8a29fa72f42
2262         This clamping behavior also revealed another bug in CoreText, which was worked around
2263         behind another version check and macro name WORKAROUND_CORETEXT_VARIATIONS_EXTENTS_BUG so
2264         we know to delete it whenever possible.
2265
2266         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2267         (WebCore::defaultVariationValues):
2268         (WebCore::preparePlatformFont):
2269
2270 2016-12-20  Tim Horton  <timothy_horton@apple.com>
2271
2272         Remove a duplicate reference to ScrollingMomentumCalculatorMac.h in the Xcode project
2273
2274         Rubber-stamped by Sam Weinig.
2275
2276         * WebCore.xcodeproj/project.pbxproj:
2277
2278 2016-12-20  Tim Horton  <timothy_horton@apple.com>
2279
2280         Remove a duplicate reference to ScrollingMomentumCalculatorMac.mm in the Xcode project
2281
2282         Rubber-stamped by Sam Weinig.
2283
2284         * WebCore.xcodeproj/project.pbxproj:
2285
2286 2016-12-20  Alex Christensen  <achristensen@webkit.org>
2287
2288         Remove initEvent quirk
2289         https://bugs.webkit.org/show_bug.cgi?id=166284
2290
2291         Reviewed by Dan Bernstein.
2292
2293         We added this quirk in r207908 and expanded it in r209946 and r210034.
2294         Many web compatibility issues have been found, which leads us to believe that many more exist.
2295         This reverts the behavior to match how it was before r203848.
2296         This change was proposed to the spec in https://github.com/whatwg/dom/issues/387
2297
2298         * dom/Event.cpp:
2299         (WebCore::Event::initEventForBindings): Deleted.
2300         * dom/Event.h:
2301         * dom/Event.idl:
2302         * platform/RuntimeApplicationChecks.h:
2303         * platform/RuntimeApplicationChecks.mm:
2304         (WebCore::IOSApplication::isBaiduNuomi): Deleted.
2305         (WebCore::IOSApplication::isAutoNaviAMap): Deleted.
2306         (WebCore::IOSApplication::isFlipboard): Deleted.
2307
2308 2016-12-20  JF Bastien  <jfbastien@apple.com>
2309
2310         INDIE_UI: fix cmake build
2311         https://bugs.webkit.org/show_bug.cgi?id=166288
2312
2313         Reviewed by Mark Lam.
2314
2315         Bug #165881 didn't remove a file from cmake.
2316
2317         * PlatformMac.cmake:
2318
2319 2016-12-20  Alex Christensen  <achristensen@webkit.org>
2320
2321         Fix clean Windows build after r210029
2322         https://bugs.webkit.org/show_bug.cgi?id=165881
2323
2324         * DerivedSources.cpp:
2325
2326 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
2327
2328         Address some style problems found by static analysis
2329         https://bugs.webkit.org/show_bug.cgi?id=165975
2330
2331         Reviewed by Alex Christensen.
2332
2333         Correct the const-correctness of functions that are implemented using stricter
2334         const declarations.
2335
2336         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
2337
2338         * inspector/InspectorCSSAgent.h: Declare the method overrides properly to match
2339         the stricter const declarations in the implementation files.
2340         * inspector/InspectorDOMAgent.h: Ditto.
2341         * inspector/InspectorPageAgent.h: Ditto.
2342         * inspector/InspectorTimelineAgent.h: Ditto.
2343         * inspector/PageDebuggerAgent.h: Ditto.
2344         * platform/graphics/ANGLEWebKitBridge.cpp:
2345         (WebCore::ANGLEWebKitBridge::setResources): Pass by const reference.
2346         * platform/graphics/ANGLEWebKitBridge.h:
2347         (WebCore::ANGLEWebKitBridge::getResources): Return a const reference.
2348         * platform/mediastream/RealtimeMediaSource.cpp:
2349         (WebCore::RealtimeMediaSource::selectSettings): Use a lambda that takes
2350         a const reference, rather than copying the maps while searching.
2351
2352 2016-12-20  Sam Weinig  <sam@webkit.org>
2353
2354         [WebIDL] Remove custom binding for WorkerGlobalScope::importScripts
2355         https://bugs.webkit.org/show_bug.cgi?id=166243
2356
2357         Reviewed by Alex Christensen.
2358
2359         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
2360         (WebCore::JSWorkerGlobalScope::importScripts): Deleted.
2361         * workers/WorkerGlobalScope.idl:
2362         Import scripts can now be trivially generated.
2363
2364 2016-12-20  Zalan Bujtas  <zalan@apple.com>
2365
2366         SVG elements should inherit the root's flow thread state.
2367         https://bugs.webkit.org/show_bug.cgi?id=166173
2368         rdar://problem/29704862
2369
2370         Reviewed by Simon Fraser.
2371
2372         When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either.
2373
2374         Test: fast/multicol/svg-inside-multicolumn.html
2375
2376         * rendering/RenderObject.cpp:
2377         (WebCore::RenderObject::computedFlowThreadState):
2378         * rendering/RenderObject.h:
2379         (WebCore::RenderObject::isProgress):
2380         (WebCore::RenderObject::isRenderSVGBlock):
2381         * rendering/svg/RenderSVGBlock.h:
2382
2383 2016-12-20  Alex Christensen  <achristensen@webkit.org>
2384
2385         Fix yet another app that uses initEvent with fewer than 3 parameters
2386         https://bugs.webkit.org/show_bug.cgi?id=166257
2387         <rdar://problem/29420268>
2388
2389         Reviewed by Sam Weinig.
2390
2391         * dom/Event.cpp:
2392         (WebCore::Event::initEventForBindings):
2393         * platform/RuntimeApplicationChecks.h:
2394         * platform/RuntimeApplicationChecks.mm:
2395         (WebCore::IOSApplication::isAutoNaviAMap):
2396         AutoNavi amap has content that uses initEvent with one parameter. This quirk is needed here, too.
2397
2398 2016-12-20  Dean Jackson  <dino@apple.com>
2399
2400         Remove INDIE_UI
2401         https://bugs.webkit.org/show_bug.cgi?id=165881
2402         <rdar://problem/29672532>
2403
2404         Reviewed by Simon Fraser.
2405
2406         The Indie UI work has been discontinued.
2407
2408         * Configurations/FeatureDefines.xcconfig:
2409         * Modules/indieui/UIRequestEvent.cpp: Removed.
2410         * Modules/indieui/UIRequestEvent.h: Removed.
2411         * Modules/indieui/UIRequestEvent.idl: Removed.
2412         * WebCore.xcodeproj/project.pbxproj:
2413         * dom/Element.cpp:
2414         (WebCore::Element::setUIActions): Deleted.
2415         (WebCore::Element::UIActions): Deleted.
2416         * dom/Element.h:
2417         * dom/Element.idl:
2418         * dom/EventNames.in:
2419         * dom/Node.cpp:
2420         (WebCore::Node::dispatchUIRequestEvent): Deleted.
2421         * dom/Node.h:
2422
2423 2016-12-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2424
2425         [Readable Streams API] Implement readableByteStreamControllerCallPullIfNeeded()
2426         https://bugs.webkit.org/show_bug.cgi?id=166022
2427
2428         Reviewed by Youenn Fablet.
2429
2430         Implemented readableByteStreamControllerCallPullIfNeeded(). This function is
2431         in particular called when a new ReadableByteStreamController is created; hence,
2432         ReadableByteStreamController constructor has been updated.
2433
2434         Added 3 tests to check behaviour in case of success/failure of the start and pull functions
2435         associated to the underlyingByteSource.
2436
2437         * Modules/streams/ReadableByteStreamInternals.js:
2438         (privateInitializeReadableByteStreamController): Updated handling of underlyingByteSource
2439         start function (especially with call to readableByteStreamControllerCallPullIfNeeded).
2440         (isReadableStreamBYOBReader): Added.
2441         (readableStreamHasBYOBReader): Added.
2442         (readableStreamHasDefaultReader): Added.
2443         (readableByteStreamControllerCallPullIfNeeded): Added.
2444         * Modules/streams/ReadableStreamInternals.js:
2445         (privateInitializeReadableStreamDefaultController): Added missing asserts.
2446         * bindings/js/WebCoreBuiltinNames.h: Added readIntoRequests.
2447
2448 2016-12-20  Sam Weinig  <sam@webkit.org>
2449
2450         [DataCue] Un-prefix DataCue and remove custom bindings
2451         https://bugs.webkit.org/show_bug.cgi?id=166087
2452
2453         Reviewed by Eric Carlson.
2454
2455         * CMakeLists.txt:
2456         * WebCore.xcodeproj/project.pbxproj:
2457         * bindings/js/JSBindingsAllInOne.cpp:
2458         * bindings/js/JSDataCueCustom.cpp: Removed.
2459         Remove JSDataCueCustom.cpp
2460
2461         * bindings/js/JSTextTrackCueCustom.cpp:
2462         (WebCore::toJSNewlyCreated):
2463         Remove out of date comment.
2464
2465         * bindings/scripts/CodeGeneratorJS.pm:
2466         (GenerateConstructorDefinition):
2467         Update constructor generation code to use JSDOMConvert.
2468
2469         * html/track/DataCue.cpp:
2470         (WebCore::DataCue::DataCue):
2471         (WebCore::DataCue::~DataCue):
2472         (WebCore::DataCue::data):
2473         (WebCore::DataCue::setData):
2474         (WebCore::DataCue::cueContentsMatch):
2475         (WebCore::DataCue::value):
2476         (WebCore::DataCue::setValue):
2477         (WebCore::DataCue::valueOrNull):
2478         * html/track/DataCue.h:
2479         * html/track/DataCue.idl:
2480         * platform/SerializedPlatformRepresentation.h:
2481         Remove DATACUE_VALUE define from web exposed classes, so the interface can
2482         be the same on all platforms. Platforms that don't support DATACUE_VALUE will
2483         just never have any value. Also remove custom annotations.
2484
2485 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2486
2487         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
2488         https://bugs.webkit.org/show_bug.cgi?id=165317
2489         <rdar://problem/29490956>
2490
2491         Reviewed by Dean Jackson.
2492
2493         Implements the changes drafted in the latest iteration of the Scroll Snap Module Level 1 spec, which uses a
2494         snap-area and snap-port-based method for determining snap positions in a scroll snapping container.
2495         Additionally, removes the now-obsolete and prefixed implementation of the scroll snap spec and refactors all
2496         affected layout tests to use the new CSS properties. Also adds new layout tests covering some behaviors detailed
2497         in the new version of the spec, such as scroll snapping with transformed child elements.
2498
2499         See below for more detailed descriptions of the changes.
2500
2501         Tests: css3/scroll-snap/scroll-snap-2d-change-axis-type.html
2502                css3/scroll-snap/scroll-snap-2d-offsets-computed-independently.html
2503                css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin.html
2504                css3/scroll-snap/scroll-snap-children-with-transforms.html
2505                css3/scroll-snap/scroll-snap-positions-mainframe.html
2506                css3/scroll-snap/scroll-snap-positions-overflow-resize.html
2507                css3/scroll-snap/scroll-snap-positions.html
2508                css3/scroll-snap/scroll-snap-style-changed-align.html
2509                css3/scroll-snap/scroll-snap-with-scroll-padding.html
2510
2511         * WebCore.xcodeproj/project.pbxproj:
2512         * css/CSSCalculationValue.cpp:
2513         (WebCore::hasDoubleValue):
2514
2515         Removed use of length repeat.
2516
2517         * css/CSSComputedStyleDeclaration.cpp:
2518         (WebCore::valueForScrollSnapType):
2519         (WebCore::valueForScrollSnapAlignment):
2520         (WebCore::ComputedStyleExtractor::propertyValue):
2521         (WebCore::scrollSnapDestination): Deleted.
2522         (WebCore::scrollSnapPoints): Deleted.
2523         (WebCore::scrollSnapCoordinates): Deleted.
2524
2525         Removed helper functions used to create CSS values for scroll snap coordinates and destination, and added
2526         helpers for computed scroll snap type (a combination of axis and strictness values) as well as scroll snap align
2527         (an alignment value per axis).
2528
2529         * css/CSSPrimitiveValue.cpp:
2530         (WebCore::isValidCSSUnitTypeForDoubleConversion):
2531         (WebCore::isStringType):
2532         (WebCore::CSSPrimitiveValue::cleanup):
2533         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
2534         (WebCore::CSSPrimitiveValue::cloneForCSSOM):
2535         (WebCore::CSSPrimitiveValue::equals):
2536
2537         Removed usages of the length repeat type, since repeat(*) is no longer being used anywhere.
2538
2539         * css/CSSPrimitiveValue.h:
2540         * css/CSSPrimitiveValueMappings.h:
2541         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2542         (WebCore::CSSPrimitiveValue::operator ScrollSnapStrictness):
2543         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxis):
2544         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxisAlignType):
2545         (WebCore::CSSPrimitiveValue::operator ScrollSnapType): Deleted.
2546
2547         Added CSSPrimitiveValue mappings to ScrollSnapAxisAlignType, ScrollSnapStrictness, and ScrollSnapAxis. Removed
2548         the old ScrollSnapType mapping.
2549
2550         * css/CSSProperties.json:
2551
2552         Replaced the old scroll snap CSS properties with the new ones. Note that scroll-snap-margin and scroll-padding
2553         have 4 shorthands each, for the individual top/bottom/left/right values.
2554
2555         * css/CSSValueKeywords.in:
2556
2557         Added CSS keywords {x, y}, which are necessary to support the new scroll snapping properties.
2558
2559         * css/LengthRepeat.h: Removed.
2560
2561         Removed LengthRepeat entirely. This represented the `repeat(<length>)` CSS value, which was only used for the
2562         scroll-snap-points-x and scroll-snap-points-y values.
2563
2564         * css/StyleBuilderConverter.h:
2565         (WebCore::StyleBuilderConverter::convertScrollSnapType):
2566         (WebCore::StyleBuilderConverter::convertScrollSnapAlign):
2567         (WebCore::StyleBuilderConverter::parseSnapCoordinate): Deleted.
2568         (WebCore::StyleBuilderConverter::convertScrollSnapPoints): Deleted.
2569         (WebCore::StyleBuilderConverter::convertSnapCoordinatePair): Deleted.
2570         (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates): Deleted.
2571
2572         Added helper functions to convert scroll snap type and scroll snap alignment from parsed CSS values to their
2573         primary representation in WebCore as ScrollSnapType and ScrollSnapAlign. These methods assume that the given
2574         CSS values have successfully cleared the parsing step and are represented as CSSValueLists or length 1 or 2.
2575
2576         * css/StyleBuilderCustom.h:
2577         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX): Deleted.
2578         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX): Deleted.
2579         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY): Deleted.
2580         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY): Deleted.
2581         * css/StyleProperties.cpp:
2582         (WebCore::StyleProperties::getPropertyValue):
2583         (WebCore::StyleProperties::asText):
2584
2585         Adds support for the scroll-snap-margin and scroll-padding.
2586
2587         * css/parser/CSSParser.cpp:
2588         (WebCore::isValidKeywordPropertyAndValue):
2589         (WebCore::CSSParser::parseValue):
2590         (WebCore::isScrollSnapAxisAlign):
2591         (WebCore::isScrollSnapStrictness):
2592         (WebCore::CSSParser::parseScrollSnapAlign):
2593         (WebCore::CSSParser::parseScrollSnapType):
2594         (WebCore::CSSParser::parseNonElementSnapPoints): Deleted.
2595         (WebCore::CSSParser::parseScrollSnapPositions): Deleted.
2596         (WebCore::CSSParser::parseScrollSnapDestination): Deleted.
2597         (WebCore::CSSParser::parseScrollSnapCoordinate): Deleted.
2598         * css/parser/CSSParser.h:
2599
2600         Removed references to LengthRepeat, and added support for parsing new scroll snapping properties. Scroll snap
2601         margin and scroll padding, along with their shorthands, are parsed using the same helper functions as normal
2602         margin and padding. For type and align, I added new helper functions that build up lists of 1 or 2
2603         CSSPrimitiveValues for each of the properties.
2604
2605         Parsing scroll-snap-align is straightforward -- we either have one or two values in the set {none, start,
2606         center, end}. For scroll-snap-type, we allow a single axis value {x, y, inline, block, both}, or a single
2607         strictness value {none, proximity, mandatory}, or an axis value followed by a non-'none' strictness (i.e. either
2608         proximity or mandatory).
2609
2610         * css/parser/CSSParserFastPaths.cpp:
2611         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2612         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2613         * css/parser/CSSParserValues.cpp:
2614         (WebCore::CSSParserValue::createCSSValue):
2615
2616         Removed references to LengthRepeat.
2617
2618         * css/parser/CSSPropertyParser.cpp:
2619         (WebCore::CSSPropertyParser::parseSingleValue):
2620         (WebCore::CSSPropertyParser::parseShorthand):
2621         (WebCore::consumeSnapPointCoordinateList): Deleted.
2622         (WebCore::consumeScrollSnapCoordinate): Deleted.
2623         (WebCore::consumeScrollSnapDestination): Deleted.
2624         (WebCore::consumeScrollSnapPoints): Deleted.
2625         (WebCore::consumeScrollSnapAlign):
2626         (WebCore::consumeScrollSnapType):
2627         (WebCore::CSSPropertyParser::parseSingleValue):
2628
2629         Added parsing for the longhand properties of scroll-snap-margin and scroll-padding, which use the existing
2630         consumeLength and consumeLengthOrPercent helpers, respectively. Removed code for parsing scroll snap
2631         coordinates, destinations and points. Added parsing logic for align and type.
2632
2633         * page/scrolling/AxisScrollSnapOffsets.cpp:
2634         (WebCore::computeScrollSnapPortOrAreaRect):
2635         (WebCore::computeScrollSnapAlignOffset):
2636         (WebCore::snapOffsetsToString):
2637         (WebCore::snapPortOrAreaToString):
2638         (WebCore::updateSnapOffsetsForScrollableArea):
2639         (WebCore::appendChildSnapOffsets): Deleted.
2640         (WebCore::destinationOffsetForViewSize): Deleted.
2641         (WebCore::updateFromStyle): Deleted.
2642         (WebCore::styleUsesElements): Deleted.
2643
2644         Overhauled updateSnapOffsetsForScrollableArea to work with the new scroll snapping model. In the new way of
2645         computing scroll snap offsets, we:
2646
2647         Compute the scroll container's scroll snap port, which is the padding box inset by the scroll padding
2648         For each child with snap positions (i.e. scroll-snap-align is not none on both axes)
2649           Compute the child's scroll snap area, which is the bounding box of the transformed border box
2650             If the container snaps along the horizontal axis and the snap area contributes a horizontal snap offset:
2651               Emit the distance from the alignment offset in the horizontal of the snap port to the corresponding offset
2652               in the snap area as a snap position.
2653             If the container snaps along the vertical axis and the snap area contributes a vertical snap offset:
2654               Emit the distance from the alignment offset in the vertical of the snap port to the corresponding offset
2655               in the snap area as a snap position.
2656         For the snap offsets in each axis, if there is at least one snap offset:
2657           Clamp the offsets to the min and max scroll offsets
2658           Ensure that the offsets are sorted and do not contain duplicated offsets
2659
2660         * platform/cocoa/ScrollController.mm:
2661         (WebCore::ScrollController::updateScrollSnapState):
2662
2663         Clear out the ScrollController's snap offsets and state along an axis when its ScrollableArea no longer has snap
2664         offsets in that axis.
2665
2666         * rendering/RenderBox.cpp:
2667         (WebCore::RenderBox::styleWillChange):
2668         (WebCore::RenderBox::willBeRemovedFromTree):
2669         * rendering/RenderLayerModelObject.cpp:
2670         (WebCore::scrollSnapContainerRequiresUpdateForStyleUpdate):
2671         (WebCore::RenderLayerModelObject::styleDidChange):
2672         * rendering/RenderView.cpp:
2673         (WebCore::RenderView::registerBoxWithScrollSnapPositions):
2674         (WebCore::RenderView::unregisterBoxWithScrollSnapPositions):
2675         (WebCore::RenderView::registerBoxWithScrollSnapCoordinates): Deleted.
2676         (WebCore::RenderView::unregisterBoxWithScrollSnapCoordinates): Deleted.
2677         * rendering/RenderView.h:
2678
2679         Tweaked the scroll snap child registration logic. registerBoxWithScrollSnapCoordinates is renamed to
2680         unregisterBoxWithScrollSnapPositions, since the notion of scroll snap coordinates no longer exists, and instead
2681         of checking if the list of scroll snap coordinates is empty for the absence of scroll positions, we instead
2682         check for a computed scroll snap align that is not none on both axes.
2683
2684         * rendering/style/RenderStyle.cpp:
2685         (WebCore::RenderStyle::initialScrollSnapType):
2686         (WebCore::RenderStyle::initialScrollSnapAlign):
2687         (WebCore::RenderStyle::scrollSnapArea):
2688         (WebCore::RenderStyle::scrollSnapPort):
2689         (WebCore::RenderStyle::scrollSnapType):
2690         (WebCore::RenderStyle::scrollPadding):
2691         (WebCore::RenderStyle::scrollPaddingTop):
2692         (WebCore::RenderStyle::scrollPaddingBottom):
2693         (WebCore::RenderStyle::scrollPaddingLeft):
2694         (WebCore::RenderStyle::scrollPaddingRight):
2695         (WebCore::RenderStyle::scrollSnapAlign):
2696         (WebCore::RenderStyle::scrollSnapMargin):
2697         (WebCore::RenderStyle::scrollSnapMarginTop):
2698         (WebCore::RenderStyle::scrollSnapMarginBottom):
2699         (WebCore::RenderStyle::scrollSnapMarginLeft):
2700         (WebCore::RenderStyle::scrollSnapMarginRight):
2701         (WebCore::RenderStyle::setScrollSnapType):
2702         (WebCore::RenderStyle::setScrollPaddingTop):
2703         (WebCore::RenderStyle::setScrollPaddingBottom):
2704         (WebCore::RenderStyle::setScrollPaddingLeft):
2705         (WebCore::RenderStyle::setScrollPaddingRight):
2706         (WebCore::RenderStyle::setScrollSnapAlign):
2707         (WebCore::RenderStyle::setScrollSnapMarginTop):
2708         (WebCore::RenderStyle::setScrollSnapMarginBottom):
2709         (WebCore::RenderStyle::setScrollSnapMarginLeft):
2710         (WebCore::RenderStyle::setScrollSnapMarginRight):
2711         (WebCore::RenderStyle::initialScrollSnapDestination): Deleted.
2712         (WebCore::RenderStyle::initialScrollSnapCoordinates): Deleted.
2713         (WebCore::RenderStyle::scrollSnapPointsX): Deleted.
2714         (WebCore::RenderStyle::scrollSnapPointsY): Deleted.
2715         (WebCore::RenderStyle::scrollSnapDestination): Deleted.
2716         (WebCore::RenderStyle::scrollSnapCoordinates): Deleted.
2717         (WebCore::RenderStyle::setScrollSnapPointsX): Deleted.
2718         (WebCore::RenderStyle::setScrollSnapPointsY): Deleted.
2719         (WebCore::RenderStyle::setScrollSnapDestination): Deleted.
2720         (WebCore::RenderStyle::setScrollSnapCoordinates): Deleted.
2721         * rendering/style/RenderStyle.h:
2722         (WebCore::RenderStyle::initialScrollSnapMargin):
2723         (WebCore::RenderStyle::initialScrollPadding):
2724         (WebCore::RenderStyle::scrollSnapType): Deleted.
2725         (WebCore::RenderStyle::setScrollSnapType): Deleted.
2726         (WebCore::RenderStyle::initialScrollSnapType): Deleted.
2727         (WebCore::RenderStyle::initialScrollSnapPointsX): Deleted.
2728         (WebCore::RenderStyle::initialScrollSnapPointsY): Deleted.
2729
2730         Added boilerplate code for returning various new scroll snap style properties, and removed similar code for
2731         handling the old scroll snap properties.
2732
2733         * rendering/style/RenderStyleConstants.h:
2734
2735         Added three new enum classes:
2736         - ScrollSnapStrictness represents the strictness of scroll snapping along one or both axes
2737         - ScrollSnapAxis designates the axes along which scroll snapping should occur
2738         - ScrollSnapAxisAlignType indicates which offsets along the x or y axes of the snap port and snap area should be
2739           used to compute the snap position emitted by a snap area.
2740
2741         * rendering/style/StyleRareNonInheritedData.cpp:
2742         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2743         (WebCore::StyleRareNonInheritedData::operator==):
2744         * rendering/style/StyleRareNonInheritedData.h:
2745
2746         Replaces the StyleScrollSnapPoints object (which, confusingly, was in charge of storing both the scroll
2747         container's and child elements' scroll snap styles) with StyleScrollSnapPort and StyleScrollSnapArea objects,
2748         which keep track of the style properties on the scroll container and the child element, respectively.
2749
2750         * rendering/style/StyleScrollSnapPoints.h:
2751         (WebCore::operator==):
2752         (WebCore::StyleScrollSnapPort::copy):
2753         (WebCore::StyleScrollSnapPort::StyleScrollSnapPort):
2754         (WebCore::StyleScrollSnapArea::copy):
2755         (WebCore::StyleScrollSnapArea::StyleScrollSnapArea):
2756         * rendering/style/StyleScrollSnapping.h: Added.
2757         (WebCore::operator!=):
2758         (WebCore::StyleScrollSnapPort::create):
2759         (WebCore::StyleScrollSnapArea::create):
2760         (WebCore::StyleScrollSnapArea::hasSnapPosition):
2761
2762         Overhauled StyleScrollSnapPoints, breaking the logic here into two classes: StyleScrollSnapPort for the scroll
2763         container, handling the properties `scroll-snap-type` and `scroll-padding` and StyleScrollSnapArea for child
2764         elements, handling the properties `scroll-snap-align` and `scroll-snap-margin`. The ScrollSnapType itself is
2765         composed of an axis value and a strictness, while a ScrollSnapAlign keeps track of the alignment modes in each
2766         axis. By default, these are initialized to {Both, None} and {None, None}, respectively. The rest of the logic is
2767         boilerplate code for comparing these style objects to one another and copying style representations.
2768
2769         * testing/Internals.cpp:
2770         (WebCore::Internals::scrollSnapOffsets):
2771
2772         Perform a layout on the document if needed before returning the list of computed snap offsets. The absence of
2773         this layout pass was causing some layout tests in css3/scroll-snap/ to flake when testing that programmatic
2774         changes to the scroll snap style properties change the computed snap offsets.
2775
2776 2016-12-19  Dean Jackson  <dino@apple.com>
2777
2778         Use ENABLE() in place of ENABLE_CSS_SELECTORS_LEVEL4
2779         https://bugs.webkit.org/show_bug.cgi?id=166043
2780         <rdar://problems/29743655>
2781
2782         Reviewed by Alex Christensen.
2783
2784         This doesn't compile unless the ENABLE_CSS_SELECTORS_LEVEL4 is defined.
2785
2786         * css/SelectorChecker.cpp:
2787         (WebCore::SelectorChecker::matchRecursively):
2788         * css/SelectorFilter.cpp:
2789         (WebCore::SelectorFilter::collectIdentifierHashes):
2790         * css/parser/CSSSelectorParser.cpp:
2791         (WebCore::isOnlyPseudoClassFunction):
2792         (WebCore::CSSSelectorParser::consumePseudo):
2793         (WebCore::CSSSelectorParser::consumeCombinator):
2794         * cssjit/SelectorCompiler.cpp:
2795         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
2796
2797 2016-12-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2798
2799         Unreviewed, attempt to fix Windows Debug build part 2
2800         https://bugs.webkit.org/show_bug.cgi?id=166035
2801
2802         Ensured that this patch passes the build on the GTK port.
2803
2804         * rendering/RenderElement.cpp:
2805         * rendering/RenderElement.h:
2806
2807 2016-12-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2808
2809         Unreviewed, fix Windows Debug build
2810         https://bugs.webkit.org/show_bug.cgi?id=166035
2811
2812         The size of SameSizeAsRenderElement should be in sync with sizeof(RenderElement).
2813
2814         * rendering/RenderElement.cpp:
2815
2816 2016-12-20  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2817
2818         WebRTC: RTCPeerConnection constructor argument should be optional
2819         https://bugs.webkit.org/show_bug.cgi?id=164057
2820
2821         Reviewed by Youenn Fablet.
2822
2823         Modify RTCPeerConnection JSBuiltin constructor to allow RTCPeerConfiguration
2824         argument to be optional.
2825
2826         Update existing tests.
2827
2828         * Modules/mediastream/RTCPeerConnection.js:
2829         (initializeRTCPeerConnection):
2830
2831 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2832
2833         [ES6] Enable ES6 Modules
2834         https://bugs.webkit.org/show_bug.cgi?id=165849
2835
2836         Reviewed by Geoffrey Garen.
2837
2838         * dom/ScriptElement.cpp:
2839         (WebCore::ScriptElement::determineScriptType):
2840         * html/parser/HTMLPreloadScanner.cpp:
2841         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2842         * page/Settings.in:
2843
2844 2016-12-17  Sam Weinig  <sam@webkit.org>
2845
2846         Remove a few trivial custom bindings
2847         https://bugs.webkit.org/show_bug.cgi?id=165999
2848
2849         Reviewed by Simon Fraser.
2850
2851         * CMakeLists.txt:
2852         * bindings/js/JSBindingsAllInOne.cpp:
2853         Remove files.
2854
2855         * WebCore.xcodeproj/project.pbxproj:
2856         Move custom bindings that only exist for GC or wrapping reasons
2857         to their own group, so we can focus on the ones with custom functions.
2858
2859         * bindings/js/JSDataTransferCustom.cpp: Removed.
2860         * bindings/js/JSTrackEventCustom.cpp: Removed.
2861
2862         * dom/DataTransfer.cpp:
2863         (WebCore::DataTransfer::types):
2864         Remove incorrect comment and use a more concise empty initialization syntax.
2865
2866         * dom/DataTransfer.idl:
2867         Update IDL to remove [Custom] annotation and match spec better.
2868
2869         * html/track/TrackEvent.cpp:
2870         (WebCore::convertToTrackEventTrack):
2871         (WebCore::TrackEvent::TrackEvent):
2872         * html/track/TrackEvent.h:
2873         Switch to store the Track in a Variant to make the binding easier.
2874
2875         * html/track/TrackEvent.idl:
2876         Remove [CustomGetter] annotation.
2877
2878 2016-12-19  Zalan Bujtas  <zalan@apple.com>
2879
2880         Do not position detached list item marker.
2881         https://bugs.webkit.org/show_bug.cgi?id=166035
2882         <rdar://problem/29175235>
2883
2884         Reviewed by Simon Fraser.
2885
2886         In certain (non-reproducible) cases, the list item marker can get detached from the tree
2887         during layout and when in RenderListItem::positionListMarker() we dereference the marker's parent, we crash.
2888         In addition to the null check, this patch adds an ASSERTION to catch such cases early on.
2889
2890         Unable to reproduce.
2891
2892         * rendering/RenderBoxModelObject.cpp:
2893         (WebCore::RenderBoxModelObject::moveChildTo):
2894         * rendering/RenderElement.cpp:
2895         (WebCore::RenderElement::removeChildInternal):
2896         * rendering/RenderElement.h:
2897         * rendering/RenderListItem.cpp:
2898         (WebCore::RenderListItem::layout):
2899         (WebCore::RenderListItem::positionListMarker):
2900         * rendering/RenderListItem.h:
2901         * rendering/RenderListMarker.h:
2902
2903 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
2904
2905         [CSS Parser] Enable CSS Deferred Parsing
2906         https://bugs.webkit.org/show_bug.cgi?id=165869
2907
2908         Unreviewed rollout – looks like this regressed performance.
2909
2910         * css/parser/CSSParserMode.h:
2911         * page/Settings.in:
2912
2913 2016-12-18  Brent Fulgham  <bfulgham@apple.com>
2914
2915         Side effects while restting form elements
2916         https://bugs.webkit.org/show_bug.cgi?id=165959
2917         <rdar://problem/29705967>
2918
2919         Reviewed by Anders Carlsson.
2920
2921         JavaScript logic can run while resetting FormElement objects. This can
2922         lead to unintended side-effets and other unwanted behavior. We should
2923         protect these elements during the reset.
2924
2925         Test: fast/html/form-mutate.html
2926
2927         * html/HTMLFormElement.cpp:
2928         (WebCore::HTMLFormElement::HTMLFormElement): Switch to C++11 initialization.
2929         (WebCore::HTMLFormElement::reset): Protect elements until the reset
2930         operation is finished.
2931         (WebCore::HTMLFormElement::resetAssociatedFormControlElements): Added to share
2932         code with 'resumeFromDocument'.
2933         (WebCore::HTMLFormElement::resumeFromDocument): Protect elements until the
2934         reset operation is finished.
2935
2936 2016-12-19  Commit Queue  <commit-queue@webkit.org>
2937
2938         Unreviewed, rolling out r209983.
2939         https://bugs.webkit.org/show_bug.cgi?id=166024
2940
2941         There's intent to support persistent-usage-record (Requested
2942         by zdobersek on #webkit).
2943
2944         Reverted changeset:
2945
2946         "[EME] Remove MediaKeySessionType::persistent-usage-record"
2947         https://bugs.webkit.org/show_bug.cgi?id=166012
2948         http://trac.webkit.org/changeset/209983
2949
2950 2016-12-19  Sam Weinig  <sam@webkit.org>
2951
2952         Move custom files / callback objects into their respective groups.
2953
2954         Rubber-stamped by Simon Fraser.
2955
2956         * WebCore.xcodeproj/project.pbxproj:
2957
2958 2016-12-19  Sam Weinig  <sam@webkit.org>
2959
2960         [WebIDL] Remove custom binding for the named Image constructor
2961         https://bugs.webkit.org/show_bug.cgi?id=166023
2962
2963         Reviewed by Alex Christensen.
2964
2965         * bindings/js/JSBindingsAllInOne.cpp:
2966         * CMakeLists.txt:
2967         * WebCore.xcodeproj/project.pbxproj:
2968         Remove JSImageConstructor.
2969
2970         * bindings/js/JSImageConstructor.cpp: Removed.
2971         * bindings/js/JSImageConstructor.h: Removed.
2972         
2973         * bindings/js/JSDOMWindowCustom.cpp:
2974         (WebCore::JSDOMWindow::image): Deleted.
2975         * page/DOMWindow.idl:
2976         Remove custom getter for the constructor.
2977
2978         * html/HTMLImageElement.idl:
2979         Add NamedConstructor annotation.
2980
2981 2016-12-19  Antti Koivisto  <antti@apple.com>
2982
2983         Remove RenderObject::requiresForcedStyleRecalcPropagation
2984         https://bugs.webkit.org/show_bug.cgi?id=166021
2985
2986         Reviewed by Andreas Kling.
2987
2988         It is not called. It also makes no sense architecturally.
2989
2990         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
2991         * html/shadow/mac/ImageControlsRootElementMac.cpp:
2992         * rendering/RenderButton.h:
2993         * rendering/RenderFileUploadControl.h:
2994         * rendering/RenderListItem.h:
2995         * rendering/RenderMedia.h:
2996         * rendering/RenderMenuList.h:
2997         * rendering/RenderMeter.h:
2998         * rendering/RenderObject.h:
2999         (WebCore::RenderObject::requiresForcedStyleRecalcPropagation): Deleted.
3000         * rendering/RenderProgress.h:
3001         * rendering/RenderSlider.h:
3002         * rendering/RenderTextControl.h:
3003         * style/RenderTreeUpdater.cpp:
3004         (WebCore::RenderTreeUpdater::updateElementRenderer):
3005
3006             This is the only call site. Combination
3007
3008                 update.change == Style::NoChange && parent().styleChange == Style::Force
3009
3010             is impossible ('Force' inherits) so requiresForcedStyleRecalcPropagation doesn't ever even get called.
3011
3012 2016-12-19  Zan Dobersek  <zdobersek@igalia.com>
3013
3014         [EME] Remove MediaKeySessionType::persistent-usage-record
3015         https://bugs.webkit.org/show_bug.cgi?id=166012
3016
3017         Reviewed by Xabier Rodriguez-Calvar.
3018
3019         Remove the "persistent-usage-record" value from the MediaKeySessionType.
3020         This was removed from the spec as an at-risk feature.
3021         https://github.com/w3c/encrypted-media/issues/353
3022
3023         No non-imported tests need to be updated. This is still present in the
3024         tests imported from the W3C's web-platform-tests repository, but the
3025         tests haven't yet been updated upstream.
3026
3027         * Modules/encryptedmedia/CDM.cpp:
3028         (WebCore::CDM::isPersistentType):
3029         * Modules/encryptedmedia/MediaKeySessionType.h:
3030         * Modules/encryptedmedia/MediaKeySessionType.idl:
3031
3032 2016-12-19  Miguel Gomez  <magomez@igalia.com>
3033
3034         [GTK] GLXBadFBConfig error when creating an OpenGL context
3035         https://bugs.webkit.org/show_bug.cgi?id=165200
3036
3037         Reviewed by Carlos Garcia Campos.
3038
3039         glXCreateContextAttribsARB causes a GLXBadFBConfig X error when it's not able to provide the
3040         OpenGL version >= 3.2 we are requesting. Due to this, the app crashes instead of falling back to
3041         the legacy path.
3042         The patch modifies GLX context creation using a XErrorTrapper, so the first time a context is created
3043         we don't crash if OpenGL >= 3.2 is not available.
3044         If the gotten context is not valid, we fall back to whatever version glXCreateContextAttribsARB is
3045         able to provide.
3046         The legacy glXCreateContext is only used if the GLX_ARB_create_context extension is not available.
3047
3048         Covered by existent tests.
3049
3050         * platform/graphics/glx/GLContextGLX.cpp:
3051         (WebCore::tryCreateGLXARBContext):
3052         (WebCore::GLContextGLX::createWindowContext):
3053         (WebCore::GLContextGLX::createPbufferContext):
3054
3055 2016-12-18  Brady Eidson  <beidson@apple.com>
3056
3057         IndexedDB 2.0: Prefetch cursor records in the server.
3058         https://bugs.webkit.org/show_bug.cgi?id=166014
3059
3060         Reviewed by Andy Estes.
3061
3062         No new tests (Covered by existing LayoutTests and PerformanceTests).
3063
3064         This patch implements the followng:
3065         1 - After a backing store cursor completes a fetch in the server, it will schedule the next fetch 
3066             even before the client requests one. It will do this up to a limited number of prefetches.
3067         2 - Once a client request to advance the cursor comes in, we'll work our way through prefetched
3068             records instead of reading anything from disk, which might then cause us to continue prefetch.
3069         3 - If any changes to the object store occur, it will throw away all previously fetched records
3070             (There's room for future improvement here)
3071
3072         * Modules/indexeddb/server/IDBBackingStore.h:
3073         
3074         * Modules/indexeddb/server/IDBServer.cpp:
3075         (WebCore::IDBServer::IDBServer::postDatabaseTask):
3076         
3077         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
3078         
3079         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3080         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
3081         (WebCore::IDBServer::SQLiteIDBBackingStore::prefetchCursor):
3082         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
3083         
3084         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3085         (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
3086         (WebCore::IDBServer::SQLiteIDBCursor::prefetch):
3087         (WebCore::IDBServer::SQLiteIDBCursor::advance):
3088         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3089         
3090         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3091         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
3092         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
3093         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
3094         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3095
3096 2016-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3097
3098         Changing text direction fires input events with null inputTypes and no data
3099         https://bugs.webkit.org/show_bug.cgi?id=166007
3100         <rdar://problem/29557205>
3101
3102         Reviewed by Sam Weinig.
3103
3104         Adds support for the "formatSetInlineTextDirection" input type, triggered when using the context menu on Mac in
3105         an editable area (for both plain and rich text cases) to change paragraph direction. To do this, we add cases
3106         for EditActionSetWritingDirection in inputTypeNameForEditingAction and inputEventDataForEditingStyleAndAction.
3107
3108         When changing text direction for a plaintext editable element, we have logic in Editor::setBaseWritingDirection
3109         that sets the focused element's dir attribute to the requested value (ltr or rtl). We add similar hooks here to
3110         dispatch input events and handle preventing default.
3111
3112         Test: fast/events/before-input-events-prevent-text-direction.html
3113
3114         * editing/EditCommand.cpp:
3115         (WebCore::inputTypeNameForEditingAction):
3116
3117         Handle the EditActionSetWritingDirection case.
3118
3119         * editing/Editor.cpp:
3120         (WebCore::inputEventDataForEditingStyleAndAction):
3121         (WebCore::Editor::applyParagraphStyle):
3122
3123         Include input event data when dispatching an input event here.
3124
3125         (WebCore::Editor::setBaseWritingDirection):
3126         * testing/Internals.cpp:
3127         (WebCore::Internals::setBaseWritingDirection):
3128         * testing/Internals.h:
3129         * testing/Internals.idl:
3130
3131         Introduce an internal testing support hook for setting base writing direction (the same codepath taken when
3132         using the context menu to change paragraph direction). Currently, using testRunner.execCommand creates and
3133         applies style with an additional `unicode-bidi` attribute, and appears to also be intentionally disabled for
3134         plaintext editable elements.
3135
3136 2016-12-17  Simon Fraser  <simon.fraser@apple.com>
3137
3138         Build fix: linking WebCore was failing: you can't export inline functions.
3139
3140         * css/DeprecatedCSSOMPrimitiveValue.cpp:
3141         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType):
3142         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
3143         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue):
3144         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
3145         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue):
3146         * css/DeprecatedCSSOMPrimitiveValue.h:
3147         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType): Deleted.
3148         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Deleted.
3149         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue): Deleted.
3150         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Deleted.
3151         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue): Deleted.
3152
3153 2016-12-16  Dave Hyatt  <hyatt@apple.com>
3154
3155         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
3156         https://bugs.webkit.org/show_bug.cgi?id=165968
3157
3158         Reviewed by Andreas Kling.
3159
3160         This patch changes the CSS OM for values to use distinct wrapper
3161         classes instead of cloning the existing classes. By actually wrapping
3162         values instead of cloning, we are freed up to change our CSS value hierarchy
3163         however we'd like (such as changing to match the new CSS Values OM that
3164         is coming soon).
3165
3166         All of the CSS Values wrapper classes are prefixed with "DeprecatedCSSOM"
3167         to reflect our desire (ultimately) to remove this API from our tree. We're
3168         the only ones that support it, and it's not used on the Web, but it is part
3169         of the WebKitLegacy API and might be used internally.
3170
3171         * CMakeLists.txt:
3172         * DerivedSources.cpp:
3173         * DerivedSources.make:
3174         * WebCore.xcodeproj/project.pbxproj:
3175         * bindings/js/DOMWrapperWorld.h:
3176         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3177         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
3178         * bindings/js/JSCSSValueCustom.cpp:
3179         (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
3180         (WebCore::JSDeprecatedCSSOMValueOwner::finalize):
3181         (WebCore::toJSNewlyCreated):
3182         (WebCore::toJS):
3183         (WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots): Deleted.
3184         (WebCore::JSCSSValueOwner::finalize): Deleted.
3185         * css/CSSComputedStyleDeclaration.cpp:
3186         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
3187         * css/CSSComputedStyleDeclaration.h:
3188         * css/CSSGridLineNamesValue.cpp:
3189         (WebCore::CSSGridLineNamesValue::cloneForCSSOM): Deleted.
3190         * css/CSSGridLineNamesValue.h:
3191         * css/CSSImageSetValue.cpp:
3192         (WebCore::CSSImageSetValue::cloneForCSSOM): Deleted.
3193         * css/CSSImageSetValue.h:
3194         * css/CSSImageValue.cpp:
3195         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper):
3196         (WebCore::CSSImageValue::cloneForCSSOM): Deleted.
3197         * css/CSSImageValue.h:
3198         * css/CSSPrimitiveValue.cpp:
3199         (WebCore::CSSPrimitiveValue::createDeprecatedCSSOMPrimitiveWrapper):
3200         (WebCore::CSSPrimitiveValue::cloneForCSSOM): Deleted.
3201         * css/CSSPrimitiveValue.h:
3202         * css/CSSPrimitiveValue.idl: Removed.
3203         * css/CSSStyleDeclaration.h:
3204         * css/CSSStyleDeclaration.idl:
3205         * css/CSSValue.cpp:
3206         (WebCore::CSSValue::traverseSubresources):
3207         (WebCore::CSSValue::equals):
3208         (WebCore::CSSValue::cssText):
3209         (WebCore::CSSValue::destroy):
3210         (WebCore::CSSValue::createDeprecatedCSSOMWrapper):
3211         (): Deleted.
3212         (WebCore::CSSValue::cloneForCSSOM): Deleted.
3213         * css/CSSValue.h:
3214         (WebCore::CSSValue::CSSValue):
3215         (WebCore::CSSValue::setCssText): Deleted.
3216         (WebCore::CSSValue::isCSSOMSafe): Deleted.
3217         (WebCore::CSSValue::isSubtypeExposedToCSSOM): Deleted.
3218         * css/CSSValue.idl: Removed.
3219         * css/CSSValueList.cpp:
3220         (WebCore::CSSValueList::cloneForCSSOM): Deleted.
3221         * css/CSSValueList.h:
3222         (WebCore::CSSValueList::separator):
3223         * css/CSSValueList.idl: Removed.
3224         * css/Counter.h:
3225         * css/Counter.idl: Removed.
3226         * css/DeprecatedCSSOMCounter.h: Added.
3227         * css/DeprecatedCSSOMCounter.idl: Copied from Source/WebCore/css/Counter.idl.
3228         * css/DeprecatedCSSOMPrimitiveValue.cpp: Added.
3229         (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue):
3230         (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue):
3231         (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue):
3232         * css/DeprecatedCSSOMPrimitiveValue.h: Added.
3233         (WebCore::DeprecatedCSSOMPrimitiveValue::create):
3234         (WebCore::DeprecatedCSSOMPrimitiveValue::equals):
3235         (WebCore::DeprecatedCSSOMPrimitiveValue::cssValueType):
3236         (WebCore::DeprecatedCSSOMPrimitiveValue::cssText):
3237         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType):
3238         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
3239         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue):
3240         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
3241         (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue):
3242         (WebCore::DeprecatedCSSOMPrimitiveValue::stringValue):
3243         (WebCore::DeprecatedCSSOMPrimitiveValue::DeprecatedCSSOMPrimitiveValue):
3244         * css/DeprecatedCSSOMPrimitiveValue.idl: Copied from Source/WebCore/css/CSSPrimitiveValue.idl.
3245         * css/DeprecatedCSSOMRGBColor.h: Added.
3246         * css/DeprecatedCSSOMRGBColor.idl: Copied from Source/WebCore/css/RGBColor.idl.
3247         * css/DeprecatedCSSOMRect.h: Added.
3248         * css/DeprecatedCSSOMRect.idl: Copied from Source/WebCore/css/Rect.idl.
3249         * css/DeprecatedCSSOMValue.cpp: Added.
3250         (WebCore::compareCSSOMValues):
3251         (WebCore::DeprecatedCSSOMValue::equals):
3252         (WebCore::DeprecatedCSSOMValue::destroy):
3253         (WebCore::DeprecatedCSSOMValue::cssValueType):
3254         (WebCore::DeprecatedCSSOMValue::cssText):
3255         * css/DeprecatedCSSOMValue.h: Added.
3256         (WebCore::DeprecatedCSSOMValue::deref):
3257         (WebCore::DeprecatedCSSOMValue::setCssText):
3258         (WebCore::DeprecatedCSSOMValue::operator==):
3259         (WebCore::DeprecatedCSSOMValue::isComplexValue):
3260         (WebCore::DeprecatedCSSOMValue::isPrimitiveValue):
3261         (WebCore::DeprecatedCSSOMValue::isValueList):
3262         (WebCore::DeprecatedCSSOMValue::classType):
3263         (WebCore::DeprecatedCSSOMValue::DeprecatedCSSOMValue):
3264         (WebCore::DeprecatedCSSOMValue::~DeprecatedCSSOMValue):
3265         (WebCore::DeprecatedCSSOMComplexValue::create):
3266         (WebCore::DeprecatedCSSOMComplexValue::equals):
3267         (WebCore::DeprecatedCSSOMComplexValue::cssText):
3268         (WebCore::DeprecatedCSSOMComplexValue::cssValueType):
3269         (WebCore::DeprecatedCSSOMComplexValue::DeprecatedCSSOMComplexValue):
3270         * css/DeprecatedCSSOMValue.idl: Copied from Source/WebCore/css/CSSValue.idl.
3271         * css/DeprecatedCSSOMValueList.cpp: Added.
3272         (WebCore::DeprecatedCSSOMValueList::equals):
3273         (WebCore::DeprecatedCSSOMValueList::cssText):
3274         * css/DeprecatedCSSOMValueList.h: Added.
3275         (WebCore::DeprecatedCSSOMValueList::create):
3276         (WebCore::DeprecatedCSSOMValueList::cssValueType):
3277         (WebCore::DeprecatedCSSOMValueList::length):
3278         (WebCore::DeprecatedCSSOMValueList::item):
3279         (WebCore::DeprecatedCSSOMValueList::DeprecatedCSSOMValueList):
3280         * css/DeprecatedCSSOMValueList.idl: Copied from Source/WebCore/css/CSSValueList.idl.
3281         * css/LengthRepeat.h:
3282         * css/PropertySetCSSStyleDeclaration.cpp:
3283         (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
3284         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
3285         (WebCore::StyleRuleCSSStyleDeclaration::didMutate):
3286         (WebCore::InlineCSSStyleDeclaration::didMutate):
3287         (WebCore::PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM): Deleted.
3288         * css/PropertySetCSSStyleDeclaration.h:
3289         * css/RGBColor.cpp:
3290         (WebCore::RGBColor::red): Deleted.
3291         (WebCore::RGBColor::green): Deleted.
3292         (WebCore::RGBColor::blue): Deleted.
3293         (WebCore::RGBColor::alpha): Deleted.
3294         * css/RGBColor.h:
3295         * css/RGBColor.idl: Removed.
3296         * css/Rect.h:
3297         (WebCore::RectBase::RectBase):
3298         * css/Rect.idl: Removed.
3299         * svg/SVGElement.cpp:
3300         (WebCore::SVGElement::getPresentationAttribute):
3301         * svg/SVGElement.h:
3302         * svg/SVGElement.idl:
3303
3304 2016-12-17  Philippe Normand  <pnormand@igalia.com>
3305
3306         Unreviewed, rollout r209860 OWR player shouldn't be selected for normal video playback
3307
3308         * platform/GStreamer.cmake:
3309         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
3310         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
3311         (WebCore::MediaPlayerPrivateGStreamerOwr::play):
3312         (WebCore::MediaPlayerPrivateGStreamerOwr::pause):
3313         (WebCore::MediaPlayerPrivateGStreamerOwr::load):
3314         (WebCore::MediaPlayerPrivateGStreamerOwr::stop):
3315         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded):
3316         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
3317         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize):
3318         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
3319         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
3320         (WebCore::MediaEndpointOwr::createMutedRemoteSource):
3321         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Removed.
3322         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3323         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
3324         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Removed.
3325         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3326         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Removed.
3327
3328 2016-12-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3329
3330         warning: the compiler can assume that the address of 'thisObject' will always evaluate to 'true' [-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot
3331         https://bugs.webkit.org/show_bug.cgi?id=165987
3332
3333         Reviewed by Mark Lam.
3334
3335         Work around the warning by passing the JSObject pointer this function receives directly to
3336         ASSERT_GC_OBJECT_INHERITS, instead of casting it to a reference and then taking the address
3337         of that, to avoid the -Waddress warning.
3338
3339         * bindings/js/JSHTMLDocumentCustom.cpp:
3340         (WebCore::JSHTMLDocument::getOwnPropertySlot):
3341
3342 2016-12-17  Jer Noble  <jer.noble@apple.com>
3343
3344         Add implementation for navigator.requestMediaKeySystemAccess()
3345         https://bugs.webkit.org/show_bug.cgi?id=165850
3346
3347         Reviewed by Eric Carlson.
3348
3349         Test: media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html
3350
3351         Add an implementation of NavigatorEME::requestMediaKeySystemAccess() as well as the CDM
3352         object on which it depends.
3353
3354         * Modules/encryptedmedia/CDM.cpp: Added.
3355         (WebCore::cdmFactories):
3356         (WebCore::createCDMPrivateForKeySystem):
3357         (WebCore::CDM::registerCDMFactory):
3358         (WebCore::CDM::unregisterCDMFactory):
3359         (WebCore::CDM::supportsKeySystem):
3360         (WebCore::CDM::create):
3361         (WebCore::CDM::CDM):
3362         (WebCore::CDM::getSupportedConfiguration):
3363         (WebCore::CDM::doSupportedConfigurationStep):
3364         (WebCore::CDM::isPersistentType):
3365         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
3366         (WebCore::CDM::getConsentStatus):
3367         * Modules/encryptedmedia/CDM.h: Added.
3368         (WebCore::CDMFactory::~CDMFactory):
3369         (WebCore::CDM::keySystem):
3370         (WebCore::CDM::createWeakPtr):
3371         * Modules/encryptedmedia/CDMPrivate.h: Added.
3372         (WebCore::CDMPrivate::~CDMPrivate):
3373         * Modules/encryptedmedia/NavigatorEME.cpp:
3374         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
3375         (WebCore::tryNextSupportedConfiguration):
3376         * Modules/encryptedmedia/NavigatorEME.h:
3377         * Modules/encryptedmedia/NavigatorEME.idl:
3378
3379         To aid in testing, a new Internals object is added, MockCDMFactory, which can be
3380         controlled by LayoutTests to change the behavior of the Mock objects it creates.
3381
3382         * testing/Internals.cpp:
3383         (WebCore::Internals::registerMockCDM):
3384         * testing/Internals.h:
3385         * testing/Internals.idl:
3386         * testing/MockCDMFactory.cpp: Added.
3387         (WebCore::MockCDMFactory::MockCDMFactory):
3388         (WebCore::MockCDMFactory::~MockCDMFactory):
3389         (WebCore::MockCDMFactory::unregister):
3390         (WebCore::MockCDMFactory::supportsKeySystem):
3391         (WebCore::MockCDMFactory::createCDM):
3392         (WebCore::MockCDM::MockCDM):
3393         (WebCore::MockCDM::supportsInitDataType):
3394         (WebCore::MockCDM::supportsConfiguration):
3395         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
3396         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
3397         (WebCore::MockCDM::supportsRobustness):
3398         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
3399         (WebCore::MockCDM::persistentStateRequirement):
3400         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
3401         * testing/MockCDMFactory.h: Added.
3402         (WebCore::MockCDMFactory::create):
3403         (WebCore::MockCDMFactory::supportedDataTypes):
3404         (WebCore::MockCDMFactory::setSupportedDataTypes):
3405         (WebCore::MockCDMFactory::supportedRobustness):
3406         (WebCore::MockCDMFactory::setSupportedRobustness):
3407         (WebCore::MockCDMFactory::distinctiveIdentifiersRequirement):
3408         (WebCore::MockCDMFactory::setDistinctiveIdentifiersRequirement):
3409         (WebCore::MockCDMFactory::persistentStateRequirement):
3410         (WebCore::MockCDMFactory::setPersistentStateRequirement):
3411         * testing/MockCDMFactory.idl: Added.
3412
3413         Move the MediaKeySessionType definition out of the MediaKeys.idl file and into its own.
3414         Move the MediaKeysRequiriment definition out of the MediaKeySystemConfiguration.idl file
3415         and into its own. Generally fix up the .idl files so that they properly work with their
3416         implementation files.
3417
3418         * Modules/encryptedmedia/MediaKeySessionType.idl: Added.
3419         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
3420         (WebCore::MediaKeySystemAccess::create):
3421         (WebCore::MediaKeySystemAccess::MediaKeySystemAccess):
3422         (WebCore::MediaKeySystemAccess::keySystem): Deleted.
3423         (WebCore::MediaKeySystemAccess::getConfiguration): Deleted.
3424         * Modules/encryptedmedia/MediaKeySystemAccess.h:
3425         (WebCore::MediaKeySystemAccess::keySystem):
3426         (WebCore::MediaKeySystemAccess::getConfiguration):
3427         (WebCore::MediaKeySystemAccess::create): Deleted.
3428         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
3429         * Modules/encryptedmedia/MediaKeySystemConfiguration.h:
3430         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl:
3431         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl:
3432         * Modules/encryptedmedia/MediaKeys.idl:
3433         * Modules/encryptedmedia/MediaKeysRequirement.idl: Added.
3434         * Modules/encryptedmedia/MediaKeysRestrictions.h: Added.
3435         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Removed.
3436
3437         As some of these enums are referenced in the Internals project, they need to be exported
3438         from WebCore correctly. Teach the code generator how to export the symbols generated by
3439         enums.
3440
3441         * bindings/scripts/CodeGeneratorJS.pm:
3442         (GenerateEnumerationHeaderContent):
3443
3444         Add new files to the project.
3445
3446         * CMakeLists.txt:
3447         * DerivedSources.make:
3448         * WebCore.xcodeproj/project.pbxproj:
3449
3450 2016-12-17  Darin Adler  <darin@apple.com>
3451
3452         Remove WebCore::Dictionary, which is now unused
3453         https://bugs.webkit.org/show_bug.cgi?id=165988
3454
3455         Reviewed by Andreas Kling.
3456
3457         * CMakeLists.txt: Removed the files.
3458         * WebCore.xcodeproj/project.pbxproj: Ditto.
3459         * bindings/js/Dictionary.cpp: Removed.
3460         * bindings/js/Dictionary.h: Removed.
3461         * bindings/js/JSBindingsAllInOne.cpp: Removed include of Dictionary.cpp.
3462
3463 2016-12-17  Youenn Fablet  <youenn@apple.com>
3464
3465         Cloned CachedResource should not have an empty response
3466         https://bugs.webkit.org/show_bug.cgi?id=165947
3467
3468         Reviewed by Sam Weinig.
3469
3470         Test: http/tests/loading/reusing-cached-stylesheet-from-different-domain.html
3471
3472         * loader/cache/CachedResource.cpp:
3473         (WebCore::CachedResource::setBodyDataFrom): Copying the response to the cloned resource.
3474         Even though the issue is appearing for stylesheets only, it is safer to do that for all cloned ressources.
3475
3476 2016-12-16  Brady Eidson  <beidson@apple.com>
3477
3478         IndexedDB: Refactor SQLiteIDBCursor to prepare for cursor prefetching.
3479         https://bugs.webkit.org/show_bug.cgi?id=165978
3480
3481         Reviewed by Alex Christensen.
3482
3483         No new tests (Refactor, no behavior change).
3484         
3485         In preparation for cursor prefetching, we need to shift the cursor off of keeping "the current record"
3486         and onto keeping "a deque of fetched records", the first of which is "the current record".
3487         
3488         This patch does just that, but with no behavior change; The deque only ever holds 0 or 1 records.
3489
3490         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3491         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
3492         (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
3493         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
3494         (WebCore::IDBServer::SQLiteIDBCursor::prefetch):
3495         (WebCore::IDBServer::SQLiteIDBCursor::advance):
3496         (WebCore::IDBServer::SQLiteIDBCursor::fetch):
3497         (WebCore::IDBServer::SQLiteIDBCursor::fetchNextRecord):
3498         (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored):
3499         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
3500         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
3501         (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
3502         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
3503         (WebCore::IDBServer::SQLiteIDBCursor::currentValue):
3504         (WebCore::IDBServer::SQLiteIDBCursor::didComplete):
3505         (WebCore::IDBServer::SQLiteIDBCursor::didError):
3506         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID):
3507         (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique): Deleted.
3508         (WebCore::IDBServer::SQLiteIDBCursor::advanceOnce): Deleted.
3509         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Deleted.
3510         
3511         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3512         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteCursorRecord::isTerminalRecord):
3513         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): Deleted.
3514         (WebCore::IDBServer::SQLiteIDBCursor::currentKey): Deleted.
3515         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): Deleted.
3516         (WebCore::IDBServer::SQLiteIDBCursor::currentValue): Deleted.
3517         (WebCore::IDBServer::SQLiteIDBCursor::didComplete): Deleted.
3518         (WebCore::IDBServer::SQLiteIDBCursor::didError): Deleted.
3519
3520 2016-12-16  Darin Adler  <darin@apple.com>
3521
3522         Remove all custom bindings from media streams, using dictionaries instead
3523         https://bugs.webkit.org/show_bug.cgi?id=165943
3524
3525         Reviewed by Sam Weinig.
3526
3527         * CMakeLists.txt: Added and removed files.
3528         * DerivedSources.make: Ditto.
3529
3530         * Modules/mediastream/DoubleRange.h: Added. Moved dictionary here so it can be shared
3531         by both MediaStreamTrack and MediaTrackSupportedConstraints.
3532         * Modules/mediastream/DoubleRange.idl: Ditto.
3533         * Modules/mediastream/LongRange.h: Ditto.
3534         * Modules/mediastream/LongRange.idl: Ditto.
3535
3536         * Modules/mediastream/MediaDevices.cpp:
3537         (WebCore::MediaDevices::getSupportedConstraints): Changed to return a struct instead
3538         of a reference counted object.
3539         * Modules/mediastream/MediaDevices.h: Updated for the above.
3540         * Modules/mediastream/MediaDevices.idl: Added a conditional on the dictionary in this
3541         file; not needed because the conditional on the interface automatically affects the
3542         entire fiel, but for now the style seems to be to put these on all the dictionaries.
3543
3544         * Modules/mediastream/MediaSourceSettings.cpp: Removed.
3545         * Modules/mediastream/MediaSourceSettings.h: Removed.
3546
3547         * Modules/mediastream/MediaStreamTrack.cpp:
3548         (WebCore::MediaStreamTrack::getSettings): Changed to return a struct instead of a
3549         reference counted object.
3550         (WebCore::capabilityDoubleRange): Added. Helper for getCapabilities.
3551         (WebCore::capabilityIntRange): Ditto.
3552         (WebCore::capabilityStringVector): Ditto.
3553         (WebCore::capabilityBooleanVector): Ditto.
3554         (WebCore::MediaStreamTrack::getCapabilities): Changed to return a struct instead
3555         of a reference counted object.
3556         * Modules/mediastream/MediaStreamTrack.h: Updated for the above changes. Also
3557         defined the structs here in the class.
3558         * Modules/mediastream/MediaStreamTrack.idl: Defined the two dictionaries here and
3559         changed the functions to return them and not use [Custom] any more.
3560
3561         * Modules/mediastream/MediaTrackConstraints.h: Moved DoubleRange and LongRange out
3562         of this file and into their own headers. Also removed the currently unimplemented
3563         latency and channelCount; there are FIXME comments in the IDL file about eventually
3564         adding these to match the specification.
3565         * Modules/mediastream/MediaTrackConstraints.idl: Added conditionals, and removed
3566         the unimplemented latency and channelCount.
3567         style of marking everything consistently.
3568
3569         * Modules/mediastream/MediaTrackSupportedConstraints.h: Replaced this class with
3570         a struct.
3571         * Modules/mediastream/MediaTrackSupportedConstraints.idl: Replaced this interface
3572         with a dictionary.
3573
3574         * WebCore.xcodeproj/project.pbxproj: Added and removed files.
3575
3576         * bindings/js/JSMediaStreamTrackCustom.cpp: Removed.
3577         * bindings/js/JSMediaTrackSupportedConstraintsCustom.cpp: Removed.
3578
3579         * platform/mediastream/MediaStreamTrackPrivate.cpp: Removed include of the
3580         MediaSourceSettings.h header.
3581         * platform/mediastream/MediaStreamTrackPrivate.h: Removed forward declaration of
3582         the MediaSourceSettings class.
3583
3584 2016-12-16  Zalan Bujtas  <zalan@apple.com>
3585
3586         Possible nullptr dereference when applying pagination to viewport
3587         https://bugs.webkit.org/show_bug.cgi?id=165926
3588
3589         Reviewed by Simon Fraser.
3590
3591         Static analysis found a code path where a null dereference could occur.
3592         
3593         * page/FrameView.cpp:
3594         (WebCore::FrameView::applyPaginationToViewport):
3595
3596 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
3597
3598         Fix the Windows build.
3599
3600         Unreviewed build fix.
3601
3602         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
3603
3604 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
3605
3606         Yet another attempt to fix the Windows build after r209936.
3607
3608         Unreviewed build fix.
3609
3610         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
3611
3612 2016-12-16  Alex Christensen  <achristensen@webkit.org>
3613
3614         Use initEvent quirk added in r207908 for Flipboard
3615         https://bugs.webkit.org/show_bug.cgi?id=165974
3616         <rdar://problem/28264190>
3617
3618         Reviewed by Chris Dumez.
3619
3620         * dom/Event.cpp:
3621         (WebCore::Event::initEventForBindings):
3622         * platform/RuntimeApplicationChecks.h:
3623         * platform/RuntimeApplicationChecks.mm:
3624         (WebCore::IOSApplication::isFlipboard):
3625         Flipboard also has JavaScript content that calls initEvent with not enough arguments.
3626
3627 2016-12-16  Chris Dumez  <cdumez@apple.com>
3628
3629         [iOS] Align HTML from validation popover style with Copy/Paste callout bar
3630         https://bugs.webkit.org/show_bug.cgi?id=165973
3631         <rdar://problem/29336638>
3632
3633         Reviewed by Simon Fraser.
3634
3635         Tweak font size and padding of the HTML from validation popover to
3636         match the style of the Copy/Paste callout bar on iOS.
3637
3638         * platform/ios/ValidationBubbleIOS.mm:
3639         (WebCore::ValidationBubble::ValidationBubble):
3640
3641 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
3642
3643         Another attempt to fix the Windows build after r209936.
3644
3645         Unreviewed build fix.
3646
3647         * CMakeLists.txt:
3648
3649 2016-12-16  Andy Estes  <aestes@apple.com>
3650
3651         Add a setting to suppress keyboard input during provisional navigation
3652         https://bugs.webkit.org/show_bug.cgi?id=165830
3653
3654         Reviewed by Brent Fulgham.
3655
3656         Added a setting that suppresses keyboard input during provisional navigation. When the
3657         setting is enabled, DOM propogation of keyboard input events (KeyboardEvents,
3658         CompositionEvents, InputEvents, and some TextEvents) is suppressed, and text insertion is
3659         disabled in the editor.
3660
3661         Non-editing default event handling still occurs, for instance keyboard scrolling, access
3662         keys, and focus navigation.
3663
3664         Test: http/tests/navigation/keyboard-events-during-provisional-navigation.html
3665
3666         * dom/CompositionEvent.h: Added a type trait specialization.
3667         * dom/EventDispatcher.cpp:
3668         (WebCore::shouldSuppressEventDispatchInDOM): Added. Returns true if the event is trusted,
3669         FrameLoader::shouldSuppressKeyboardInput() returns true, and the event is a
3670         CompositionEvent, InputEvent, KeyboardEvent, or keyboard/composition TextEvent.
3671         (WebCore::EventDispatcher::dispatchEvent): Called stopPropogation() on the event if
3672         shouldSuppressEventDispatchInDOM() returns true.
3673         * dom/InputEvent.h: Removed the inline no-op destructor so that DataTransfer does not need
3674         to be a complete type in every translation unit that includes this header. Added a type
3675         trait specialization.
3676         * dom/TextEvent.h: Added isKeyboard() to determine if m_inputType is TextEventInputKeyboard.
3677         * editing/Editor.cpp:
3678         (WebCore::Editor::shouldInsertText): Returned false if
3679         FrameLoader::shouldSuppressKeyboardInput() returns true and the action is
3680         EditorInsertActionTyped.
3681         * loader/FrameLoader.cpp:
3682         (WebCore::FrameLoader::shouldSuppressKeyboardInput): Added. Returns true if
3683         Settings::shouldSuppressKeyboardInputDuringProvisionalNavigation() returns true and the
3684         state is FrameStateProvisional.
3685         * loader/FrameLoader.h: Declared shouldSuppressKeyboardInput().
3686         * page/EventHandler.h: Exported accessKeyModifiers().
3687         * page/Settings.in: Defined shouldSuppressKeyboardInputDuringProvisionalNavigation with an
3688         initial value of false.
3689         * testing/Internals.cpp:
3690         (WebCore::Internals::accessKeyModifiers): Added. Returns a vector of strings representing
3691         the access key modifiers.
3692         * testing/Internals.h: Declared accessKeyModifiers().
3693         * testing/Internals.idl: Exposed accessKeyModifiers() on the internals object.
3694
3695 2016-12-16  Brady Eidson  <beidson@apple.com>
3696
3697         More SQLiteIDBCursor refactoring.
3698         https://bugs.webkit.org/show_bug.cgi?id=165956
3699
3700         Reviewed by Tim Horton.
3701
3702         No new tests (No behavior change).
3703         
3704         This is a simple patch that encapsulates the current state of the cursor in one structure
3705         which will allow for storing multiple-such states in the future (to support prefetching).
3706
3707         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3708         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
3709         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
3710         (WebCore::IDBServer::SQLiteIDBCursor::advance):
3711         (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique):
3712         (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored):
3713         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
3714         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
3715         
3716         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3717         (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID):
3718         (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
3719         (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
3720         (WebCore::IDBServer::SQLiteIDBCursor::currentValue):
3721         (WebCore::IDBServer::SQLiteIDBCursor::didComplete):
3722         (WebCore::IDBServer::SQLiteIDBCursor::didError):
3723
3724 2016-12-16  Jer Noble  <jer.noble@apple.com>
3725
3726         Follow-up build fix after r209936; also rename MockCDM -> LegacyMockCDM in
3727         CMakeLists.txt.
3728
3729         * CMakeLists.txt:
3730
3731 2016-12-16  Sam Weinig  <sam@webkit.org>
3732
3733         [Bindings] Remove use of Dictionary/ArrayValue in CDMSessionClearKey
3734         https://bugs.webkit.org/show_bug.cgi?id=165961
3735
3736         Reviewed by Darin Adler.
3737
3738         * CMakeLists.txt:
3739         * WebCore.xcodeproj/project.pbxproj:
3740         * bindings/js/JSBindingsAllInOne.cpp:
3741         Remove ArrayValue.h/cpp
3742
3743         * bindings/js/ArrayValue.cpp: Removed.
3744         * bindings/js/ArrayValue.h: Removed.
3745
3746         * bindings/js/Dictionary.cpp:
3747         * bindings/js/Dictionary.h:
3748         Remove support for ArrayValue.
3749
3750         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
3751         (WebCore::CDMSessionClearKey::update):
3752         Replace use of Dictionary/ArrayValue with direct JSObject functions. This
3753         should really be replaced with a JSON parser that does not require round
3754         tripping through JavaScript objects.
3755
3756 2016-12-13  Jer Noble  <jer.noble@apple.com>
3757
3758         Move existing CDM* implementations into modules/encryptedmedia/legacy
3759         https://bugs.webkit.org/show_bug.cgi?id=165823
3760
3761         Rubber-stamped by Sam Weinig.
3762
3763         * Modules/encryptedmedia/legacy/LegacyCDM.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.cpp.
3764         (WebCore::CDMFactory::CDMFactory):
3765         (WebCore::installedCDMFactories):
3766         (WebCore::CDM::registerCDMFactory):
3767         (WebCore::CDMFactoryForKeySystem):
3768         (WebCore::CDM::supportsKeySystem):
3769         (WebCore::CDM::keySystemSupportsMimeType):
3770         (WebCore::CDM::create):
3771         (WebCore::CDM::CDM):
3772         (WebCore::CDM::~CDM):
3773         (WebCore::CDM::supportsMIMEType):
3774         (WebCore::CDM::createSession):
3775         (WebCore::CDM::mediaPlayer):
3776         * Modules/encryptedmedia/legacy/LegacyCDM.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.h.
3777         (WebCore::CDMClient::~CDMClient):
3778         (WebCore::CDM::keySystem):
3779         (WebCore::CDM::client):
3780         (WebCore::CDM::setClient):
3781         * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivate.h.
3782         (WebCore::CDMPrivateInterface::CDMPrivateInterface):
3783         (WebCore::CDMPrivateInterface::~CDMPrivateInterface):
3784         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.cpp.
3785         (WebCore::CDMPrivateClearKey::supportsKeySystem):
3786         (WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType):
3787         (WebCore::CDMPrivateClearKey::supportsMIMEType):
3788         (WebCore::CDMPrivateClearKey::createSession):
3789         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.h.
3790         (WebCore::CDMPrivateClearKey::CDMPrivateClearKey):
3791         (WebCore::CDMPrivateClearKey::~CDMPrivateClearKey):
3792         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp.
3793         (WebCore::CDMPrivateMediaPlayer::supportsKeySystem):
3794         (WebCore::CDMPrivateMediaPlayer::supportsKeySystemAndMimeType):
3795         (WebCore::CDMPrivateMediaPlayer::supportsMIMEType):
3796         (WebCore::CDMPrivateMediaPlayer::createSession):
3797         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h.
3798         (WebCore::CDMPrivateMediaPlayer::CDMPrivateMediaPlayer):
3799         (WebCore::CDMPrivateMediaPlayer::~CDMPrivateMediaPlayer):
3800         (WebCore::CDMPrivateMediaPlayer::cdm):
3801         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp.
3802         (WebCore::clearKeyVM):
3803         (WebCore::CDMSessionClearKey::CDMSessionClearKey):
3804         (WebCore::CDMSessionClearKey::~CDMSessionClearKey):
3805         (WebCore::CDMSessionClearKey::generateKeyRequest):
3806         (WebCore::CDMSessionClearKey::releaseKeys):
3807         (WebCore::CDMSessionClearKey::update):
3808         (WebCore::CDMSessionClearKey::cachedKeyForKeyID):
3809         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h.
3810         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
3811         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
3812         * WebCore.xcodeproj/project.pbxproj:
3813         * platform/graphics/LegacyCDMSession.h: Renamed from Source/WebCore/platform/graphics/CDMSession.h.
3814         (WebCore::CDMSessionClient::~CDMSessionClient):
3815         (WebCore::CDMSession::CDMSession):
3816         (WebCore::CDMSession::~CDMSession):
3817         (WebCore::CDMSession::type):
3818         (WebCore::CDMSession::cachedKeyForKeyID):
3819         * platform/graphics/MediaPlayer.h:
3820         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
3821         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
3822         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3823         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
3824         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3825         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3826         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3827         * testing/Internals.cpp:
3828         * testing/LegacyMockCDM.cpp: Renamed from Source/WebCore/testing/MockCDM.cpp.
3829         (WebCore::MockCDMSession::~MockCDMSession):
3830         (WebCore::MockCDM::supportsKeySystem):
3831         (WebCore::MockCDM::supportsKeySystemAndMimeType):
3832         (WebCore::MockCDM::supportsMIMEType):
3833         (WebCore::MockCDM::createSession):
3834         (WebCore::initDataPrefix):
3835         (WebCore::keyPrefix):
3836         (WebCore::keyRequest):
3837         (WebCore::generateSessionId):
3838         (WebCore::MockCDMSession::MockCDMSession):
3839         (WebCore::MockCDMSession::generateKeyRequest):
3840         (WebCore::MockCDMSession::releaseKeys):
3841         (WebCore::MockCDMSession::update):
3842         * testing/LegacyMockCDM.h: Renamed from Source/WebCore/testing/MockCDM.h.
3843         (WebCore::MockCDM::MockCDM):
3844         (WebCore::MockCDM::~MockCDM):
3845
3846 2016-12-16  Andreas Kling  <akling@apple.com>
3847
3848         Subframes going into page cache don't need to resetScrollbars().
3849         <https://webkit.org/b/163750>
3850         <rdar://problem/29273020>
3851
3852         Reviewed by Antti Koivisto.
3853
3854         The main frame is the only frame that switches its FrameView when using the page cache,
3855         subframes just suspend their DOM and wait around to be either killed or restored.
3856
3857         Thus there is no reason for subframes to reset their FrameView's scrollbars when going
3858         into page cache, since nothing affects them while cached, and their layout should end up
3859         identical when restoring.
3860
3861         This was causing some flakiness with subframe scrollbars jumping between different sizes
3862         in when restoring from page cache in macOS/WK1. This change makes the behavior consistent
3863         in both WK1 and WK2, and removes the flakiness.
3864
3865         * dom/Document.cpp:
3866         (WebCore::Document::setPageCacheState):
3867
3868 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3869
3870         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
3871         https://bugs.webkit.org/show_bug.cgi?id=165767
3872         <rdar://problem/29602382>
3873
3874         Reviewed by Simon Fraser.
3875
3876         When changing the layout viewport override, mark viewport-constrained objects as needing layout. If only the
3877         width and height of the old and new layout viewports are compared, EditorState info (namely selection and caret
3878         rects) that depends on the document location of fixed elements may be stale immediately after the layout
3879         viewport override changes and before layout occurs.
3880
3881         This caused one of the tests (fixed-caret-position-after-scroll.html) to occasionally fail.
3882
3883         Tests: editing/caret/ios/absolute-caret-position-after-scroll.html
3884                editing/caret/ios/fixed-caret-position-after-scroll.html
3885                editing/selection/ios/absolute-selection-after-scroll.html
3886                editing/selection/ios/fixed-selection-after-scroll.html
3887
3888         * page/FrameView.cpp:
3889         (WebCore::FrameView::setLayoutViewportOverrideRect):
3890
3891 2016-12-14  Sam Weinig  <sam@webkit.org>
3892
3893         [ApplePay] Remove remaining custom bindings from the ApplePay code
3894         https://bugs.webkit.org/show_bug.cgi?id=165860
3895
3896         Reviewed by Darin Adler.
3897
3898         * DerivedSources.make:
3899         Add new IDL files.
3900
3901         * WebCore.xcodeproj/project.pbxproj:
3902         Add/remove files.
3903
3904         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp: Removed.
3905         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp: Removed.
3906         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp: Removed.
3907         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp: Removed.
3908         Remove custom bindings.
3909
3910         * Modules/applepay/ApplePayLineItem.h: Added.
3911         * Modules/applepay/ApplePayLineItem.idl: Added.
3912         * Modules/applepay/ApplePayPayment.h: Added.
3913         * Modules/applepay/ApplePayPayment.idl: Added.
3914         * Modules/applepay/ApplePayPaymentContact.h: Added.
3915         * Modules/applepay/ApplePayPaymentContact.idl: Added.
3916         * Modules/applepay/ApplePayPaymentMethod.h: Added.
3917         * Modules/applepay/ApplePayPaymentMethod.idl: Added.
3918         * Modules/applepay/ApplePayPaymentPass.h: Added.
3919         * Modules/applepay/ApplePayPaymentPass.idl: Added.
3920         * Modules/applepay/ApplePayPaymentRequest.h: Added.
3921         * Modules/applepay/ApplePayPaymentRequest.idl: Added.
3922         * Modules/applepay/ApplePayShippingMethod.h: Added.
3923         * Modules/applepay/ApplePayShippingMethod.idl: Added.
3924         Split out dictionaries and enums into separate files where needed.
3925
3926         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
3927         (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
3928         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
3929         * Modules/applepay/ApplePayPaymentAuthorizedEvent.idl:
3930         Convert the 'payment' property to return an ApplePayPayment dictionary, removing
3931         the need for custom bindings.
3932
3933         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp:
3934         (WebCore::ApplePayPaymentMethodSelectedEvent::ApplePayPaymentMethodSelectedEvent):
3935         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
3936         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl:
3937         Convert the 'paymentMethod' property to return an ApplePayPaymentMethod dictionary, removing
3938         the need for custom bindings.
3939
3940         * Modules/applepay/ApplePaySession.cpp:
3941         (WebCore::convertAndValidate):
3942         (WebCore::ApplePaySession::create):
3943         (WebCore::ApplePaySession::ApplePaySession):
3944         (WebCore::ApplePaySession::completeShippingMethodSelection):
3945         (WebCore::ApplePaySession::completeShippingContactSelection):
3946         (WebCore::ApplePaySession::completePaymentMethodSelection):
3947         (WebCore::ApplePaySession::didSelectShippingMethod):
3948         * Modules/applepay/ApplePaySession.h:
3949         Update for new names, remove need for ExecState in the create function, and simplify
3950         billingContact and shippingContact now that they are strongly typed.
3951
3952         * Modules/applepay/ApplePaySession.idl:
3953         Move dictionaries and enums to their own files.
3954
3955         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
3956         (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
3957         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
3958         * Modules/applepay/ApplePayShippingContactSelectedEvent.idl:
3959         Convert the 'shippingContact' property to return an ApplePayPaymentContact dictionary, removing
3960         the need for custom bindings.
3961
3962         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
3963         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
3964         * Modules/applepay/ApplePayShippingMethodSelectedEvent.idl:
3965         Convert the 'shippingMethod' property to return an ApplePayShippingMethod dictionary, removing
3966         the need for custom bindings.
3967
3968         * Modules/applepay/Payment.h:
3969         * Modules/applepay/PaymentContact.h:
3970         * Modules/applepay/PaymentMethod.h:
3971         * Modules/applepay/cocoa/PaymentCocoa.mm:
3972         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3973         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
3974         Replace toJS/fromJS functions with ones that convert to/from the associated dictionary type.
3975
3976         * bindings/generic/IDLTypes.h:
3977         (WebCore::IDLJSON::nullValue):
3978         (WebCore::IDLJSON::isNullValue):
3979         (WebCore::IDLJSON::extractValueFromNullable):
3980         * bindings/js/JSDOMConvert.h:
3981         (WebCore::Converter<IDLJSON>::convert):
3982         (WebCore::JSConverter<IDLJSON>::convert):
3983         Add a new custom type, JSON, which converts from a String to a JS object.
3984
3985         * bindings/scripts/CodeGenerator.pm:
3986         * bindings/scripts/CodeGeneratorJS.pm:
3987         Add support for the new JSON type, and improve scoped naming to allow for enums
3988         in dictionary only IDL files.