fc47d30f42f982c0cf3c9129a83e47867a72ee42
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-24  Andreas Kling  <akling@apple.com>
2
3         Add memory footprint reporting using diagnostic logging.
4         <https://webkit.org/b/167285>
5         <rdar://problem/30151767>
6
7         Reviewed by Chris Dumez.
8
9         Add some basic logging of physical memory footprint post-load and post-backgrounding.
10         The logging works similarly to the CPU usage logging, though with slightly longer
11         delays to allow the measurement to stabilize.
12
13         * page/DiagnosticLoggingKeys.cpp:
14         (WebCore::DiagnosticLoggingKeys::memoryUsageKey):
15         (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey):
16         * page/DiagnosticLoggingKeys.h:
17         * page/PerformanceLogging.cpp:
18         (WebCore::PerformanceLogging::physicalFootprint):
19         * page/PerformanceLogging.h:
20         * page/PerformanceMonitor.cpp:
21         (WebCore::PerformanceMonitor::PerformanceMonitor):
22         (WebCore::PerformanceMonitor::didFinishLoad):
23         (WebCore::PerformanceMonitor::activityStateChanged):
24         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
25         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
26         * page/PerformanceMonitor.h:
27         * page/Settings.h:
28         (WebCore::Settings::isPostLoadMemoryUsageMeasurementEnabled):
29         (WebCore::Settings::isPostBackgroundingMemoryUsageMeasurementEnabled):
30         * page/cocoa/PerformanceLoggingCocoa.mm:
31         (WebCore::PerformanceLogging::physicalFootprint):
32
33 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
34
35         Remove always true unsafePluginPastingEnabled setting
36         https://bugs.webkit.org/show_bug.cgi?id=167360
37
38         Reviewed by Andreas Kling.
39
40         Setting added by Chromium and never used by other ports.
41
42         * dom/ScriptableDocumentParser.cpp:
43         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
44         * page/Settings.in:
45
46 2017-01-24  Anders Carlsson  <andersca@apple.com>
47
48         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
49         https://bugs.webkit.org/show_bug.cgi?id=167391
50         rdar://problem/29857388
51
52         Reviewed by Sam Weinig.
53
54         * page/Page.cpp:
55         (WebCore::Page::refreshPlugins):
56         Remove an unused variable.
57
58         * plugins/PluginInfoProvider.cpp:
59         (WebCore::PluginInfoProvider::refresh):
60         Make sure to call refreshPlugins(). Instead of reloading subframes, just reload all the main frames with
61         subframes that contain plug-ins.
62
63 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
64
65         Clean up Performance IDL interfaces so they are easier to read
66         https://bugs.webkit.org/show_bug.cgi?id=167378
67
68         Reviewed by Sam Weinig.
69
70         * page/Performance.idl:
71         * page/PerformanceEntry.idl:
72         * page/PerformanceMark.idl:
73         * page/PerformanceMeasure.idl:
74         Update spec links and use a typedef to match specs.
75
76         * page/PerformanceResourceTiming.cpp:
77         (WebCore::PerformanceResourceTiming::workerStart):
78         * page/PerformanceResourceTiming.h:
79         * page/PerformanceResourceTiming.idl:
80         Add the workerStart property which always returns 0 for non-workers.
81
82 2017-01-24  Zalan Bujtas  <zalan@apple.com>
83
84         Simple line layout: Add support for hyphen: auto.
85         https://bugs.webkit.org/show_bug.cgi?id=167297
86         <rdar://problem/30119463>
87
88         Reviewed by Antti Koivisto.
89
90         Implement hyphen: auto for simple line layout. 
91
92         Tests: fast/text/simple-line-hyphens-with-text-align.html
93                fast/text/simple-line-hyphens-with-word-letter-spacing.html
94
95         * platform/text/Hyphenation.h:
96         (WebCore::enoughWidthForHyphenation):
97         * rendering/RenderTreeAsText.cpp:
98         (WebCore::writeSimpleLine):
99         (WebCore::write):
100         * rendering/SimpleLineLayout.cpp:
101         (WebCore::SimpleLineLayout::canUseForStyle):
102         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Inherit the hyphen attribute from the
103         run-to-be-appended. Ensure that we don't append additional runs when the last run has hyphen.
104         (WebCore::SimpleLineLayout::splitFragmentToFitLine): Before calling into the lastHyphenPosition() we need to
105         ensure that the hyphen would surely fit (even on the splitting position).
106         (WebCore::SimpleLineLayout::createLineRuns): Probe hypenation for overhanging non-whitespace runs. 
107         (WebCore::SimpleLineLayout::printReason):
108         * rendering/SimpleLineLayout.h:
109         (WebCore::SimpleLineLayout::Run::Run):
110         * rendering/SimpleLineLayoutFlowContents.h:
111         (WebCore::SimpleLineLayout::FlowContents::Segment::toSegmentPosition):
112         (WebCore::SimpleLineLayout::FlowContents::Segment::toRenderPosition):
113         * rendering/SimpleLineLayoutResolver.cpp:
114         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
115         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded):
116         (WebCore::SimpleLineLayout::RunResolver::Run::text):
117         * rendering/SimpleLineLayoutResolver.h:
118         (WebCore::SimpleLineLayout::RunResolver::Run::hasHyphen):
119         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
120         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
121         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition):
122         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
123         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
124         (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition): We only check the actual run for hyphenation ignoring
125         the neighboring runs. This might need to be changed in the future.
126         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
127         * rendering/SimpleLineLayoutTextFragmentIterator.h:
128         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
129         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
130         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::operator==):
131         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
132         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
133         * rendering/line/BreakingContext.h:
134         (WebCore::tryHyphenating):
135
136 2017-01-24  Matt Rajca  <mrajca@apple.com>
137
138         Pass down website autoplay policies to media elements
139         https://bugs.webkit.org/show_bug.cgi?id=167355
140
141         Reviewed by Alex Christensen.
142
143         Autoplay policies can be specified at the global web view preferences level or on a per-page
144         basis during navigation. This patch ensures that policies specified on a per-page basis hold
145         precedence over global policies. If no policies are specified during navigation, global
146         policies are used. A WebsiteAutoplayPolicy::Default option has been added to let clients
147         explicitly specify web view defaults should be used.
148
149         * dom/Document.cpp:
150         (WebCore::Document::audioPlaybackRequiresUserGesture):
151         (WebCore::Document::videoPlaybackRequiresUserGesture):
152         * dom/Document.h:
153         * html/HTMLMediaElement.cpp:
154         (WebCore::HTMLMediaElement::HTMLMediaElement):
155         (WebCore::HTMLMediaElement::playInternal):
156         * loader/DocumentLoader.h:
157         (WebCore::DocumentLoader::audioPlaybackRequiresUserGesture):
158         (WebCore::DocumentLoader::setAudioPlaybackRequiresUserGesture):
159         (WebCore::DocumentLoader::videoPlaybackRequiresUserGesture):
160         (WebCore::DocumentLoader::setVideoPlaybackRequiresUserGesture):
161
162 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
163
164         Remove always true selectionIncludesAltImageText setting
165         https://bugs.webkit.org/show_bug.cgi?id=167358
166
167         Reviewed by Alex Christensen.
168
169         * editing/Editor.cpp:
170         (WebCore::Editor::selectedTextForDataTransfer):
171         * page/Settings.in:
172
173 2017-01-24  Daniel Bates  <dabates@apple.com>
174
175         StringView.split() should use an iterator design pattern instead of allocating a Vector
176         https://bugs.webkit.org/show_bug.cgi?id=163225
177
178         Reviewed by Darin Adler.
179
180         Update code to use the new iterator-style StringView.split().
181
182         * platform/URLParser.cpp:
183
184 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
185
186         Remove always true openGLMultisamplingEnabled setting
187         https://bugs.webkit.org/show_bug.cgi?id=167364
188
189         Reviewed by Sam Weinig.
190
191         * html/canvas/WebGLRenderingContextBase.cpp:
192         (WebCore::WebGLRenderingContextBase::create):
193         * page/Settings.in:
194
195 2017-01-24  Miguel Gomez  <magomez@igalia.com>
196
197         [GTK] Do not paint non composited content into the window when using the threaded compositor
198         https://bugs.webkit.org/show_bug.cgi?id=167367
199
200         Reviewed by Carlos Garcia Campos.
201
202         When using the threaded compositor we need to send the non composited content for compositing as well,
203         not painting it directly into the window.
204
205         No new tests.
206
207         * rendering/RenderLayerBacking.cpp:
208         (WebCore::RenderLayerBacking::paintsIntoWindow):
209
210 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
211
212         Remove always true allowCustomScrollbarInMainFrame setting
213         https://bugs.webkit.org/show_bug.cgi?id=167362
214
215         Reviewed by Andreas Kling.
216
217         Setting added by Chromium and never used by other ports.
218
219         * page/FrameView.cpp:
220         (WebCore::FrameView::createScrollbar):
221         * page/Settings.in:
222
223 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
224
225         Remove always true syncXHRInDocumentsEnabled setting
226         https://bugs.webkit.org/show_bug.cgi?id=167359
227
228         Reviewed by Alex Christensen.
229
230         Setting added by Chromium and never used by other ports.
231
232         * page/Settings.in:
233         * xml/XMLHttpRequest.cpp:
234         (WebCore::XMLHttpRequest::open):
235
236 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
237
238         Remove always true antialiased2dCanvasEnabled setting
239         https://bugs.webkit.org/show_bug.cgi?id=167361
240
241         Reviewed by Andreas Kling.
242
243         * html/HTMLCanvasElement.cpp:
244         (WebCore::HTMLCanvasElement::createImageBuffer):
245         * page/Settings.in:
246
247 2017-01-15  Yusuke Suzuki  <utatane.tea@gmail.com>
248
249         Add the support for nomodule attribute on script element
250         https://bugs.webkit.org/show_bug.cgi?id=166987
251
252         Reviewed by Sam Weinig.
253
254         As discussed on https://github.com/whatwg/html/pull/2261, we should have
255         the way to suppress classic script execution when our user agent have
256         modules support. With such a feature, developers can write the code like,
257
258             <script type="module" src="./app.js"></script>
259             <script nomodule src="./bundled-app.js"></script>
260
261         In the above code, if the user agent does not support modules, the bundled-app.js
262         will be executed. On the other hand, if the user agent supports modules, we should
263         ignore the script tag which has the `nomodule` attribute.
264         This way allows us to support the legacy browsers while using modules.
265
266         In WebKit, we already support modules. Thus, we should ignore the classic script
267         attributed `nomodule`.
268
269         We also rename asyncAttributeValue and deferAttributeValue to hasAsyncAttribute and
270         hasDeferAttribute.
271
272         Tests: js/dom/modules/nomodule-has-no-effect-on-module-inline.html
273                js/dom/modules/nomodule-has-no-effect-on-module-src.html
274                js/dom/modules/nomodule-prevents-execution-classic-script-inline.html
275                js/dom/modules/nomodule-prevents-execution-classic-script-src.html
276
277         * dom/ScriptElement.cpp:
278         (WebCore::ScriptElement::prepareScript):
279         * dom/ScriptElement.h:
280         * html/HTMLAttributeNames.in:
281         * html/HTMLScriptElement.cpp:
282         (WebCore::HTMLScriptElement::hasAsyncAttribute):
283         (WebCore::HTMLScriptElement::hasDeferAttribute):
284         (WebCore::HTMLScriptElement::hasNoModuleAttribute):
285         (WebCore::HTMLScriptElement::asyncAttributeValue): Deleted.
286         (WebCore::HTMLScriptElement::deferAttributeValue): Deleted.
287         * html/HTMLScriptElement.h:
288         * html/HTMLScriptElement.idl:
289         * svg/SVGScriptElement.cpp:
290         (WebCore::SVGScriptElement::hasAsyncAttribute):
291         (WebCore::SVGScriptElement::hasDeferAttribute):
292         (WebCore::SVGScriptElement::hasNoModuleAttribute):
293         (WebCore::SVGScriptElement::asyncAttributeValue): Deleted.
294         (WebCore::SVGScriptElement::deferAttributeValue): Deleted.
295         * svg/SVGScriptElement.h:
296
297 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
298
299         Web Inspector: Provide a way to trigger a Garbage Collection
300         https://bugs.webkit.org/show_bug.cgi?id=167345
301         <rdar://problem/30102853>
302
303         Reviewed by Timothy Hatcher.
304
305         * inspector/WorkerInspectorController.cpp:
306         (WebCore::WorkerInspectorController::WorkerInspectorController):
307         Include a HeapAgent so we can do Heap.gc on Workers.
308
309 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
310
311         Cleanup WEB_TIMING code
312         https://bugs.webkit.org/show_bug.cgi?id=167339
313
314         Reviewed by Alex Christensen.
315
316         Stylistic cleanup to WEB_TIMING related code.
317
318         * bindings/js/JSPerformanceEntryCustom.cpp:
319         * loader/ResourceTimingInformation.cpp:
320         * loader/ResourceTimingInformation.h:
321         * loader/SubresourceLoader.cpp:
322         (WebCore::SubresourceLoader::didFinishLoading):
323         * page/Performance.cpp:
324         (WebCore::Performance::getEntries):
325         (WebCore::Performance::getEntriesByType):
326         (WebCore::Performance::setResourceTimingBufferSize):
327         (WebCore::Performance::isResourceTimingBufferFull):
328         * page/Performance.h:
329         * page/PerformanceMark.h:
330         * page/PerformanceMeasure.h:
331         * page/PerformanceNavigation.h:
332         * page/PerformanceResourceTiming.cpp:
333         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
334         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
335         * page/PerformanceResourceTiming.h:
336         * page/PerformanceTiming.cpp:
337         (WebCore::PerformanceTiming::documentLoader):
338         (WebCore::PerformanceTiming::documentTiming):
339         (WebCore::PerformanceTiming::loadTiming):
340         * page/PerformanceTiming.h:
341         * platform/network/cf/ResourceHandleCFNet.cpp:
342         (WebCore::ResourceHandle::createCFURLConnection):
343
344 2017-01-23  Alex Christensen  <achristensen@webkit.org>
345
346         URLParser should fail to parse percent-encoded invalid UTF-8 sequences
347         https://bugs.webkit.org/show_bug.cgi?id=167330
348         <rdar://problem/29319962>
349
350         Reviewed by Tim Horton.
351
352         Covered by new API tests.
353
354         * platform/URLParser.cpp:
355         (WebCore::containsOnlyASCII):
356         (WebCore::URLParser::parseHostAndPort):
357         If UTF-8 decoding fails after percent-decoding the host, fail to parse.
358         This matches Chrome and Firefox, and it was proposed to the spec in https://github.com/whatwg/url/issues/215
359
360 2017-01-23  Alex Christensen  <achristensen@webkit.org>
361
362         Make URLs with non-special schemes and a query or fragment but no slash after the host more compatible
363         https://bugs.webkit.org/show_bug.cgi?id=167317
364         <rdar://problem/29526875>
365
366         Reviewed by Sam Weinig.
367
368         This is currently being added to the URL spec in https://github.com/whatwg/url/issues/212
369         Covered by new API tests.
370
371         * platform/URLParser.cpp:
372         (WebCore::URLParser::parse):
373         Only add a slash if there wasn't one if the URL has a special scheme.
374         This new behavior matches the old behavior of URL::parse.
375
376 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
377
378         Convert langAttributeAwareFormControlUIEnabled to a Setting
379         https://bugs.webkit.org/show_bug.cgi?id=167279
380
381         Reviewed by Sam Weinig.
382
383         * dom/Document.cpp:
384         (WebCore::Document::getCachedLocale):
385         * html/HTMLInputElement.cpp:
386         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
387         Convert to use Settings instead of RuntimeEnabledFeatures.
388
389         * page/RuntimeEnabledFeatures.h:
390         (WebCore::RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled): Deleted.
391         (WebCore::RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled): Deleted.
392         * page/Settings.in:
393         Move to Settings.
394
395         * testing/InternalSettings.cpp:
396         (WebCore::InternalSettings::Backup::Backup):
397         (WebCore::InternalSettings::Backup::restoreTo):
398         (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled): Deleted.
399         * testing/InternalSettings.h:
400         * testing/InternalSettings.idl:
401         Remove the manual interface for the RuntimeEnabledFeature.
402         An identical interface is generated from Settings.in!
403
404 2017-01-20  Anders Carlsson  <andersca@apple.com>
405
406         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
407         https://bugs.webkit.org/show_bug.cgi?id=167268
408         rdar://problem/29857388
409
410         Reviewed by Sam Weinig.
411
412         * page/Page.cpp:
413         (WebCore::Page::refreshPlugins):
414         Call PluginInfoProvider::refresh instead.
415
416         (WebCore::Page::clearPluginData):
417         Add new setter.
418
419         * page/Page.h:
420         Declare new members.
421
422         * plugins/PluginInfoProvider.cpp:
423         (WebCore::PluginInfoProvider::refresh):
424         Put the logic to clear plug-in data and reload frames here.
425
426         * plugins/PluginInfoProvider.h:
427         Add new members.
428
429 2017-01-23  Jer Noble  <jer.noble@apple.com>
430
431         REGRESSION (r208149): Video details does not apear and missing scrubber in Control Center
432         https://bugs.webkit.org/show_bug.cgi?id=167233
433
434         Reviewed by Alex Christensen.
435
436         Test: In TestWebKitAPI, NowPlayingControlsTests.NowPlayingControlsIOS
437
438         In r208149, we introduced a new media type, Video, and renamed the old type to
439         VideoAudio (to be able to distinguish between video-with-audio and silent-video).
440         But we missed one place where that type needs to be renamed.
441
442         For testing purposes, overload methods from PlatformMediaSessionManager which WebKit2 uses
443         to report the current now playing session and it's information.
444
445         * platform/audio/ios/MediaSessionManagerIOS.h:
446         * platform/audio/ios/MediaSessionManagerIOS.mm:
447         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession):
448         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
449
450 2017-01-23  Chris Dumez  <cdumez@apple.com>
451
452         REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70
453         https://bugs.webkit.org/show_bug.cgi?id=167308
454         <rdar://problem/30144964>
455
456         Unreviewed, do a partial revert of r211033 to fix assertion.
457
458         No new tests, already covered by:
459         fullscreen/exit-full-screen-iframe.html
460
461         * dom/Document.cpp:
462         (WebCore::Document::webkitExitFullscreen):
463         * page/ChromeClient.h:
464
465 2017-01-23  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
466
467         [GTK] asserting on unknown locale for hyphenation is wrong
468         https://bugs.webkit.org/show_bug.cgi?id=167312
469
470         Reviewed by Carlos Garcia Campos.
471
472         The fact that we hit the assert on a test called 'hyphenation-unknown-locale' is already
473         a strong indication we should not have it. In addition to that, Carlos Lopez pointed out
474         a similar assert was removed from the Mac codepaths when the test was introduced.
475
476         * platform/text/hyphen/HyphenationLibHyphen.cpp:
477         (WebCore::lastHyphenLocation): early return when a locale that is not available is provided
478         for hyphenation, instead of asserting.
479
480 2017-01-23  Chris Dumez  <cdumez@apple.com>
481
482         Unreviewed attempt to fix the iOS build after r211033.
483
484         * dom/Node.cpp:
485         (WebCore::Node::defaultEventHandler):
486
487 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
488
489         Remove allowWindowOpenWithoutUserGesture setting
490         https://bugs.webkit.org/show_bug.cgi?id=167301
491
492         Reviewed by Darin Adler.
493
494         * page/DOMWindow.cpp:
495         (WebCore::DOMWindow::allowPopUp):
496         * page/Settings.in:
497
498 2017-01-22  Carlos Garcia Campos  <cgarcia@igalia.com>
499
500         Database file not removed for origins after deleting all databases
501         https://bugs.webkit.org/show_bug.cgi?id=167281
502
503         Reviewed by Darin Adler.
504
505         When DatabaseTracker::deleteDatabasesModifiedSince() is called with a min time, all databases for every origin
506         are deleted. For each origin if all databases are removed DatabaseTracker::deleteOrigin() is called to remove
507         also the origin database file. However, DatabaseTracker::deleteOrigin() returns early if the origin doesn't have
508         databases and in this particular case it never has databases, because we have just removed them.
509
510         This will be covered by GTK+ unit tests.
511
512         * Modules/webdatabase/DatabaseTracker.cpp:
513         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): Instead of removing the databases while iterating
514         them, add the ones to be removed to a vector. If after the iteration all databases should be removed call
515         DatabaseTracker::deleteOrigin() to ensure both the databases and the database file are removed for the origin,
516         otherwhise call DatabaseTracker::deleteDatabase() for every database to delete.
517
518 2017-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
519
520         [GTK] Update Safari version in user agent
521         https://bugs.webkit.org/show_bug.cgi?id=167290
522
523         Reviewed by Carlos Garcia Campos.
524
525         Update Safari version from 10 to 11.
526
527         * platform/gtk/UserAgentGtk.cpp:
528         (WebCore::buildUserAgentString):
529
530 2017-01-20  Darin Adler  <darin@apple.com>
531
532         Remove PassRefPtr from "page" directory of WebCore, also deploy references
533         https://bugs.webkit.org/show_bug.cgi?id=167224
534
535         Reviewed by Chris Dumez.
536
537         * Modules/fetch/DOMWindowFetch.cpp:
538         (WebCore::DOMWindowFetch::fetch): Use DOMWindow::document instead of
539         scriptExecutionContext.
540
541         * Modules/webdatabase/DatabaseContext.cpp:
542         (WebCore::DatabaseContext::databaseExceededQuota): Pass a reference.
543
544         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
545         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
546         Pass a reference.
547
548         * bindings/js/JSDOMWindowCustom.cpp:
549         (WebCore::JSDOMWindow::getOwnPropertySlot): Pass a reference.
550
551         * dom/Document.cpp:
552         (WebCore::Document::childrenChanged): Pass a reference. Also made the
553         didReceiveDocType code unconditional instead of iOS-only.
554         (WebCore::Document::platformSuspendOrStopActiveDOMObjects): Ditto.
555         (WebCore::Document::updateViewportArguments): Ditto.
556         (WebCore::Document::setFocusedElement): Ditto.
557         (WebCore::Document::createDOMWindow): Ditto.
558         (WebCore::Document::takeDOMWindowFrom): Ditto.
559         (WebCore::Document::requestFullScreenForElement): Ditto.
560         (WebCore::Document::webkitExitFullscreen): Ditto.
561         * dom/Element.cpp:
562         (WebCore::Element::focus): Ditto.
563         (WebCore::Element::blur): Ditto.
564         (WebCore::Element::dispatchFocusEvent): Ditto.
565         (WebCore::Element::dispatchBlurEvent): Ditto.
566         * dom/Node.cpp:
567         (WebCore::Node::defaultEventHandler): Ditto.
568         * editing/EditorCommand.cpp:
569         (WebCore::executePrint): Ditto.
570         * editing/FrameSelection.cpp:
571         (WebCore::FrameSelection::setFocusedElementIfNeeded): Ditto.
572         * history/CachedFrame.cpp:
573         (WebCore::CachedFrameBase::restore): Ditto.
574         (WebCore::CachedFrame::CachedFrame): Ditto.
575         * html/ColorInputType.cpp:
576         (WebCore::ColorInputType::handleDOMActivateEvent): Ditto.
577         * html/HTMLAnchorElement.cpp:
578         (WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto.
579
580         * html/HTMLFormControlElement.cpp:
581         (WebCore::HTMLFormControlElement::isKeyboardFocusable): Pass a reference,
582         and also rewrote to use && for clarity.
583
584         * html/HTMLVideoElement.cpp:
585         (WebCore::HTMLVideoElement::supportsFullscreen): Pass a reference.
586         * html/shadow/SpinButtonElement.cpp:
587         (WebCore::SpinButtonElement::defaultEventHandler): Ditto.
588         (WebCore::SpinButtonElement::releaseCapture): Ditto.
589         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
590         (WebCore::ImageControlsButtonElementMac::defaultEventHandler): Ditto.
591         * inspector/InspectorFrontendHost.cpp:
592         (WebCore::InspectorFrontendHost::showContextMenu): Ditto.
593         (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto.
594
595         * loader/EmptyClients.cpp:
596         (WebCore::EmptyChromeClient::createPopupMenu): Updated to take reference.
597         (WebCore::EmptyChromeClient::createSearchPopupMenu): Ditto.
598         (WebCore::EmptyChromeClient::createColorChooser): Ditto.
599         * loader/EmptyClients.h: Ditto.
600
601         * loader/FrameLoader.cpp:
602         (WebCore::FrameLoader::submitForm): Pass a reference.
603         (WebCore::FrameLoader::commitProvisionalLoad): Ditto.
604         (WebCore::FrameLoader::closeAndRemoveChild): Take a reference.
605         (WebCore::FrameLoader::detachFromParent): Pass a reference.
606         (WebCore::FrameLoader::dispatchBeforeUnloadEvent): Ditto.
607         (WebCore::createWindow): Ditto.
608         * loader/FrameLoader.h: Updated for the above.
609
610         * loader/PolicyChecker.cpp:
611         (WebCore::PolicyChecker::checkNewWindowPolicy): Pass a reference.
612         * loader/appcache/ApplicationCacheGroup.cpp:
613         (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota): Ditto.
614
615         * loader/appcache/ApplicationCacheGroup.h: Return a reference from origin.
616
617         * loader/appcache/ApplicationCacheStorage.cpp:
618         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Take a reference.
619         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
620         Ditto.
621         (WebCore::ApplicationCacheStorage::store): Pass a reference.
622         (WebCore::ApplicationCacheStorage::checkOriginQuota): Updated since origin
623         now returns areference.
624         * loader/appcache/ApplicationCacheStorage.h: Updated for the above.
625
626         * loader/archive/mhtml/MHTMLArchive.cpp:
627         (WebCore::MHTMLArchive::generateMHTMLData): Pass a reference.
628         * mathml/MathMLElement.cpp:
629         (WebCore::MathMLElement::isKeyboardFocusable): Ditto.
630
631         * page/Chrome.cpp:
632         (WebCore::Chrome::Chrome): Moved initialization of data members to the
633         class definition.
634         (WebCore::Chrome::contentsSizeChanged): Take a reference.
635         (WebCore::Chrome::createWindow): Ditto.
636         (WebCore::Chrome::runBeforeUnloadConfirmPanel): Ditto.
637         (WebCore::Chrome::runJavaScriptAlert): Ditto.
638         (WebCore::Chrome::runJavaScriptConfirm): Ditto.
639         (WebCore::Chrome::runJavaScriptPrompt): Ditto.
640         (WebCore::Chrome::setStatusbarText): Ditto.
641         (WebCore::Chrome::print): Ditto.
642         (WebCore::Chrome::createColorChooser): Ditto.
643         (WebCore::Chrome::createPopupMenu): Ditto.
644         (WebCore::Chrome::createSearchPopupMenu): Ditto.
645         (WebCore::Chrome::didReceiveDocType): Ditto. Also made unconditional, but
646         empty for non-iOS platforms.
647         (WebCore::Chrome::registerPopupOpeningObserver): Take a reference.
648         (WebCore::Chrome::unregisterPopupOpeningObserver): Ditto.
649         * page/Chrome.h: Updated for the above.
650
651         * page/ChromeClient.h: Take references. Also updated some arguments from
652         Node to Element.
653
654         * page/ContextMenuController.cpp:
655         (WebCore::ContextMenuController::handleContextMenuEvent): Take a reference.
656         (WebCore::ContextMenuController::showContextMenu): Ditto.
657         (WebCore::ContextMenuController::maybeCreateContextMenu): Ditto. Also use
658         make_unique instead of unique_ptr plus new.
659         (WebCore::openNewWindow): Ditto.
660         (WebCore::insertUnicodeCharacter): Ditto.
661         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
662         (WebCore::ContextMenuController::showContextMenuAt): Ditto.
663         (WebCore::ContextMenuController::showImageControlsMenu): Ditto.
664         * page/ContextMenuController.h: Updated for the above.
665
666         * page/DOMTimer.cpp:
667         (WebCore::DOMTimer::fired): Pass a reference.
668
669         * page/DOMWindow.cpp:
670         (WebCore::PostMessageTimer::PostMessageTimer): Take Ref&& instead of
671         PassRefPtr.
672         (WebCore::DOMWindow::adjustWindowRect): Use a reference.
673         (WebCore::DOMWindow::allowPopUp): Ditto. Also rewrite to use || instead
674         of successive if statements.
675         (WebCore::DOMWindow::canShowModalDialog): Ditto.
676         (WebCore::DOMWindow::DOMWindow): Ditto.
677         (WebCore::DOMWindow::didSecureTransitionTo): Ditto.
678         (WebCore::DOMWindow::registerProperty): Ditto.
679         (WebCore::DOMWindow::unregisterProperty): Ditto.
680         (WebCore::DOMWindow::postMessageTimerFired): Merge with the function
681         immediately followed, called only from here.
682         (WebCore::DOMWindow::dispatchMessageEventWithOriginCheck): Deleted.
683         (WebCore::DOMWindow::print): Pass a reference.
684         (WebCore::DOMWindow::alert): Ditto.
685         (WebCore::DOMWindow::confirm): Ditto.
686         (WebCore::DOMWindow::prompt): Ditto.
687         (WebCore::DOMWindow::setStatus): Ditto.
688         (WebCore::DOMWindow::setDefaultStatus): Ditto.
689         (WebCore::DOMWindow::moveBy): Ditto.
690         (WebCore::DOMWindow::moveTo): Ditto.
691         (WebCore::DOMWindow::resizeBy): Ditto.
692         (WebCore::DOMWindow::resizeTo): Ditto.
693         (WebCore::DOMWindow::clearTimeout): Ditto.
694         (WebCore::DOMWindow::incrementScrollEventListenersCount): Ditto.
695         (WebCore::DOMWindow::decrementScrollEventListenersCount): Ditto.
696         (WebCore::DOMWindow::showModalDialog): Ditto.
697         * page/DOMWindow.h: Updated for the above. ALso made functions private
698         and final.
699
700         * page/DOMWindowProperty.cpp:
701         (WebCore::DOMWindowProperty::DOMWindowProperty): Pass a reference.
702         (WebCore::DOMWindowProperty::~DOMWindowProperty): Ditto.
703         (WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame): Ditto.
704         (WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame): Ditto.
705
706         * page/DebugPageOverlays.cpp:
707         (WebCore::RegionOverlay::create): Return RefPtr instead of PassRefPtr.
708         (WebCore::RegionOverlay::~RegionOverlay): Pass a reference.
709         (WebCore::DebugPageOverlays::showRegionOverlay): Ditto.
710         (WebCore::DebugPageOverlays::hideRegionOverlay): Ditto.
711
712         * page/DragController.cpp:
713         (WebCore::DragController::dragExited): Pass a reference.
714         (WebCore::DragController::performDragOperation): Ditto.
715         (WebCore::DragController::concludeEditDrag): Ditto.
716         (WebCore::DragController::tryDHTMLDrag): Ditto.
717
718         * page/EventHandler.cpp: Replaced OptionalCursor with std::optional<Cursor>.
719         (WebCore::EventHandler::updateCursor): Refactor into two functions so we
720         can share more code with selectCursor.
721         (WebCore::EventHandler::selectCursor): Updated to use std::optional.
722         (WebCore::EventHandler::handleMouseMoveEvent): Use the new updateCursor.
723         (WebCore::EventHandler::startPanScrolling): Use a reference.
724         (WebCore::EventHandler::updateDragAndDrop): Ditto.
725         (WebCore::EventHandler::cancelDragAndDrop): Ditto.
726         (WebCore::EventHandler::performDragAndDrop): Ditto.
727         (WebCore::EventHandler::setCapturingMouseEventsElement): Take a raw pointer
728         instead of a PassRefPtr.
729         (WebCore::EventHandler::dispatchMouseEvent): Use a reference.
730         (WebCore::EventHandler::updateDragStateAfterEditDragIfNeeded): Ditto.
731         (WebCore::EventHandler::isKeyboardOptionTab): Ditto.
732         (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult): Ditto.
733         (WebCore::EventHandler::tabsToLinks): Ditto.
734         * page/EventHandler.h: Updated for the above.
735
736         * page/FocusController.cpp:
737         (WebCore::FocusController::setFocusedFrame): Take pointer instead
738         of PassRefPtr.
739         (WebCore::FocusController::setFocusedElement): Take reference instead of
740         PassRefPtr.
741         * page/FocusController.h: Updated for the above changes.
742
743         * page/FrameTree.cpp:
744         (WebCore::FrameTree::transferChild): Deleted. Unused function.
745         (WebCore::FrameTree::appendChild): Merged with the following function
746         since it's now only used here. Take reference instead of PassRefPtr.
747         (WebCore::FrameTree::actuallyAppendChild): Deleted.
748         (WebCore::FrameTree::removeChild): Take reference instead of pointer.
749         Use move instead of trickier swap.
750         * page/FrameTree.h: Updated for the above.
751
752         * page/FrameView.cpp:
753         (WebCore::FrameView::setContentsSize): Use a reference.
754         * page/MainFrame.cpp:
755         (WebCore::MainFrame::dropChildren): Ditto.
756         * page/Page.cpp:
757         (WebCore::Page::scrollingCoordinator): Ditto.
758         * page/PageOverlay.cpp:
759         (WebCore::PageOverlay::fadeAnimationTimerFired): Ditto.
760
761         * page/PageOverlayController.cpp:
762         (WebCore::PageOverlayController::installPageOverlay): Take reference
763         instead of PassRefPtr.
764         (WebCore::PageOverlayController::uninstallPageOverlay): Take reference
765         intead of pointer.
766         * page/PageOverlayController.h: Updated for the above.
767
768         * page/PageSerializer.cpp:
769         (WebCore::PageSerializer::PageSerializer): Moved most initialization to the
770         class definition.
771         (WebCore::PageSerializer::serialize): Use reference.
772         (WebCore::PageSerializer::serializeFrame): Use initializer list instead of
773         constructor for resource.
774         (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
775         (WebCore::PageSerializer::addImageToResources): Ditto.
776         * page/PageSerializer.h: Removed constructors from PageSerializer::Resource
777         struct since structures don't really need them. Updated for the above.
778         Changed SerializerMarkupAccumulator into a nested class.
779
780         * page/PerformanceEntry.h:
781         (WebCore::PerformanceEntry::startTimeCompareLessThan): Use const RefPtr&
782         instead of PassRefPtr to compare RefPtr in place.
783
784         * page/PerformanceUserTiming.cpp:
785         (WebCore::insertPerformanceEntry): Take Ref&& instead of PassRefPtr.
786
787         * page/ResourceUsageOverlay.cpp:
788         (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): Use refrence.
789         (WebCore::ResourceUsageOverlay::initialize): Ditto.
790
791         * page/animation/AnimationBase.h: Removed unneeded include.
792
793         * page/animation/AnimationController.cpp:
794         (WebCore::AnimationControllerPrivate::clear): Use reference.
795         (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Ditto.
796         (WebCore::AnimationControllerPrivate::addEventToDispatch): Use the
797         append function instead of a hand-written alternative.
798         (WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
799         Take a reference rather than a Ref&& since no caller is passing ownership.
800         * page/animation/AnimationControllerPrivate.h: Updated for the above.
801
802         * page/animation/CSSPropertyAnimation.cpp:
803         (WebCore::blendFunc): Return RefPtr instead of PassRefPtr.
804         (WebCore::blendFilter): Ditto.
805         (WebCore::crossfadeBlend): Ditto.
806
807         * page/animation/CompositeAnimation.cpp:
808         (WebCore::CompositeAnimation::updateTransitions): Updated to use
809         animationForProperty, which returns a raw pointer.
810         (WebCore::CompositeAnimation::animationForProperty): Renamed from
811         getAnimationForProperty and changed to return raw pointer instead
812         of PassRefPtr.
813         * page/animation/CompositeAnimation.h: Updated for the above.
814
815         * page/animation/ImplicitAnimation.cpp:
816         (WebCore::ImplicitAnimation::onAnimationEnd): Use animationForProperty.
817         (WebCore::ImplicitAnimation::sendTransitionEvent): Pass reference.
818         * page/animation/KeyframeAnimation.cpp:
819         (WebCore::KeyframeAnimation::sendAnimationEvent): Ditto.
820
821         * page/efl/EventHandlerEfl.cpp:
822         (WebCore::EventHandler::tabsToAllFormControls): Take reference.
823         (WebCore::EventHandler::createDraggingDataTransfer): Return Ref.
824         * page/gtk/EventHandlerGtk.cpp:
825         (WebCore::EventHandler::tabsToAllFormControls): Ditto.
826         (WebCore::EventHandler::createDraggingDataTransfer): Ditto.
827         * page/ios/EventHandlerIOS.mm:
828         (WebCore::EventHandler::tabsToAllFormControls): Ditto.
829         * page/mac/EventHandlerMac.mm:
830         (WebCore::EventHandler::createDraggingDataTransfer): Ditto.
831         (WebCore::EventHandler::tabsToAllFormControls): Ditto.
832         (WebCore::EventHandler::platformPrepareForWheelEvents): Ditto.
833
834         * page/mac/ServicesOverlayController.h: Take Ref&& for ranges instead
835         of PassRefPtr. Use references.
836         * page/mac/ServicesOverlayController.mm:
837         (WebCore::ServicesOverlayController::Highlight::createForSelection): Ditto.
838         (WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Ditto.
839         (WebCore::ServicesOverlayController::Highlight::Highlight): Ditto.
840         (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): Ditto.
841         (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Ditto.
842         (WebCore::ServicesOverlayController::buildSelectionHighlight): Ditto.
843         (WebCore::ServicesOverlayController::highlightsAreEquivalent): Ditto.
844         (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Ditto.
845         (WebCore::ServicesOverlayController::handleClick): Ditto.
846
847         * page/mac/TextIndicatorWindow.mm:
848         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
849         Take a reference instead of PassRefPtr.
850         (WebCore::TextIndicatorWindow::setTextIndicator): Updated for the above.
851
852         * page/scrolling/AsyncScrollingCoordinator.h: Use Ref&& and RefPtr intead
853         of PsasRefPtr.
854
855         * page/scrolling/ScrollLatchingState.cpp:
856         (WebCore::ScrollLatchingState::ScrollLatchingState): Initialize data members
857         in class definition.
858         (WebCore::ScrollLatchingState::setWheelEventElement): Use raw pointer instead
859         of PassRefPtr.
860         (WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Use raw
861         pointer instead of RefPtr&&.
862         (WebCore::ScrollLatchingState::setScrollableContainer): Use raw pointer instead
863         of PassRefPtr.
864         * page/scrolling/ScrollLatchingState.h: Updated for the above.
865
866         * page/scrolling/ScrollingStateNode.cpp:
867         (WebCore::ScrollingStateNode::cloneAndReset): Use Ref instead of PassRefPtr.
868         (WebCore::ScrollingStateNode::appendChild): Use Ref&& instead of PassRefPtr.
869         * page/scrolling/ScrollingStateNode.h: Updated for the above.
870
871         * page/scrolling/ScrollingStateTree.cpp:
872         (WebCore::ScrollingStateTree::createNode): Use Ref instead of PassRefPtr.
873         (WebCore::ScrollingStateTree::attachNode): Updated for the abve.
874         (WebCore::ScrollingStateTree::commit): Ditto.
875         * page/scrolling/ScrollingStateTree.h: Ditto.
876
877         * page/scrolling/ScrollingTree.cpp:
878         (WebCore::ScrollingTree::updateTreeFromStateNode): Use reference.
879         * page/scrolling/ScrollingTree.h: Return Ref instead of PassRefPtr.
880
881         * page/scrolling/ScrollingTreeNode.cpp:
882         (WebCore::ScrollingTreeNode::appendChild): Take Ref&& instead of PassRefPtr.
883         (WebCore::ScrollingTreeNode::removeChild): Take reference instead of pointer.
884         * page/scrolling/ScrollingTreeNode.h: Updated for the above.
885
886         * page/scrolling/ThreadedScrollingTree.cpp:
887         (WebCore::ThreadedScrollingTree::ThreadedScrollingTree): Take reference
888         instead of pointer.
889         * page/scrolling/ThreadedScrollingTree.h: Updated for the above.
890
891         * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
892         (WebCore::ScrollingCoordinatorIOS::ScrollingCoordinatorIOS): Pass reference.
893
894         * page/scrolling/ios/ScrollingTreeIOS.cpp:
895         (WebCore::ScrollingTreeIOS::create): Take a reference.
896         (WebCore::ScrollingTreeIOS::ScrollingTreeIOS): Ditto.
897         (WebCore::ScrollingTreeIOS::createScrollingTreeNode): Return Ref instead of
898         PassRefPtr.
899         * page/scrolling/ios/ScrollingTreeIOS.h: Updated for the above.
900
901         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
902         (WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac): Use reference.
903
904         * page/scrolling/mac/ScrollingTreeMac.cpp:
905         (ScrollingTreeMac::create): Take a reference.
906         (ScrollingTreeMac::ScrollingTreeMac): Ditto.
907         (ScrollingTreeMac::createScrollingTreeNode): Return a Ref instead of a
908         PassRefPtr.
909         * page/scrolling/mac/ScrollingTreeMac.h: Updated for the above.
910
911         * page/win/EventHandlerWin.cpp:
912         (WebCore::EventHandler::tabsToAllFormControls): Take reference.
913         (WebCore::EventHandler::createDraggingDataTransfer): Return Ref.
914
915         * platform/Cursor.h: Rearranged the header a bit. Got rid of the explicit
916         copy constructor, assignment operator, and destructor. Using the ones
917         that the compiler automatically generates will work for all platforms and
918         we then also get move constructor and move assignment operator.
919
920         * platform/efl/CursorEfl.cpp:
921         (WebCore::Cursor::Cursor): Deleted.
922         (WebCore::Cursor::~Cursor): Deleted.
923         (WebCore::Cursor::operator=): Deleted.
924         * platform/gtk/CursorGtk.cpp:
925         (WebCore::Cursor::Cursor): Deleted.
926         (WebCore::Cursor::operator=): Deleted.
927         (WebCore::Cursor::~Cursor): Deleted.
928         * platform/mac/CursorMac.mm:
929         (WebCore::Cursor::Cursor): Deleted.
930         (WebCore::Cursor::operator=): Deleted.
931         (WebCore::Cursor::~Cursor): Deleted.
932         * platform/win/CursorWin.cpp:
933         (WebCore::SharedCursor::SharedCursor): Moved this here from the header
934         since it is only used within this file.
935         (WebCore::SharedCursor::create): Ditto.
936         (WebCore::Cursor::Cursor): Deleted.
937         (WebCore::Cursor::operator=): Deleted.
938         (WebCore::Cursor::~Cursor): Deleted.
939
940         * rendering/RenderEmbeddedObject.cpp:
941         (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
942         Pass reference.
943
944         * rendering/RenderLayerBacking.cpp:
945         (WebCore::RenderLayerBacking::RenderLayerBacking): Get to FrameView
946         through the render tree itself, rather than through the frame.
947
948         * rendering/RenderLayerCompositor.cpp:
949         (WebCore::RenderLayerCompositor::updateLayerForHeader): Use reference.
950         (WebCore::RenderLayerCompositor::updateLayerForFooter): Ditto.
951         (WebCore::RenderLayerCompositor::attachRootLayer): Ditto.
952         (WebCore::RenderLayerCompositor::detachRootLayer): Ditto.
953         * rendering/RenderMenuList.cpp:
954         (RenderMenuList::showPopup): Ditto.
955         * rendering/RenderSearchField.cpp:
956         (WebCore::RenderSearchField::addSearchResult): Ditto.
957         (WebCore::RenderSearchField::showPopup): Ditto.
958         (WebCore::RenderSearchField::valueChanged): Ditto.
959         * svg/SVGAElement.cpp:
960         (WebCore::SVGAElement::isKeyboardFocusable): Ditto.
961         * testing/MockPageOverlayClient.cpp:
962         (WebCore::MockPageOverlayClient::installOverlay): Ditto.
963         (WebCore::MockPageOverlayClient::uninstallAllOverlays): Ditto.
964
965 2017-01-22  Myles C. Maxfield  <mmaxfield@apple.com>
966
967         [Cocoa] Unify FontPlatformData's hashing and equality operators
968         https://bugs.webkit.org/show_bug.cgi?id=167061
969
970         Reviewed by Darin Adler.
971
972         On iOS, we were using CFEqual() and CFHash(), while on macOS
973         we were using pointer hashing and pointer equality. Instead,
974         we should be consistent about these operators.
975
976         Right now, FontPlatformData holds two internal CTFontRefs, and
977         switching to these higher-level CFEqual() and CFHash()
978         functions is required for eliminating one of these two
979         internal font objects.
980
981         No new tests because there is no behavior change.
982
983         * platform/graphics/FontPlatformData.h:
984         (WebCore::FontPlatformData::hash): Deleted.
985         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
986         (WebCore::FontPlatformData::hash):
987         (WebCore::FontPlatformData::platformIsEqual):
988         (WebCore::cascadeToLastResortAttributesDictionary):
989         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
990         (WebCore::FontPlatformData::hash):
991         * platform/graphics/win/FontPlatformDataCGWin.cpp:
992         (WebCore::FontPlatformData::hash):
993         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
994         (WebCore::FontPlatformData::hash):
995         * platform/graphics/win/FontPlatformDataDirect2D.cpp:
996         (WebCore::FontPlatformData::hash):
997
998 2017-01-20  Dean Jackson  <dino@apple.com>
999
1000         [WebGL] Do not allow GPU muxing on some old Mac hardware
1001         https://bugs.webkit.org/show_bug.cgi?id=167259
1002         <rdar://problem/30060378>
1003
1004         Reviewed by Simon Fraser and Darin Adler.
1005
1006         Some old Macbook Pro models should never use the
1007         integrated GPU for WebGL, because they are unstable
1008         when swapping between that and the discrete GPU.
1009
1010         Unfortunately this hardware configuration isn't in our
1011         testing infrastructure, so it was confirmed manually.
1012         Meanwhile, our existing tests make sure this patch
1013         doesn't break anything elsewhere.
1014
1015         * platform/graphics/mac/GraphicsContext3DMac.mm:
1016         (WebCore::attachToAppleGraphicsControl): Helper function
1017         to get a mach port that talks to Apple's Graphics Control
1018         system.
1019         (WebCore::hasMuxCapability): Decides whether a system
1020         can do live GPU switching, based on whether or not it
1021         has a muxable GPU, and if that GPU is not the old hardware
1022         we know is problematic.
1023         (WebCore::hasMuxableGPU): Helper to return the static hasMuxCapability value.
1024         (WebCore::setPixelFormat): Only request the integrated card when the
1025         GPU is muxable.
1026
1027 2017-01-22  Don Olmstead <don.olmstead@am.sony.com> and Myles C. Maxfield <mmaxfield@apple.com>
1028
1029         Introducing the Platform Abstraction Layer (PAL)
1030         https://bugs.webkit.org/show_bug.cgi?id=143358
1031
1032         Reviewed by Alex Christensen.
1033
1034         In order to enforce layering and promote testability, WebCore/platform files
1035         should be compiled in their own project. This new project can enforce layering
1036         and can be tested with unit tests in addition to layout tests.
1037
1038         The name of this new project is the Platform Abstraction Layer, or "PAL."
1039         This comprises of a new directory in WebCore which will be the destination
1040         for files migrated from WebCore/platform. This new folder, and its associated
1041         project, will maintain layering invariants. These invariants are enforced at
1042         build-time by setting the #include path for PAL to not include the rest of
1043         WebCore (which is the same layering enforcement mechanism for WTF). Files will
1044         be migrated into this new target/directory piece-by-piece, and the migration
1045         of a file will be performed as soon as it can be migrated without violating
1046         layering.
1047
1048         Within WebCore, files should include PAL files using the convention
1049         #include <pal/foo.h>. Symbols within PAL are placed within a new top-level
1050         namespace, "PAL," and therefore when used should be referred to as PAL::Foo.
1051
1052         The first set of files to move into the new platform is the crypto/ subdirectory
1053         because it is both simple but also includes platform-dependent files.
1054
1055         No new tests because there is no behavior change.
1056
1057         * CMakeLists.txt:
1058         * Configurations/WebCore.xcconfig: Add PAL to the include path
1059         * PAL/Configurations/Base.xcconfig: Added.
1060         * PAL/Configurations/DebugRelease.xcconfig: Added.
1061         * PAL/Configurations/PAL.xcconfig: Added. Sets up some PAL-specific
1062         variables.
1063         * PAL/Configurations/FeatureDefines.xcconfig: Added.
1064         * PAL/Configurations/Version.xcconfig: Added.
1065         * PAL/PAL.xcodeproj/project.pbxproj: Added. New project file.
1066         * PAL/config.h: Added. Simplified from WebCore/config.h.
1067         * PAL/pal/CMakeLists.txt: Added.
1068         * PAL/pal/PlatformEfl.cmake: Added.
1069         * PAL/pal/PlatformGTK.cmake: Added.
1070         * PAL/pal/PlatformMac.cmake: Added.
1071         * PAL/pal/PlatformWin.cmake: Added.
1072         * PAL/pal/crypto/CryptoDigest.h: Renamed from Source/WebCore/platform/crypto/CryptoDigest.h.
1073         * PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: Renamed from Source/WebCore/platform/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp.
1074         * PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp: Renamed from Source/WebCore/platform/crypto/gcrypt/CryptoDigestGCrypt.cpp.
1075         * PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp.
1076         * PAL/pal/crypto/win/CryptoDigestWin.cpp: Renamed from Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp.
1077         * PlatformEfl.cmake:
1078         * PlatformGTK.cmake:
1079         * PlatformMac.cmake:
1080         * PlatformWin.cmake:
1081         * WebCore.xcodeproj/project.pbxproj: Create a project link so WebCore
1082         knows that it needs to build PAL as a dependency.
1083         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1084         (WebCore::CryptoAlgorithmSHA1::digest): Update #include and namespace.
1085         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1086         (WebCore::CryptoAlgorithmSHA224::digest): Ditto.
1087         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1088         (WebCore::CryptoAlgorithmSHA256::digest): Ditto.
1089         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1090         (WebCore::CryptoAlgorithmSHA384::digest): Ditto.
1091         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1092         (WebCore::CryptoAlgorithmSHA512::digest): Ditto.
1093         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1094         (WebCore::cryptoDigestAlgorithm): Ditto.
1095         (WebCore::signRSASSA_PKCS1_v1_5): Ditto.
1096         (WebCore::verifyRSASSA_PKCS1_v1_5): Ditto.
1097         * inspector/InspectorDOMAgent.cpp:
1098         (WebCore::computeContentSecurityPolicySHA256Hash): Ditto.
1099         * page/csp/ContentSecurityPolicy.cpp:
1100         (WebCore::toCryptoDigestAlgorithm): Ditto.
1101         (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies): Ditto.
1102         * platform/network/soup/SoupNetworkSession.cpp:
1103         (WebCore::HostTLSCertificateSet::computeCertificateHash): Ditto.
1104
1105 2017-01-22  Zan Dobersek  <zdobersek@igalia.com>
1106
1107         [GStreamer] Clear out m_appsinkCaps in AppendPipeline::appsinkCapsChanged() before using outPtr()
1108         https://bugs.webkit.org/show_bug.cgi?id=167165
1109
1110         Reviewed by Carlos Garcia Campos.
1111
1112         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1113         (WebCore::AppendPipeline::appsinkCapsChanged): Replace the gst_caps_replace() call
1114         with a simple comparison and, in case the current appsink caps differ from the caps
1115         on the sink's pad, move the reference to the latter into the m_appsinkCaps member
1116         variable. This removes the use of GRefPtr<>::outPtr() which asserted in debug
1117         configurations in the case of m_appsinkCaps not being null.
1118
1119 2017-01-21  Chris Dumez  <cdumez@apple.com>
1120
1121         JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection)
1122         https://bugs.webkit.org/show_bug.cgi?id=167091
1123
1124         Reviewed by Darin Adler.
1125
1126         As per the Web IDL specification [1], https://heycam.github.io/webidl/#es-iterator
1127         an interface should get an iterator if it has:
1128         - an indexed property getter and an integer-typed attribute named "length".
1129
1130         We now comply with this part of the Web IDL specification. This adds an iterator
1131         to the following interfaces:
1132         - AudioTrackList, ClientRectList, CSSRuleList, CSSStyleDeclaration, CSSValueList,
1133           MimeTypeArray, WebKitNamedFlowCollection, Plugin, PluginArray, DOMStringList,
1134           FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLOptionsCollection,
1135           HTMLSelectElement, MediaList, NamedNodeMap, SourceBufferList, StyleSheetList,
1136           TextTrackCueList, TextTrackList, TouchList, VideoTrackList, VTTRegionList.
1137
1138         As a result, it is now possible to use `for ... of` for those types.
1139
1140         Tests: fast/dom/FileList-iterator.html
1141                fast/dom/collection-iterators.html
1142                fast/dom/document-all-undefined.html
1143                fast/events/touch/ios/touchlist-iterator.html
1144
1145         * bindings/scripts/CodeGeneratorJS.pm:
1146         (GetAttributeWithName):
1147         (InterfaceNeedsIterator):
1148         (GenerateImplementation):
1149         (addIterableProperties):
1150
1151 2017-01-21  Chris Dumez  <cdumez@apple.com>
1152
1153         innerText should replace existing text node
1154         https://bugs.webkit.org/show_bug.cgi?id=167116
1155
1156         Reviewed by Darin Adler.
1157
1158         Update setInnerText() to use ContainerNode::replaceAllChildren()
1159         instead of replaceChildrenWithText(). replaceAllChildren() is
1160         implemented as per specification:
1161         - https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
1162         - https://dom.spec.whatwg.org/#concept-node-replace-all
1163
1164         As a result, we now correctly remove existing children before
1165         inserting the new one.
1166
1167         No new tests, updated existing one.
1168
1169         * editing/markup.cpp:
1170         (WebCore::replaceChildrenWithText): Deleted.
1171         * editing/markup.h:
1172         * html/HTMLElement.cpp:
1173         (WebCore::HTMLElement::setInnerText):
1174
1175 2017-01-21  Chris Dumez  <cdumez@apple.com>
1176
1177         AccessibilityRenderObject::textChanged() bypasses AXLiveRegionChanged notification coalescing
1178         https://bugs.webkit.org/show_bug.cgi?id=167286
1179         <rdar://problem/30133211>
1180
1181         Reviewed by Ryosuke Niwa.
1182
1183         AccessibilityRenderObject::textChanged() bypasses AXLiveRegionChanged notification
1184         coalescing. This patch fixes the issue.
1185
1186         No new tests, updated existing test.
1187
1188         * accessibility/AccessibilityRenderObject.cpp:
1189         (WebCore::AccessibilityRenderObject::textChanged):
1190
1191 2017-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1192
1193         Unreviewed, rolling out r211012.
1194
1195         It caused a lot of crashes in the network process
1196
1197         Reverted changeset:
1198
1199         "[SOUP] Custom protocols don't work in private browsing mode"
1200         https://bugs.webkit.org/show_bug.cgi?id=167236
1201         http://trac.webkit.org/changeset/211012
1202
1203 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
1204
1205         Remove never changing IndexedDB RuntimeEnabledFeature
1206         https://bugs.webkit.org/show_bug.cgi?id=167278
1207
1208         Reviewed by Darin Adler.
1209
1210         This RuntimeEnabledFeature flag is always true and there are
1211         no existing ways to change it. So lets just remove it.
1212
1213         * Modules/indexeddb/DOMWindowIndexedDatabase.idl:
1214         * Modules/indexeddb/IDBCursor.idl:
1215         * Modules/indexeddb/IDBCursorWithValue.idl:
1216         * Modules/indexeddb/IDBDatabase.idl:
1217         * Modules/indexeddb/IDBFactory.idl:
1218         * Modules/indexeddb/IDBIndex.idl:
1219         * Modules/indexeddb/IDBKeyRange.idl:
1220         * Modules/indexeddb/IDBObjectStore.idl:
1221         * Modules/indexeddb/IDBOpenDBRequest.idl:
1222         * Modules/indexeddb/IDBRequest.idl:
1223         * Modules/indexeddb/IDBTransaction.idl:
1224         * Modules/indexeddb/IDBVersionChangeEvent.idl:
1225         * page/RuntimeEnabledFeatures.h:
1226         (WebCore::RuntimeEnabledFeatures::setIndexedDBEnabled): Deleted.
1227         (WebCore::RuntimeEnabledFeatures::indexedDBEnabled): Deleted.
1228
1229 2017-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1230
1231         [SOUP] Custom protocols don't work in private browsing mode
1232         https://bugs.webkit.org/show_bug.cgi?id=167236
1233
1234         Reviewed by Sergio Villar Senin.
1235
1236         Add static method to set the global custom protocols request type and setup method to add the feature to the session.
1237
1238         * platform/network/soup/SoupNetworkSession.cpp:
1239         (WebCore::SoupNetworkSession::SoupNetworkSession):
1240         (WebCore::SoupNetworkSession::setCustomProtocolRequestType):
1241         (WebCore::SoupNetworkSession::setupCustomProtocols):
1242         * platform/network/soup/SoupNetworkSession.h:
1243
1244 2017-01-20  Matt Rajca  <mrajca@apple.com>
1245
1246         Record whether a media element was prevented from playing without user interaction
1247         https://bugs.webkit.org/show_bug.cgi?id=167214
1248
1249         Reviewed by Eric Carlson.
1250
1251         This state will be used to notify clients when a user explicitly starts playback
1252         of a media element that was prevented from autoplaying.
1253
1254         Tests will be added after a WebKit callback API is added.
1255
1256         * WebCore.xcodeproj/project.pbxproj:
1257         * dom/SuccessOr.h: Added.
1258         (WebCore::SuccessOr::SuccessOr):
1259         (WebCore::SuccessOr::operator bool):
1260         * html/HTMLMediaElement.cpp:
1261         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay):
1262         (WebCore::HTMLMediaElement::setReadyState):
1263         (WebCore::HTMLMediaElement::play):
1264         (WebCore::HTMLMediaElement::playInternal):
1265         * html/HTMLMediaElement.h:
1266         * html/MediaElementSession.cpp:
1267         (WebCore::MediaElementSession::playbackPermitted):
1268         * html/MediaElementSession.h:
1269
1270 2017-01-20  Brady Eidson  <beidson@apple.com>
1271
1272         Require a button press on a gamepad for them to be exposed to the DOM.
1273         <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272
1274
1275         Reviewed by Alex Christensen.
1276
1277         Test: gamepad/gamepad-visibility-1.html
1278
1279         * Modules/gamepad/GamepadManager.cpp:
1280         (WebCore::GamepadManager::platformGamepadInputActivity):
1281         * Modules/gamepad/GamepadManager.h:
1282
1283         * platform/gamepad/GamepadProvider.cpp:
1284         (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity):
1285         * platform/gamepad/GamepadProvider.h:
1286         (WebCore::GamepadProvider::~GamepadProvider): Deleted.
1287         (WebCore::GamepadProvider::isMockGamepadProvider): Deleted.
1288
1289         * platform/gamepad/GamepadProviderClient.h:
1290
1291         * platform/gamepad/cocoa/GameControllerGamepad.h:
1292         * platform/gamepad/cocoa/GameControllerGamepad.mm:
1293         (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
1294         (WebCore::GameControllerGamepad::setupAsGamepad):
1295
1296         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
1297         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
1298         (WebCore::GameControllerGamepadProvider::gamepadHadInput):
1299         (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired):
1300
1301         * platform/gamepad/mac/HIDGamepad.cpp:
1302         (WebCore::HIDGamepad::valueChanged):
1303         * platform/gamepad/mac/HIDGamepad.h:
1304
1305         * platform/gamepad/mac/HIDGamepadProvider.cpp:
1306         (WebCore::HIDGamepadProvider::valuesChanged):
1307         (WebCore::HIDGamepadProvider::inputNotificationTimerFired):
1308         * platform/gamepad/mac/HIDGamepadProvider.h:
1309
1310         * testing/MockGamepadProvider.cpp:
1311         (WebCore::MockGamepadProvider::setMockGamepadButtonValue):
1312         (WebCore::MockGamepadProvider::gamepadInputActivity):
1313         * testing/MockGamepadProvider.h:
1314
1315 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
1316
1317         Cleanup RuntimeEnabledFeatures
1318         https://bugs.webkit.org/show_bug.cgi?id=167228
1319
1320         Reviewed by Simon Fraser.
1321
1322         RuntimeEnabledFeatures::reset() is bad for tests. It was getting called
1323         after the TestRunners had set up all the Settings and RuntimeEnabledFeatures
1324         they expected, so it was clearing the "consistent state" set by TestRunners.
1325
1326         Cleanup within RuntimeEnabledFeatures:
1327
1328           - Initialize all members.
1329           - Remove unused features.
1330           - Remove reset() no longer used.
1331           - Document features that do not change (potentially removable).
1332           - Document features that are not used but have APIs (use or remove later).
1333           - Drop webkit prefix for these internal only apis.
1334           - Move things around a bit to make it more readable.
1335           - Enable the Fetch API by default (WebKit levels all were enabling it).
1336
1337         Cleanup within Internals:
1338
1339           - Move all RuntimeEnabledFeature toggling to InternalSettings
1340           - Save and restore these RuntimeEnabledFeatures in InternalSettings
1341
1342         * Modules/mediastream/MediaStreamEvent.idl:
1343         * Modules/mediastream/NavigatorMediaDevices.idl:
1344         * Modules/mediastream/NavigatorUserMedia.idl:
1345         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
1346         * Modules/mediastream/RTCIceCandidate.idl:
1347         * Modules/mediastream/RTCPeerConnection.idl:
1348         * Modules/mediastream/RTCRtpReceiver.idl:
1349         * Modules/mediastream/RTCRtpSender.idl:
1350         * Modules/mediastream/RTCRtpTransceiver.idl:
1351         * Modules/mediastream/RTCSessionDescription.idl:
1352         * Modules/mediastream/RTCTrackEvent.idl:
1353         Canonical usage is to start with a capital letter.
1354
1355         * dom/EventNames.in:
1356         No port has API/SPI to disable this feature at runtime and the default is
1357         to have the feature enabled, so this is no different from the runtime flag.
1358
1359         * page/DOMWindow.cpp:
1360         (WebCore::DOMWindow::addEventListener):
1361         These features were always enabled and not toggleable. So drop the runtime
1362         feature check.
1363
1364         * page/csp/ContentSecurityPolicy.h:
1365         * page/csp/ContentSecurityPolicy.cpp:
1366         (WebCore::ContentSecurityPolicy::experimentalFeaturesEnabled): Deleted.
1367         Nobody calls this method. Drop it.
1368
1369         * page/RuntimeEnabledFeatures.cpp:
1370         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
1371         (WebCore::RuntimeEnabledFeatures::reset):
1372         (WebCore::RuntimeEnabledFeatures::javaScriptI18NAPIEnabled): Deleted.
1373         * page/RuntimeEnabledFeatures.h:
1374         (WebCore::RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled):
1375         (WebCore::RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled):
1376         (WebCore::RuntimeEnabledFeatures::setLinkPreloadEnabled):
1377         (WebCore::RuntimeEnabledFeatures::linkPreloadEnabled):
1378         (WebCore::RuntimeEnabledFeatures::setResourceTimingEnabled):
1379         (WebCore::RuntimeEnabledFeatures::resourceTimingEnabled):
1380         (WebCore::RuntimeEnabledFeatures::setShadowDOMEnabled):
1381         (WebCore::RuntimeEnabledFeatures::shadowDOMEnabled):
1382         (WebCore::RuntimeEnabledFeatures::setInputEventsEnabled):
1383         (WebCore::RuntimeEnabledFeatures::inputEventsEnabled):
1384         (WebCore::RuntimeEnabledFeatures::setInteractiveFormValidationEnabled):
1385         (WebCore::RuntimeEnabledFeatures::interactiveFormValidationEnabled):
1386         (WebCore::RuntimeEnabledFeatures::setCustomElementsEnabled):
1387         (WebCore::RuntimeEnabledFeatures::customElementsEnabled):
1388         (WebCore::RuntimeEnabledFeatures::setModernMediaControlsEnabled):
1389         (WebCore::RuntimeEnabledFeatures::modernMediaControlsEnabled):
1390         (WebCore::RuntimeEnabledFeatures::setIndexedDBEnabled):
1391         (WebCore::RuntimeEnabledFeatures::fontLoadEventsEnabled):
1392         (WebCore::RuntimeEnabledFeatures::setMediaStreamEnabled):
1393         (WebCore::RuntimeEnabledFeatures::setPeerConnectionEnabled):
1394         (WebCore::RuntimeEnabledFeatures::setLocalStorageEnabled): Deleted.
1395         (WebCore::RuntimeEnabledFeatures::localStorageEnabled): Deleted.
1396         (WebCore::RuntimeEnabledFeatures::setSessionStorageEnabled): Deleted.
1397         (WebCore::RuntimeEnabledFeatures::sessionStorageEnabled): Deleted.
1398         (WebCore::RuntimeEnabledFeatures::setWebkitNotificationsEnabled): Deleted.
1399         (WebCore::RuntimeEnabledFeatures::webkitNotificationsEnabled): Deleted.
1400         (WebCore::RuntimeEnabledFeatures::setApplicationCacheEnabled): Deleted.
1401         (WebCore::RuntimeEnabledFeatures::applicationCacheEnabled): Deleted.
1402         (WebCore::RuntimeEnabledFeatures::setDataTransferItemsEnabled): Deleted.
1403         (WebCore::RuntimeEnabledFeatures::dataTransferItemsEnabled): Deleted.
1404         (WebCore::RuntimeEnabledFeatures::setWebkitIndexedDBEnabled): Deleted.
1405         (WebCore::RuntimeEnabledFeatures::webkitIndexedDBEnabled): Deleted.
1406         (WebCore::RuntimeEnabledFeatures::touchEnabled): Deleted.
1407         (WebCore::RuntimeEnabledFeatures::setTouchEnabled): Deleted.
1408         (WebCore::RuntimeEnabledFeatures::setDeviceMotionEnabled): Deleted.
1409         (WebCore::RuntimeEnabledFeatures::deviceMotionEnabled): Deleted.
1410         (WebCore::RuntimeEnabledFeatures::deviceMotionEventEnabled): Deleted.
1411         (WebCore::RuntimeEnabledFeatures::ondevicemotionEnabled): Deleted.
1412         (WebCore::RuntimeEnabledFeatures::setDeviceOrientationEnabled): Deleted.
1413         (WebCore::RuntimeEnabledFeatures::deviceOrientationEnabled): Deleted.
1414         (WebCore::RuntimeEnabledFeatures::deviceOrientationEventEnabled): Deleted.
1415         (WebCore::RuntimeEnabledFeatures::ondeviceorientationEnabled): Deleted.
1416         (WebCore::RuntimeEnabledFeatures::setJavaScriptI18NAPIEnabled): Deleted.
1417         (WebCore::RuntimeEnabledFeatures::webkitGetUserMediaEnabled): Deleted.
1418         (WebCore::RuntimeEnabledFeatures::webkitMediaStreamEnabled): Deleted.
1419         (WebCore::RuntimeEnabledFeatures::webkitRTCPeerConnectionEnabled): Deleted.
1420         (WebCore::RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled): Deleted.
1421         (WebCore::RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled): Deleted.
1422
1423         * testing/InternalSettings.cpp:
1424         (WebCore::InternalSettings::Backup::Backup):
1425         (WebCore::InternalSettings::Backup::restoreTo):
1426         (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled):
1427         (WebCore::InternalSettings::setResourceTimingEnabled):
1428         (WebCore::InternalSettings::setLinkPreloadEnabled):
1429         (WebCore::InternalSettings::setCSSGridLayoutEnabled):
1430         (WebCore::InternalSettings::setWebGL2Enabled):
1431         * testing/InternalSettings.h:
1432         * testing/InternalSettings.idl:
1433         * testing/Internals.cpp:
1434         (WebCore::Internals::Internals):
1435         (WebCore::Internals::setLinkPreloadSupport): Deleted.
1436         (WebCore::Internals::setCSSGridLayoutEnabled): Deleted.
1437         (WebCore::Internals::webGL2Enabled): Deleted.
1438         (WebCore::Internals::setWebGL2Enabled): Deleted.
1439         (WebCore::Internals::setResourceTimingSupport): Deleted.
1440         * testing/Internals.h:
1441         * testing/Internals.idl:
1442         Move toggling of RuntimeEnabledFeatures to InternalSettings and
1443         properly remember to save and restore them in Internals.
1444
1445 2017-01-20  Alex Christensen  <achristensen@webkit.org>
1446
1447         Add debugging code to compare URLParser with URL::parse
1448         https://bugs.webkit.org/show_bug.cgi?id=167267
1449
1450         Reviewed by Brady Eidson.
1451
1452         * platform/URLParser.cpp:
1453         (WebCore::URLParser::URLParser):
1454         (WebCore::URLParser::parse):
1455
1456 2017-01-20  Ryan Haddad  <ryanhaddad@apple.com>
1457
1458         Unreviewed, rolling out r210778.
1459
1460         This change caused multiple LayoutTests to crash.
1461
1462         Reverted changeset:
1463
1464         "[Cocoa] Unify FontPlatformData's hashing and equality
1465         operators"
1466         https://bugs.webkit.org/show_bug.cgi?id=167061
1467         http://trac.webkit.org/changeset/210778
1468
1469 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
1470
1471         Remove outdated ENABLE(CSP_NEXT) build flag
1472         https://bugs.webkit.org/show_bug.cgi?id=167252
1473
1474         Reviewed by Brent Fulgham.
1475
1476         * Configurations/FeatureDefines.xcconfig:
1477         * dom/Document.idl:
1478         * page/RuntimeEnabledFeatures.cpp:
1479         (WebCore::RuntimeEnabledFeatures::reset):
1480         * page/RuntimeEnabledFeatures.h:
1481         (WebCore::RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled): Deleted.
1482         (WebCore::RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled): Deleted.
1483         * page/csp/ContentSecurityPolicy.cpp:
1484         (WebCore::ContentSecurityPolicy::experimentalFeaturesEnabled): Deleted.
1485         * page/csp/ContentSecurityPolicy.h:
1486
1487 2017-01-20  Zalan Bujtas  <zalan@apple.com>
1488
1489         Simple line layout: Add support for non-breaking space character.
1490         https://bugs.webkit.org/show_bug.cgi?id=167250
1491         <rdar://problem/30119638>
1492
1493         Reviewed by Antti Koivisto.
1494
1495         Do not bail out on noBreakSpace character.
1496         The line breaking logic already takes noBreakSpace characters into account.
1497         (except the peculiar "-webkit-nbsp-mode: space" mode)
1498
1499         Covered by existing test cases.
1500
1501         * rendering/SimpleLineLayout.cpp:
1502         (WebCore::SimpleLineLayout::canUseForText):
1503         (WebCore::SimpleLineLayout::canUseForStyle):
1504         (WebCore::SimpleLineLayout::printReason):
1505
1506 2017-01-20  Antoine Quint  <graouts@apple.com>
1507
1508         Web Animations should be off by default and enabled as an experimental feature
1509         https://bugs.webkit.org/show_bug.cgi?id=167115
1510         <rdar://problem/30048963>
1511
1512         Reviewed by Joseph Pecoraro.
1513
1514         Conditionalize the existing parts of the Web Animations API so that they may be
1515         toggled at runtime.
1516
1517         * animation/Animatable.idl:
1518         * animation/AnimationEffect.idl:
1519         * animation/AnimationTimeline.idl:
1520         * animation/DocumentAnimation.idl:
1521         * animation/DocumentTimeline.idl:
1522         * animation/KeyframeEffect.idl:
1523         * animation/WebAnimation.idl:
1524         * page/RuntimeEnabledFeatures.cpp:
1525         (WebCore::RuntimeEnabledFeatures::reset):
1526         * page/RuntimeEnabledFeatures.h:
1527
1528 2017-01-20  Antoine Quint  <graouts@apple.com>
1529
1530         [Modern Media Controls] Turn modern media controls on by default
1531         https://bugs.webkit.org/show_bug.cgi?id=165668
1532
1533         Reviewed by Dean Jackson.
1534
1535         Tests: media/modern-media-controls/fullscreen-support/ipad/fullscreen-support-tap.html
1536                media/modern-media-controls/pip-support/ipad/pip-support-enabled.html
1537                media/modern-media-controls/pip-support/ipad/pip-support-tap.html
1538                media/modern-media-controls/placard-support/ipad/placard-support-pip.html
1539                media/modern-media-controls/scrubber-support/ipad/scrubber-support-drag.html
1540
1541         Fix an error which may be triggered prior to Sierra where we would assume the presentation
1542         mode API was avaiable when it might not be, which caused a few tests to fail.
1543
1544         We also ensure that we always inject the UA styles for legacy media controls as otherwise
1545         toggling from modern media controls to legacy media controls would not inject those styles.
1546         To facilitate this we add a dedicated method for modern media controls styles in RenderTheme
1547         that is only used in the case of modern media controls when the shadow root asks for the styles
1548         to inject in the shadow root.
1549
1550         * Modules/mediacontrols/MediaControlsHost.cpp:
1551         (WebCore::MediaControlsHost::shadowRootCSSText):
1552         * Modules/modern-media-controls/media/pip-support.js:
1553         (PiPSupport.prototype.syncControl):
1554         (PiPSupport):
1555         * css/CSSDefaultStyleSheets.cpp:
1556         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
1557         * rendering/RenderTheme.h:
1558         (WebCore::RenderTheme::modernMediaControlsStyleSheet):
1559         * rendering/RenderThemeIOS.h:
1560         * rendering/RenderThemeIOS.mm:
1561         (WebCore::RenderThemeIOS::mediaControlsStyleSheet):
1562         (WebCore::RenderThemeIOS::modernMediaControlsStyleSheet):
1563         * rendering/RenderThemeMac.h:
1564         * rendering/RenderThemeMac.mm:
1565         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
1566         (WebCore::RenderThemeMac::modernMediaControlsStyleSheet):
1567
1568 2017-01-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
1569
1570         REGRESSION(r206156): Animated images are repeated one extra iteration than the value which is saved in the image file
1571         https://bugs.webkit.org/show_bug.cgi?id=167174
1572
1573         Reviewed by Simon Fraser.
1574
1575         Before r206156, BitmapImage::repetitionCount() used to return zero for
1576         the case loopCount = 1, -1 for loopCount = Infinity and loopCount for
1577         all other cases. Having repetitionCount() return zero for loopCount = 1
1578         makes the condition if (++m_repetitionsComplete > repetitionCount())
1579         break the animation loop after one iteration. But it was wrong for all
1580         loopCount > 1. It was causing an extra iteration to be played for the
1581         animated image. After r206156, BitmapImage::repetitionCount() returns
1582         loopCount for all cases loopCount != Infinity. Keeping the same condition
1583         causes the extra iteration to be played even for loopCount = 1.
1584
1585         Test: fast/images/animated-image-loop-count.html
1586
1587         * platform/graphics/BitmapImage.cpp:
1588         (WebCore::BitmapImage::internalStartAnimation):
1589
1590 2017-01-19  Chris Dumez  <cdumez@apple.com>
1591
1592         iterable<> should be enabled on WK1
1593         https://bugs.webkit.org/show_bug.cgi?id=167221
1594         <rdar://problem/30108531>
1595
1596         Reviewed by Youenn Fablet.
1597
1598         * Modules/fetch/FetchHeaders.idl:
1599         * bindings/scripts/test/JS/JSTestNode.cpp:
1600         (WebCore::JSTestNodePrototype::finishCreation):
1601         * bindings/scripts/test/JS/JSTestObj.cpp:
1602         (WebCore::JSTestObjPrototype::finishCreation):
1603         * bindings/scripts/test/TestNode.idl:
1604         * bindings/scripts/test/TestObj.idl:
1605         * css/FontFaceSet.idl:
1606         * dom/NodeList.idl:
1607
1608 2017-01-19  Zalan Bujtas  <zalan@apple.com>
1609
1610         Simple line layout: Extend coverage for justified content.
1611         https://bugs.webkit.org/show_bug.cgi?id=167219
1612         <rdar://problem/30108391>
1613
1614         Reviewed by Antti Koivisto.
1615
1616         Add support for general punctuation characters (0x2010, 0x2027) and latin characters including Extended-B.
1617
1618         Test: fast/text/simple-line-layout-with-justified-punctuation.html
1619
1620         * rendering/SimpleLineLayout.cpp:
1621         (WebCore::SimpleLineLayout::canUseForText):
1622         (WebCore::SimpleLineLayout::canUseForFontAndText):
1623
1624 2017-01-19  Alex Christensen  <achristensen@webkit.org>
1625
1626         Construct URLSearchParams from array or object
1627         https://bugs.webkit.org/show_bug.cgi?id=166973
1628
1629         Reviewed by Sam Weinig.
1630
1631         Covered by newly passing web platform tests.
1632
1633         * html/URLSearchParams.cpp:
1634         (WebCore::URLSearchParams::URLSearchParams):
1635         (WebCore::URLSearchParams::create):
1636         (WebCore::URLSearchParams::get):
1637         (WebCore::URLSearchParams::has):
1638         (WebCore::URLSearchParams::sort):
1639         (WebCore::URLSearchParams::set):
1640         (WebCore::URLSearchParams::getAll):
1641         (WebCore::URLSearchParams::remove):
1642         (WebCore::URLSearchParams::Iterator::next):
1643         * html/URLSearchParams.h:
1644         (WebCore::URLSearchParams::create):
1645         (WebCore::URLSearchParams::pairs):
1646         (WebCore::URLSearchParams::operator const Vector<std::pair<String, String>>&): Deleted.
1647         * html/URLSearchParams.idl:
1648         * platform/URLParser.cpp:
1649         (WebCore::URLParser::serialize):
1650         * platform/URLParser.h:
1651
1652 2017-01-19  Jer Noble  <jer.noble@apple.com>
1653
1654         CRASH at WebCore::TrackListBase::remove
1655         https://bugs.webkit.org/show_bug.cgi?id=167217
1656
1657         Reviewed by Brent Fulgham.
1658
1659         Test: media/media-source/media-source-error-crash.html
1660
1661         In very specific conditions, a HTMLMediaElement backed by a MediaSource can try to remove
1662         the same track from its track list twice. If there are two SourceBuffers attached to a
1663         HTMLMediaElement, and one has not yet been initialized, when the second fails to parse an
1664         appended buffer after receiving an initialization segment, the HTMLMediaElement will remove
1665         all its tracks in mediaLoadingFailed(), then MediaSource object itself will attempt remove
1666         the same track in removeSourceBuffer().
1667
1668         Solving this the safest way possible: bail early from TrackListBase if asked to remove a
1669         track which the list does not contain.
1670
1671         * html/track/TrackListBase.cpp:
1672         (TrackListBase::remove):
1673
1674 2017-01-19  Andy Estes  <aestes@apple.com>
1675
1676         [iOS] Move the PDF password view into its own class for reuse
1677         https://bugs.webkit.org/show_bug.cgi?id=167192
1678
1679         Reviewed by Tim Horton.
1680
1681         * English.lproj/Localizable.strings: Updated the failure alert strings to not be specific to PDFs.
1682
1683 2017-01-19  Chris Dumez  <cdumez@apple.com>
1684
1685         Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
1686         https://bugs.webkit.org/show_bug.cgi?id=167215
1687         <rdar://problem/29885052>
1688
1689         Reviewed by Andreas Kling.
1690
1691         Make sure HTML validation bubble gets dismissed when its associated
1692         element's frame gets detached and that we do not crash.
1693
1694         Tests: fast/forms/validation-message-detached-iframe.html
1695                fast/forms/validation-message-detached-iframe2.html
1696
1697         * dom/Document.cpp:
1698         (WebCore::Document::prepareForDestruction):
1699         * page/ValidationMessageClient.h:
1700
1701 2017-01-19  Chris Dumez  <cdumez@apple.com>
1702
1703         Implement per activity state CPU usage reporting using diagnostic logging
1704         https://bugs.webkit.org/show_bug.cgi?id=167163
1705         <rdar://problem/30058349>
1706
1707         Reviewed by Andreas Kling.
1708
1709         Implement per activity state CPU usage reporting using diagnostic logging.
1710
1711         * WebCore.xcodeproj/project.pbxproj:
1712         * page/ActivityState.h:
1713         * page/ChromeClient.h:
1714         * page/DiagnosticLoggingKeys.cpp:
1715         (WebCore::DiagnosticLoggingKeys::nonVisibleStateKey):
1716         (WebCore::DiagnosticLoggingKeys::visibleNonActiveStateKey):
1717         (WebCore::DiagnosticLoggingKeys::visibleAndActiveStateKey):
1718         (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLogginKey):
1719         (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLogginKey):
1720         * page/DiagnosticLoggingKeys.h:
1721         * page/Page.cpp:
1722         (WebCore::isUtilityPageChromeClient):
1723         (WebCore::Page::Page):
1724         (WebCore::Page::~Page):
1725         (WebCore::Page::didStartProvisionalLoad):
1726         (WebCore::Page::didFinishLoad):
1727         (WebCore::Page::isUtilityPage):
1728         (WebCore::Page::setActivityState):
1729         (WebCore::Page::setIsVisibleInternal):
1730         * page/Page.h:
1731         (WebCore::Page::activityState):
1732         (WebCore::Page::isUtilityPage):
1733         * page/PerformanceMonitor.cpp: Added.
1734         (WebCore::activityStateForCPUSampling):
1735         (WebCore::PerformanceMonitor::PerformanceMonitor):
1736         (WebCore::PerformanceMonitor::didStartProvisionalLoad):
1737         (WebCore::PerformanceMonitor::didFinishLoad):
1738         (WebCore::PerformanceMonitor::activityStateChanged):
1739         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
1740         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
1741         (WebCore::PerformanceMonitor::measurePerActivityStateCPUUsage):
1742         (WebCore::stringForCPUSamplingActivityState):
1743         (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
1744         * page/PerformanceMonitor.h: Copied from Source/WebCore/page/ActivityState.h.
1745         * page/Settings.cpp:
1746         * page/Settings.h:
1747         (WebCore::Settings::isPostLoadCPUUsageMeasurementEnabled):
1748         (WebCore::Settings::isPostBackgroundingCPUUsageMeasurementEnabled):
1749         (WebCore::Settings::isPerActivityStateCPUUsageMeasurementEnabled):
1750
1751 2017-01-19  Myles C. Maxfield  <mmaxfield@apple.com>
1752
1753         [Cocoa] Variation fonts are erroneously disabled on iOS
1754         https://bugs.webkit.org/show_bug.cgi?id=167172
1755
1756         Reviewed by Simon Fraser.
1757
1758         OpenSource builders don't seem to understand sdk=embedded*.
1759
1760         * Configurations/FeatureDefines.xcconfig:
1761
1762 2017-01-19  Ryan Haddad  <ryanhaddad@apple.com>
1763
1764         Rebaseline bindings tests after r210918.
1765
1766         Unreviewed test gardening.
1767
1768         * bindings/scripts/test/JS/JSTestObj.cpp:
1769
1770 2017-01-19  Andreas Kling  <akling@apple.com>
1771
1772         ScriptExecutionContext::topOrigin() should return a reference.
1773         <https://webkit.org/b/167190>
1774
1775         Reviewed by Sam Weinig.
1776
1777         There is always a topOrigin() SecurityOrigin, so make it return a reference
1778         and remove some unnecessary null-checks exposed by this change.
1779
1780         * Modules/applepay/ApplePaySession.cpp:
1781         (WebCore::canCallApplePaySessionAPIs):
1782         * Modules/encryptedmedia/CDM.cpp:
1783         (WebCore::CDM::getSupportedConfiguration):
1784         (WebCore::CDM::getConsentStatus):
1785         * Modules/indexeddb/IDBFactory.cpp:
1786         (WebCore::IDBFactory::openInternal):
1787         (WebCore::IDBFactory::deleteDatabase):
1788         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1789         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin):
1790         * Modules/mediastream/UserMediaRequest.cpp:
1791         (WebCore::UserMediaRequest::topLevelDocumentOrigin):
1792         (WebCore::canCallGetUserMedia):
1793         * dom/Document.h:
1794         * dom/ScriptExecutionContext.h:
1795         * html/DOMURL.cpp:
1796         (WebCore::DOMURL::revokeObjectURL):
1797         * inspector/InspectorIndexedDBAgent.cpp:
1798         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
1799         * inspector/InspectorPageAgent.cpp:
1800         (WebCore::InspectorPageAgent::cachedResource):
1801         * loader/appcache/ApplicationCacheGroup.cpp:
1802         (WebCore::ApplicationCacheGroup::selectCache):
1803         (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
1804         (WebCore::ApplicationCacheGroup::update):
1805         * loader/archive/cf/LegacyWebArchive.cpp:
1806         (WebCore::LegacyWebArchive::create):
1807         * loader/cache/CachedResourceRequest.cpp:
1808         (WebCore::CachedResourceRequest::setDomainForCachePartition):
1809         * page/SecurityOrigin.h:
1810         (WebCore::SecurityOrigin::canAccessDatabase):
1811         (WebCore::SecurityOrigin::canAccessSessionStorage):
1812         (WebCore::SecurityOrigin::canAccessPluginStorage):
1813         (WebCore::SecurityOrigin::canAccessApplicationCache):
1814         * storage/StorageNamespaceProvider.cpp:
1815         (WebCore::StorageNamespaceProvider::localStorageArea):
1816         * testing/Internals.cpp:
1817         (WebCore::Internals::isLoadingFromMemoryCache):
1818         * workers/DedicatedWorkerGlobalScope.cpp:
1819         (WebCore::DedicatedWorkerGlobalScope::create):
1820         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1821         * workers/DedicatedWorkerGlobalScope.h:
1822         * workers/DedicatedWorkerThread.cpp:
1823         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1824         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1825         * workers/DedicatedWorkerThread.h:
1826         * workers/WorkerGlobalScope.cpp:
1827         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1828         * workers/WorkerGlobalScope.h:
1829         * workers/WorkerThread.cpp:
1830         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1831         (WebCore::WorkerThread::WorkerThread):
1832         * workers/WorkerThread.h:
1833
1834 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1835
1836         [GTK] Provide API to set proxy settings
1837         https://bugs.webkit.org/show_bug.cgi?id=128674
1838
1839         Reviewed by Michael Catanzaro.
1840
1841         Add SoupNetworkProxySettings struct to store proxy settings.
1842
1843         * platform/network/soup/SoupNetworkProxySettings.h: Added.
1844         (WebCore::SoupNetworkProxySettings::SoupNetworkProxySettings):
1845         (WebCore::SoupNetworkProxySettings::operator=):
1846         (WebCore::SoupNetworkProxySettings::isEmpty):
1847         * platform/network/soup/SoupNetworkSession.cpp:
1848         (WebCore::SoupNetworkSession::SoupNetworkSession): Setup the proxy if user provided proxy settings.
1849         (WebCore::SoupNetworkSession::setupProxy): Set the proxy-resolver property of the SoupSession according to the
1850         global SoupNetworkProxySettings.
1851         (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Update the global SoupNetworkProxySettings with
1852         values from environment.
1853         (WebCore::SoupNetworkSession::setProxySettings): Set the global SoupNetworkProxySettings.
1854         * platform/network/soup/SoupNetworkSession.h:
1855
1856 2017-01-18  Sam Weinig  <sam@webkit.org>
1857
1858         [WebIDL] Records should preserve javascript object order
1859         https://bugs.webkit.org/show_bug.cgi?id=167189
1860
1861         Reviewed by Alex Christensen.
1862
1863         Instead of modeling IDL records as HashMaps, use a Vector
1864         of KeyValuePairs, to all preserving the iteration order.
1865
1866         * Modules/webdatabase/SQLResultSetRowList.cpp:
1867         (WebCore::SQLResultSetRowList::item):
1868         * Modules/webdatabase/SQLResultSetRowList.h:
1869         Return a Vector rather than a HashMap.
1870
1871         * bindings/IDLTypes.h:
1872         Change underlying type to be a Vector<KeyValuePair<K, V>>.
1873
1874         * bindings/js/JSDOMConvert.h:
1875         Update conversion for new implementation type. For conversion
1876         to JSValue, allow any type that can has an iterator of keyValuePairs.
1877  
1878         * testing/TypeConversions.h:
1879         (WebCore::TypeConversions::testLongRecord):
1880         (WebCore::TypeConversions::setTestLongRecord):
1881         (WebCore::TypeConversions::testNodeRecord):
1882         (WebCore::TypeConversions::setTestNodeRecord):
1883         (WebCore::TypeConversions::testSequenceRecord):
1884         (WebCore::TypeConversions::setTestSequenceRecord):
1885         * testing/TypeConversions.idl:
1886         Update test IDL to use functions, since the spec mandates that
1887         records can't be used with attributes.
1888
1889 2017-01-18  Alex Christensen  <achristensen@webkit.org>
1890
1891         Implement URLSearchParams's sort()
1892         https://bugs.webkit.org/show_bug.cgi?id=167154
1893
1894         Reviewed by Sam Weinig.
1895
1896         Test: imported/w3c/web-platform-tests/url/urlsearchparams-sort.html
1897
1898         * html/URLSearchParams.cpp:
1899         (WebCore::URLSearchParams::sort):
1900         * html/URLSearchParams.h:
1901         * html/URLSearchParams.idl:
1902
1903 2017-01-18  Yoav Weiss  <yoav@yoav.ws>
1904
1905         Add Link header support for preload.
1906         https://bugs.webkit.org/show_bug.cgi?id=165521
1907
1908         Reviewed by Alex Christensen.
1909
1910         This patch adds Link header support for preload, by adding a Link
1911         header parser, and calling it from FrameLoader::receivedFirstData.
1912
1913         Test: http/tests/preload/download_resources_from_header.php
1914
1915         * CMakeLists.txt: Add LinkHeader files.
1916         * WebCore.xcodeproj/project.pbxproj: Add LinkHeader files.
1917         * loader/FrameLoader.cpp:
1918         (WebCore::receivedFirstData): Trigger Link based preloading by calling loadLinksFromHeader.
1919         * loader/LinkHeader.cpp: Added.
1920         (WebCore::isWhitespace):
1921         (WebCore::isValidURLChar):
1922         (WebCore::isValidParameterNameChar):
1923         (WebCore::isValidParameterValueEnd):
1924         (WebCore::isValidParameterValueChar):
1925         (WebCore::isExtensionParameter):
1926         (WebCore::parseURL):
1927         (WebCore::invalidParameterDelimiter):
1928         (WebCore::validFieldEnd):
1929         (WebCore::parseParameterDelimiter):
1930         (WebCore::paramterNameFromString):
1931         (WebCore::parseParameterName):
1932         (WebCore::skipQuotesIfNeeded):
1933         (WebCore::parseParameterValue):
1934         (WebCore::LinkHeader::setValue):
1935         (WebCore::findNextHeader):
1936         (WebCore::LinkHeader::LinkHeader):
1937         (WebCore::LinkHeaderSet::LinkHeaderSet):
1938         (WebCore::LinkHeaderSet::init):
1939         * loader/LinkHeader.h: Added.
1940         (WebCore::LinkHeader::url):
1941         (WebCore::LinkHeader::rel):
1942         (WebCore::LinkHeader::as):
1943         (WebCore::LinkHeader::mimeType):
1944         (WebCore::LinkHeader::media):
1945         (WebCore::LinkHeader::crossOrigin):
1946         (WebCore::LinkHeader::valid):
1947         (WebCore::LinkHeaderSet::begin):
1948         (WebCore::LinkHeaderSet::end):
1949         (WebCore::LinkHeaderSet::operator[]):
1950         (WebCore::LinkHeaderSet::size):
1951         * loader/LinkLoader.cpp:
1952         (WebCore::LinkLoader::loadLinksFromHeader): Loads link preload directives that arrive from Link headers.
1953         (WebCore::LinkLoader::preloadIfNeeded): Add return value.
1954         * loader/LinkLoader.h:
1955         * platform/network/HTTPHeaderNames.in: Add "Link" as a header name.
1956
1957 2017-01-18  Filip Pizlo  <fpizlo@apple.com>
1958
1959         JSSegmentedVariableObject and its subclasses should have a sane destruction story
1960         https://bugs.webkit.org/show_bug.cgi?id=167193
1961
1962         Reviewed by Saam Barati.
1963
1964         No new tests because no new behavior.
1965         
1966         JSSegmentedVariableObjects now get to have a sane destruction story. This means switching
1967         subspace types for the DOM's global object subspace.
1968
1969         * bindings/js/WebCoreJSClientData.cpp:
1970         (WebCore::JSVMClientData::JSVMClientData):
1971         * bindings/js/WebCoreJSClientData.h:
1972         * bindings/scripts/CodeGeneratorJS.pm:
1973         (GenerateHeader):
1974
1975 2017-01-18  Ryan Haddad  <ryanhaddad@apple.com>
1976
1977         Unreviewed, rolling out r210848.
1978
1979         This change introduced media-related LayoutTest failures and
1980         crashes on macOS.
1981
1982         Reverted changeset:
1983
1984         "[Modern Media Controls] Turn modern media controls on by
1985         default"
1986         https://bugs.webkit.org/show_bug.cgi?id=165668
1987         http://trac.webkit.org/changeset/210848
1988
1989 2017-01-18  Alex Christensen  <achristensen@webkit.org>
1990
1991         Fix CFURLConnection build on Mac
1992         https://bugs.webkit.org/show_bug.cgi?id=167168
1993
1994         Reviewed by Andy Estes.
1995
1996         This is old code, and it hurts to do this, but I need this working to compare with Windows
1997         to get the ResourceHandleCFURLConnectionDelegateWithOperationQueue working so we can make
1998         loading asynchronous in WebCore.
1999
2000         * page/mac/PageMac.mm:
2001         (WebCore::Page::platformInitialize):
2002         * platform/network/cf/AuthenticationCF.cpp:
2003         * platform/network/cf/ResourceHandleCFNet.cpp:
2004         (WebCore::ResourceHandle::createCFURLConnection):
2005         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2006         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
2007         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
2008         * platform/network/cocoa/ResourceRequestCocoa.mm:
2009         (WebCore::ResourceRequest::clearOrUpdateNSURLRequest):
2010         Moved from iOS-specific file.  It's needed on Mac using CFURLConnection, too.
2011         * platform/network/ios/ResourceRequestIOS.mm:
2012         (WebCore::ResourceRequest::clearOrUpdateNSURLRequest): Deleted.
2013
2014 2017-01-18  Michael Catanzaro  <mcatanzaro@igalia.com>
2015
2016         REGRESSION(r210531): Broke local resource loads from custom local protocols
2017         https://bugs.webkit.org/show_bug.cgi?id=167058
2018
2019         Reviewed by Brent Fulgham.
2020
2021         Allow local protocols to access resources on different volumes unless the protocol is
2022         "file".
2023
2024         * page/SecurityOrigin.cpp:
2025         (WebCore::SecurityOrigin::canDisplay):
2026
2027 2017-01-18  Alex Christensen  <achristensen@webkit.org>
2028
2029         Fix CMake build.
2030
2031         * PlatformMac.cmake:
2032         * platform/spi/cocoa/IOSurfaceSPI.h:
2033
2034 2017-01-18  Myles C. Maxfield  <mmaxfield@apple.com>
2035
2036         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
2037         https://bugs.webkit.org/show_bug.cgi?id=166672
2038         <rdar://problem/29779119>
2039         <rdar://problem/29848883>
2040
2041         Reviewed by Simon Fraser.
2042
2043         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
2044         a specified variation value are rendered as if the minimum value is specified,
2045         rather than the default value. The solution is to apply default values where
2046         they are omitted.
2047
2048         Test: fast/text/variations/advances.html
2049
2050         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2051         (WebCore::defaultVariationValues):
2052         (WebCore::fontIsSystemFont):
2053         (WebCore::preparePlatformFont):
2054
2055 2017-01-18  Myles C. Maxfield  <mmaxfield@apple.com>
2056
2057         background-repeat-x doesn't work
2058         https://bugs.webkit.org/show_bug.cgi?id=166997
2059
2060         Reviewed by Simon Fraser.
2061
2062         During the creation of the new CSS parser, we accidentally forgot
2063         to hook up background-repeat-x and background-repeat-y.
2064
2065         Tests: fast/backgrounds/background-repeat-x-y-parse.html
2066                fast/backgrounds/background-repeat-x-y.html
2067
2068         * css/parser/CSSParserFastPaths.cpp:
2069         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2070
2071 2017-01-18  Andy Estes  <aestes@apple.com>
2072
2073         [QuickLook] Support password-protected documents
2074         https://bugs.webkit.org/show_bug.cgi?id=167153
2075         <rdar://problem/28544527>
2076
2077         Reviewed by Alex Christensen.
2078
2079         Added support for previewing password-protected documents. If a document is
2080         password-protected, QLPreviewConverter will call -connection:didFailWithError: with an error
2081         code of kQLReturnPasswordProtected. When this happens, QuickLookHandle will ask the client
2082         for a password, create a new QLPreviewConverter with the password specified in an options
2083         dictionary, and replay the buffered input data into the converter. QLPreviewConverter will
2084         then send the converted document data to its delegate as usual.
2085         
2086         Password entry UI will be added later; this patch implements the necessary QuickLookHandle
2087         logic and adds support for testing.
2088
2089         Test: quicklook/password-protected.html
2090
2091         * PlatformMac.cmake:
2092         * WebCore.xcodeproj/project.pbxproj:
2093         * loader/ios/QuickLook.h: Declared setClientForTesting().
2094         * loader/ios/QuickLook.mm: 
2095         (testingClient): Created a static RefPtr to hold the testing client.
2096         (testingOrEmptyClient): Returns the testing client if it's set, otherwise returns the empty client.
2097         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]):
2098         Initialized _client to testingOrEmptyClient(), stored the ResourceResponse's nsURLResponse()
2099         in _originalResponse, and initialized _bufferedDataArray.
2100         (-[WebPreviewConverter setClient:]): Ignore the new client if there is already a testing client.
2101         (-[WebPreviewConverter appendDataArray:]): Stored the data array in _bufferedDataArray.
2102         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Cleared _bufferedDataArray.
2103         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Changed the
2104         UNUSED_PARAM() to an ASSERT_UNUSED().
2105         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
2106         (-[WebPreviewConverter connection:didFailWithError:]): If the error code is
2107         kQLReturnPasswordProtected and the domain is QuickLookErrorDomain, request a password from
2108         the client then create a new QLPreviewConverter with the password specified in the options dictionary.
2109         (WebCore::QuickLookHandle::setClientForTesting): Set testingClient() to the specified client.
2110         * platform/ios/QuickLookSoftLink.h: Soft-linked kQLPreviewOptionPasswordKey.
2111         * platform/ios/QuickLookSoftLink.mm: Ditto.
2112         * platform/network/ios/QuickLookHandleClient.h:
2113         (WebCore::QuickLookHandleClient::supportsPasswordEntry): Added. Tells QuickLookHandle
2114         whether the client supports password entry.
2115         (WebCore::QuickLookHandleClient::didRequestPassword): Added. Asks the client to specify a
2116         password in the completionHandler lambda.
2117         * platform/spi/ios/QuickLookSPI.h: Declared kQLReturnPasswordProtected for the public SDK
2118         and asserted that its value is 4.
2119         * testing/Internals.cpp:
2120         (WebCore::Internals::resetToConsistentState): Reset the MockQuickLookHandleClient password
2121         to the empty string and uninstalled the testing client.
2122         (WebCore::Internals::setQuickLookPassword): Installed the testing client and set a password
2123         on the MockQuickLookHandleClient.
2124         * testing/Internals.h: 
2125         * testing/Internals.idl: Defined Internals.setQuickLookPassword().
2126         * testing/MockQuickLookHandleClient.cpp: Added.
2127         (WebCore::MockQuickLookHandleClient::singleton): Returned a shared MockQuickLookHandleClient.
2128         (WebCore::MockQuickLookHandleClient::didRequestPassword): Dispatched a lambda on the
2129         main-or-Web-thread run loop to call the completionHandler with the specified password.
2130         This simulates the delay that would happen when prompting the user for a password.
2131         * testing/MockQuickLookHandleClient.h: Added.
2132
2133 2017-01-18  Youenn Fablet  <youenn@apple.com>
2134
2135         [Streams API] ReadableStream generic reader constructor does not need to call ReadableStream getReader
2136         https://bugs.webkit.org/show_bug.cgi?id=167137
2137
2138         Reviewed by Xabier Rodriguez-Calvar.
2139
2140         Test: streams/shadowing-getReader.html
2141
2142         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2143         (WebCore::constructJSReadableStreamDefaultReader): Using private constructor instead of getReader.
2144
2145 2017-01-18  Youenn Fablet  <youenn@apple.com>
2146
2147         Reject fetch promise in case of ReadableStream upload
2148         https://bugs.webkit.org/show_bug.cgi?id=167145
2149
2150         Reviewed by Alex Christensen.
2151
2152         Covered by rebased tests.
2153
2154         * Modules/fetch/FetchBody.cpp:
2155         (WebCore::FetchBody::extract): Storing the fact that body data is represented as a ReadableStream.
2156         * Modules/fetch/FetchBody.h:
2157         (WebCore::FetchBody::isReadableStream):
2158         * Modules/fetch/FetchRequest.h:
2159         * Modules/fetch/FetchResponse.cpp:
2160         (WebCore::FetchResponse::fetch): Rejecting if request body data is a ReadableStream.
2161
2162 2017-01-18  Andreas Kling  <akling@apple.com>
2163
2164         Document::securityOrigin() should return a reference.
2165         <https://webkit.org/b/167124>
2166
2167         Reviewed by Sam Weinig.
2168
2169         The security origin is always initialized by the Document constructor
2170         through Document::initSecurityContext(), so it's effectively always present.
2171         Make it return a reference and remove unnecessary null checks exposed by this.
2172
2173         * Modules/applepay/ApplePaySession.cpp:
2174         (WebCore::canCallApplePaySessionAPIs):
2175         * Modules/encryptedmedia/CDM.cpp:
2176         (WebCore::CDM::getSupportedConfiguration):
2177         (WebCore::CDM::getConsentStatus):
2178         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2179         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2180         * Modules/mediastream/UserMediaRequest.cpp:
2181         (WebCore::canCallGetUserMedia):
2182         * Modules/webdatabase/DOMWindowWebDatabase.cpp:
2183         (WebCore::DOMWindowWebDatabase::openDatabase):
2184         * Modules/webdatabase/DatabaseContext.cpp:
2185         (WebCore::DatabaseContext::allowDatabaseAccess):
2186         * Modules/websockets/WebSocketHandshake.cpp:
2187         (WebCore::WebSocketHandshake::clientOrigin):
2188         * bindings/js/JSDOMBinding.cpp:
2189         (WebCore::canAccessDocument):
2190         * bindings/js/ScriptController.cpp:
2191         (WebCore::ScriptController::collectIsolatedContexts):
2192         * css/CSSStyleSheet.cpp:
2193         (WebCore::CSSStyleSheet::canAccessRules):
2194         * css/RuleSet.cpp:
2195         (WebCore::RuleSet::addRulesFromSheet):
2196         * css/StyleRuleImport.cpp:
2197         (WebCore::StyleRuleImport::setCSSStyleSheet):
2198         * dom/Document.cpp:
2199         (WebCore::canAccessAncestor):
2200         (WebCore::Document::findUnsafeParentScrollPropagationBoundary):
2201         (WebCore::Document::cookie):
2202         (WebCore::Document::setCookie):
2203         (WebCore::Document::origin):
2204         (WebCore::Document::domain):
2205         (WebCore::Document::setDomain):
2206         (WebCore::Document::storageBlockingStateDidChange):
2207         (WebCore::Document::initSecurityContext):
2208         (WebCore::Document::initDNSPrefetch):
2209         (WebCore::Document::topOrigin):
2210         * dom/Document.h:
2211         (WebCore::Document::securityOrigin):
2212         * dom/SecurityContext.cpp:
2213         (WebCore::SecurityContext::isSecureTransitionTo):
2214         * html/HTMLAnchorElement.cpp:
2215         (WebCore::HTMLAnchorElement::handleClick):
2216         * html/HTMLAppletElement.cpp:
2217         (WebCore::HTMLAppletElement::canEmbedJava):
2218         * html/HTMLCanvasElement.cpp:
2219         (WebCore::HTMLCanvasElement::securityOrigin):
2220         * html/HTMLLinkElement.cpp:
2221         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2222         * html/HTMLMediaElement.cpp:
2223         (WebCore::HTMLMediaElement::isSafeToLoadURL):
2224         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
2225         * html/HTMLPlugInImageElement.cpp:
2226         (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL):
2227         * inspector/InspectorDOMStorageAgent.cpp:
2228         (WebCore::InspectorDOMStorageAgent::storageId):
2229         (WebCore::InspectorDOMStorageAgent::findStorageArea):
2230         * inspector/InspectorIndexedDBAgent.cpp:
2231         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
2232         (WebCore::InspectorIndexedDBAgent::requestDatabase):
2233         (WebCore::InspectorIndexedDBAgent::requestData):
2234         (WebCore::InspectorIndexedDBAgent::clearObjectStore):
2235         * inspector/InspectorPageAgent.cpp:
2236         (WebCore::InspectorPageAgent::findFrameWithSecurityOrigin):
2237         (WebCore::InspectorPageAgent::buildObjectForFrame):
2238         * loader/DocumentLoader.cpp:
2239         (WebCore::DocumentLoader::commitData):
2240         * loader/DocumentThreadableLoader.cpp:
2241         (WebCore::DocumentThreadableLoader::loadRequest):
2242         (WebCore::DocumentThreadableLoader::securityOrigin):
2243         * loader/DocumentWriter.cpp:
2244         (WebCore::canReferToParentFrameEncoding):
2245         * loader/EmptyClients.cpp:
2246         * loader/FrameLoadRequest.cpp:
2247         (WebCore::FrameLoadRequest::FrameLoadRequest):
2248         * loader/FrameLoadRequest.h:
2249         (WebCore::FrameLoadRequest::FrameLoadRequest):
2250         * loader/FrameLoader.cpp:
2251         (WebCore::shouldClearWindowName):
2252         (WebCore::FrameLoader::outgoingOrigin):
2253         (WebCore::FrameLoader::loadURL):
2254         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
2255         * loader/FrameLoaderClient.h:
2256         * loader/MixedContentChecker.cpp:
2257         (WebCore::MixedContentChecker::isMixedContent):
2258         (WebCore::MixedContentChecker::canDisplayInsecureContent):
2259         (WebCore::MixedContentChecker::canRunInsecureContent):
2260         (WebCore::MixedContentChecker::checkFormForMixedContent):
2261         * loader/MixedContentChecker.h:
2262         * loader/NavigationScheduler.cpp:
2263         (WebCore::NavigationScheduler::scheduleRedirect):
2264         (WebCore::NavigationScheduler::scheduleLocationChange):
2265         (WebCore::NavigationScheduler::scheduleRefresh):
2266         * loader/NavigationScheduler.h:
2267         * loader/PingLoader.cpp:
2268         (WebCore::PingLoader::loadImage):
2269         (WebCore::PingLoader::sendPing):
2270         (WebCore::PingLoader::sendViolationReport):
2271         * loader/ResourceLoadInfo.cpp:
2272         (WebCore::ResourceLoadInfo::isThirdParty):
2273         * loader/ResourceLoader.cpp:
2274         (WebCore::ResourceLoader::init):
2275         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials):
2276         * loader/SubframeLoader.cpp:
2277         (WebCore::SubframeLoader::pluginIsLoadable):
2278         (WebCore::SubframeLoader::createJavaAppletWidget):
2279         (WebCore::SubframeLoader::loadSubframe):
2280         * loader/appcache/ApplicationCacheGroup.cpp:
2281         (WebCore::ApplicationCacheGroup::selectCache):
2282         (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
2283         (WebCore::ApplicationCacheGroup::update):
2284         * loader/cache/CachedResourceLoader.cpp:
2285         (WebCore::CachedResourceLoader::canRequest):
2286         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
2287         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox):
2288         * loader/cache/CachedResourceRequest.cpp:
2289         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
2290         (WebCore::CachedResourceRequest::updateForAccessControl):
2291         * loader/cache/CachedResourceRequest.h:
2292         (WebCore::CachedResourceRequest::setOrigin):
2293         * page/DOMWindow.cpp:
2294         (WebCore::DOMWindow::sessionStorage):
2295         (WebCore::DOMWindow::localStorage):
2296         (WebCore::DOMWindow::postMessage):
2297         (WebCore::DOMWindow::dispatchMessageEventWithOriginCheck):
2298         (WebCore::DOMWindow::isSameSecurityOriginAsMainFrame):
2299         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
2300         (WebCore::DOMWindow::isInsecureScriptAccess):
2301         * page/DragController.cpp:
2302         (WebCore::DragController::dragExited):
2303         (WebCore::DragController::tryDocumentDrag):
2304         (WebCore::DragController::tryDHTMLDrag):
2305         (WebCore::DragController::startDrag):
2306         * page/History.cpp:
2307         (WebCore::History::stateObjectAdded):
2308         * page/Location.cpp:
2309         (WebCore::Location::ancestorOrigins):
2310         (WebCore::Location::reload):
2311         * page/Navigator.cpp:
2312         (WebCore::Navigator::javaEnabled):
2313         * page/Page.cpp:
2314         (WebCore::Page::showAllPlugins):
2315         * page/PerformanceResourceTiming.cpp:
2316         (WebCore::passesTimingAllowCheck):
2317         * page/SecurityOrigin.cpp:
2318         (WebCore::SecurityOrigin::canAccess):
2319         (WebCore::SecurityOrigin::canRequest):
2320         (WebCore::SecurityOrigin::canReceiveDragData):
2321         (WebCore::SecurityOrigin::canAccessStorage):
2322         (WebCore::SecurityOrigin::isSameOriginAs):
2323         (WebCore::SecurityOrigin::equal):
2324         (WebCore::SecurityOrigin::isSameSchemeHostPort):
2325         * page/SecurityOrigin.h:
2326         * page/SecurityOriginData.cpp:
2327         (WebCore::SecurityOriginData::fromFrame):
2328         * page/SecurityOriginHash.h:
2329         (WebCore::SecurityOriginHash::equal):
2330         * page/csp/ContentSecurityPolicy.cpp:
2331         (WebCore::stripURLForUseInReport):
2332         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2333         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin):
2334         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2335         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
2336         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2337         (WebCore::MediaPlayerPrivateQTKit::hasSingleSecurityOrigin):
2338         * rendering/shapes/ShapeOutsideInfo.cpp:
2339         (WebCore::checkShapeImageOrigin):
2340         * replay/ReplayInputCreationMethods.cpp:
2341         (WebCore::InitialNavigation::createFromPage):
2342         * replay/ReplayInputDispatchMethods.cpp:
2343         (WebCore::InitialNavigation::dispatch):
2344         * storage/Storage.cpp:
2345         (WebCore::Storage::isDisabledByPrivateBrowsing):
2346         * storage/StorageEventDispatcher.cpp:
2347         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents):
2348         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents):
2349         * storage/StorageNamespaceProvider.cpp:
2350         (WebCore::StorageNamespaceProvider::localStorageArea):
2351         * testing/Internals.cpp:
2352         (WebCore::Internals::setApplicationCacheOriginQuota):
2353         * xml/XSLTProcessorLibxslt.cpp:
2354         (WebCore::docLoaderFunc):
2355         * xml/parser/XMLDocumentParserLibxml2.cpp:
2356         (WebCore::shouldAllowExternalLoad):
2357
2358 2017-01-18  Ryan Haddad  <ryanhaddad@apple.com>
2359
2360         Remove WEBCORE_EXPORT from newly inlined functions after r210845.
2361
2362         Unreviewed build fix.
2363
2364         * loader/DocumentLoader.h:
2365
2366 2017-01-18  Per Arne Vollan  <pvollan@apple.com>
2367
2368         Crash when changing video subtitles.
2369         https://bugs.webkit.org/show_bug.cgi?id=167159
2370
2371         Reviewed by Xabier Rodriguez-Calvar.
2372
2373         Add null pointer check.
2374
2375         * html/track/VTTCue.cpp:
2376         (WebCore::VTTCue::removeDisplayTree):
2377
2378 2017-01-18  Youenn Fablet  <youenn@apple.com>
2379
2380         [Fetch API] Update content-type in case of form data
2381         https://bugs.webkit.org/show_bug.cgi?id=167143
2382
2383         Reviewed by Alex Christensen.
2384
2385         Covered by rebased test.
2386
2387         * Modules/fetch/FetchBody.cpp:
2388         (WebCore::FetchBody::extract): Adding a space to the content-type in case of form data.
2389
2390 2017-01-18  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2391
2392         [GStreamer] media source tests crashing
2393         https://bugs.webkit.org/show_bug.cgi?id=167158
2394
2395         Reviewed by Carlos Garcia Campos.
2396
2397         This fixes several media source tests which are asserting on debug builds,
2398         such as:
2399
2400         - fast/history/page-cache-removed-source-buffer.html
2401         - imported/w3c/web-platform-tests/media-source/
2402
2403         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2404         (WebCore::AppendPipeline::AppendPipeline): do not adopt the GStPipeline
2405         upon creation. A regular assignment will do the right thing, sinking the
2406         floating ref.
2407
2408 2017-01-18  Antoine Quint  <graouts@apple.com>
2409
2410         [Modern Media Controls] Turn modern media controls on by default
2411         https://bugs.webkit.org/show_bug.cgi?id=165668
2412
2413         Reviewed by Dean Jackson.
2414
2415         Tests: media/modern-media-controls/fullscreen-support/ipad/fullscreen-support-tap.html
2416                media/modern-media-controls/pip-support/ipad/pip-support-enabled.html
2417                media/modern-media-controls/pip-support/ipad/pip-support-tap.html
2418                media/modern-media-controls/placard-support/ipad/placard-support-pip.html
2419                media/modern-media-controls/scrubber-support/ipad/scrubber-support-drag.html
2420
2421         Fix an error which may be triggered prior to Sierra where we would assume the presentation
2422         mode API was avaiable when it might not be, which caused a few tests to fail.
2423
2424         * Modules/modern-media-controls/media/pip-support.js:
2425         (PiPSupport.prototype.syncControl):
2426         (PiPSupport):
2427
2428 2017-01-18  Miguel Gomez  <magomez@igalia.com>
2429
2430         [GTK] [TextureMapper] [GLES2] Draw repeated patterns for NPOT textures manually
2431         https://bugs.webkit.org/show_bug.cgi?id=167118
2432
2433         Reviewed by Žan Doberšek.
2434
2435         When using GLES2 without the GL_OES_texture_npot extension, some implementations fail to properly
2436         draw repeated patters from a texture (using GL_REPEAT). For those cases, perform the repetition
2437         manually using the shader.
2438
2439         Covered by existent tests.
2440
2441         * platform/graphics/texmap/TextureMapperGL.cpp:
2442         (WebCore::driverSupportsNPOTTextures):
2443         (WebCore::TextureMapperGL::drawTexture):
2444         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
2445         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2446         (WebCore::TextureMapperShaderProgram::create):
2447         * platform/graphics/texmap/TextureMapperShaderProgram.h:
2448
2449 2017-01-15  Darin Adler  <darin@apple.com>
2450
2451         Remove PassRefPtr from "loader" directory of WebCore
2452         https://bugs.webkit.org/show_bug.cgi?id=167055
2453
2454         Reviewed by Alex Christensen.
2455
2456         * dom/Document.cpp:
2457         (WebCore::Document::processHttpEquiv): Pass a reference.
2458         * editing/CompositeEditCommand.cpp:
2459         (WebCore::EditCommandComposition::unapply): Ditto.
2460         (WebCore::EditCommandComposition::reapply): Ditto.
2461         (WebCore::CompositeEditCommand::ensureComposition): Return a reference.
2462         (WebCore::CompositeEditCommand::applyCommandToComposite): Use a reference.
2463         * editing/CompositeEditCommand.h: Updated for above changes.
2464
2465         * editing/Editor.cpp:
2466         (WebCore::Editor::unappliedEditing): Take a reference instead of a PassRefPtr.
2467         (WebCore::Editor::reappliedEditing): Ditto.
2468         * editing/Editor.h: Updated for above changes. Also changed the
2469         FragmentAndResources resources vector to hold Ref instead of RefPtr.
2470
2471         * editing/cocoa/EditorCocoa.mm:
2472         (WebCore::Editor::createFragmentAndAddResources): Updated for change to
2473         FragmentAndResources.
2474
2475         * editing/ios/EditorIOS.mm:
2476         (WebCore::Editor::WebContentReader::readWebArchive): Pass a reference.
2477
2478         * editing/mac/EditorMac.mm:
2479         (WebCore::Editor::WebContentReader::readWebArchive): Pass a reference.
2480
2481         * history/PageCache.cpp:
2482         (WebCore::canCacheFrame): Use a reference.
2483
2484         * html/FileInputType.cpp:
2485         (WebCore::FileInputType::handleDOMActivateEvent): Pass references.
2486
2487         * html/HTMLFormControlElement.cpp:
2488         (WebCore::HTMLFormControlElement::formMethod): Use auto.
2489
2490         * html/HTMLFormElement.cpp:
2491         (WebCore::HTMLFormElement::prepareForSubmission): Updated to use a return
2492         values for textFieldValues intsead of an out argument with getTextFieldValues.
2493         (WebCore::HTMLFormElement::textFieldValues): Renamed from getTextFieldValues
2494         and changed to use a return value instead of an out argument.
2495         (WebCore::HTMLFormElement::submit): Pass a reference.
2496         (WebCore::HTMLFormElement::requestAutocomplete): Pass a Ref&&.
2497         * html/HTMLFormElement.h: Updated for above changes.
2498
2499         * html/HTMLHtmlElement.cpp:
2500         (WebCore::HTMLHtmlElement::insertedByParser): Use a reference.
2501
2502         * html/HTMLLinkElement.cpp:
2503         (WebCore::HTMLLinkElement::process): Pass a reference.
2504         (WebCore::HTMLLinkElement::setCSSStyleSheet): Use auto.
2505
2506         * html/HTMLMediaElement.cpp:
2507         (WebCore::HTMLMediaElement::loadResource): Use a reference.
2508
2509         * inspector/InspectorApplicationCacheAgent.cpp:
2510         (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus): Use a reference,
2511         also update for struct-style member names withou m_ prefix.
2512         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): Ditto.
2513         (WebCore::InspectorApplicationCacheAgent::getManifestForFrame): Ditto.
2514         (WebCore::InspectorApplicationCacheAgent::getApplicationCacheForFrame): Ditto.
2515         (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache): Ditto.
2516         (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources): Ditto.
2517         (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource): Ditto.
2518         * inspector/InspectorApplicationCacheAgent.h: Updated for above changes.
2519
2520         * inspector/InspectorInstrumentation.cpp:
2521         (WebCore::InspectorInstrumentation::updateApplicationCacheStatusImpl): Take a reference.
2522         * inspector/InspectorInstrumentation.h: Updated for the above.
2523
2524         * loader/DocumentLoader.cpp:
2525         (WebCore::DocumentLoader::DocumentLoader): Move much initialization to class definition.
2526         (WebCore::DocumentLoader::originalRequest): Moved to header to make it inline.
2527         (WebCore::DocumentLoader::originalRequestCopy): Ditto.
2528         (WebCore::DocumentLoader::request): Ditto.
2529         (WebCore::DocumentLoader::url): Ditto.
2530         (WebCore::DocumentLoader::stopLoading): Pass a reference.
2531         (WebCore::DocumentLoader::willSendRequest): Updated to take a raw pointer instead of a
2532         PassRefPtr.
2533         (WebCore::DocumentLoader::commitData): Call shouldUseMainResourceEncoding instead of
2534         special casing WebArchive.
2535         (WebCore::DocumentLoader::maybeCreateArchive): Pass references.
2536         (WebCore::DocumentLoader::setArchive): Take Ref&& instead of PassRefPtr.
2537         (WebCore::DocumentLoader::addAllArchiveResources): Take a reference instead
2538         of a pointer.
2539         (WebCore::DocumentLoader::popArchiveForSubframe): Return RefPtr instead of
2540         PassRefPtr.
2541         (WebCore::DocumentLoader::subresource): Ditto.
2542         (WebCore::DocumentLoader::subresources): Return a Vector<Ref> instead of a
2543         Vector<RefPtr>.
2544         (WebCore::DocumentLoader::substituteResourceDeliveryTimerFired): Use move
2545         instead of swap.
2546         (WebCore::DocumentLoader::scheduleArchiveLoad): Use shouldLoadFromArchiveOnly
2547         instead of a special case for each type of archive.
2548         (WebCore::DocumentLoader::originalURL): Moved to header to make it inline.
2549         (WebCore::DocumentLoader::responseURL): Ditto.
2550         (WebCore::DocumentLoader::documentURL): Call shouldUseMainResourceURL instead of
2551         special casing WebArchive.
2552         (WebCore::DocumentLoader::responseMIMEType): Moved to header to make it inline.
2553         (WebCore::DocumentLoader::currentContentType): Ditto.
2554         (WebCore::DocumentLoader::contentFilter): Ditto.
2555         (WebCore::DocumentLoader::getIconLoadDecisionForIconURL): Pass a reference.
2556         (WebCore::DocumentLoader::getIconDataForIconURL): Ditto.
2557         (WebCore::DocumentLoader::dispatchOnloadEvents): Use a reference.
2558         (WebCore::DocumentLoader::unreachableURL): Moved to header to make it inline.
2559         * loader/DocumentLoader.h: Updated for the above.
2560
2561         * loader/EmptyClients.cpp: Updated for changes to client interfaces.
2562         * loader/EmptyClients.h: Ditto.
2563
2564         * loader/FormState.cpp:
2565         (WebCore::FormState::FormState): Take references instead of PassRefPtr, also
2566         take Vector&& instead of Vector& when we want to take ownership and use move
2567         instead of swap to do that.
2568         (WebCore::FormState::create): Ditto.
2569         * loader/FormState.h: Updated for the above. Also changed return values to be
2570         references instead of pointers and members to be Ref instead of RefPtr.
2571
2572         * loader/FormSubmission.cpp:
2573         (WebCore::FormSubmission::Attributes::parseMethodType): Updated for change
2574         to the Method enumeration.
2575         (WebCore::FormSubmission::Attributes::copyFrom): Deleted.
2576         (WebCore::FormSubmission::FormSubmission): Use Ref&& instead of PassRefPtr.
2577         (WebCore::FormSubmission::create): Use reference instead of pointer and
2578         raw pointer instead of PassRefPtr. Also copy attributes using copy constructor
2579         instead of an explicit copyFrom function.
2580         (WebCore::FormSubmission::requestURL): Updated for change to the Method
2581         enumeration.
2582         (WebCore::FormSubmission::populateFrameLoadRequest): Ditto.
2583         * loader/FormSubmission.h: Updated for the above changes. Made the Attributes
2584         class copyable, since we copy it. Changed some functions to return references
2585         instead of pointers and use Ref instead of RefPtr for data members.
2586
2587         * loader/FrameLoader.cpp:
2588         (WebCore::FrameLoader::submitForm): Updated for changes to FormSubmission
2589         and FormState.
2590         (WebCore::FrameLoader::receivedFirstData): Ditto.
2591         (WebCore::FrameLoader::loadFrameRequest): Ditto.
2592         (WebCore::FrameLoader::loadResourceSynchronously): Ditto.
2593         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
2594
2595         * loader/FrameLoaderClient.h: Use references, pointers, RefPtr, and Ref
2596         instead of PassRefPtr. Removed unused empty dispatchDidFailToStartPlugin.
2597
2598         * loader/HistoryController.cpp:
2599         (WebCore::HistoryController::pushState): Take RefPtr&& instead of PassRefPtr.
2600         (WebCore::HistoryController::replaceState): Ditto.
2601         * loader/HistoryController.h: Updated for the above.
2602
2603         * loader/ImageLoader.cpp:
2604         (WebCore::ImageLoader::updateFromElement): Pass a reference.
2605
2606         * loader/NavigationScheduler.cpp: Use refernces and Ref&& instead of
2607         pointers and PassRefPtr.
2608         (WebCore::ScheduledNavigation::ScheduledNavigation): Added an overload
2609         that sests m_shouldOpenExternalURLsPolicy.
2610         * loader/NavigationScheduler.h: Updated for the above.
2611
2612         * loader/ResourceLoader.cpp:
2613         (WebCore::ResourceLoader::start): Use and pass references.
2614         (WebCore::ResourceLoader::willSendRequest): Ditto.
2615         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
2616         (WebCore::ResourceLoader::didFail): Ditto.
2617
2618         * loader/SubframeLoader.cpp:
2619         (WebCore::SubframeLoader::createJavaAppletWidget): Return RefPtr instead
2620         of PassRefPtr. Pass references instead of pointers.
2621         (WebCore::SubframeLoader::loadOrRedirectSubframe): Ditto.
2622         (WebCore::SubframeLoader::loadSubframe): Ditto.
2623         (WebCore::SubframeLoader::document): Deleted. This was never really the
2624         correct idiom for getting the appropriate document; hiding the dependency
2625         on m_frame wasn't paing off.
2626         (WebCore::SubframeLoader::loadPlugin): Pass reference instead of pointer.
2627         (WebCore::SubframeLoader::shouldConvertInvalidURLsToBlank): Eliminated
2628         unneeded null checking and complexity due to going through the document
2629         instead of the frame for this check.
2630         * loader/SubframeLoader.h: Updated for the above.
2631
2632         * loader/appcache/ApplicationCache.cpp:
2633         (WebCore::ApplicationCache::ApplicationCache): Moved data member
2634         initialization to the class definition.
2635         (WebCore::ApplicationCache::~ApplicationCache): Pass a reference instead
2636         of a pointer.
2637         (WebCore::ApplicationCache::isComplete): Ditto.
2638         (WebCore::ApplicationCache::setManifestResource): Take Ref&& instead of
2639         PassRefPtr.
2640         (WebCore::ApplicationCache::addResource): Ditto.
2641         (WebCore::ApplicationCache::removeResource): Deleted. Was unused.
2642         * loader/appcache/ApplicationCache.h: Updated for above changes.
2643
2644         * loader/appcache/ApplicationCacheGroup.cpp:
2645         (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): Moved most
2646         member initialization to the class definition.
2647         (WebCore::ApplicationCacheGroup::~ApplicationCacheGroup): Pass a reference.
2648         (WebCore::ApplicationCacheGroup::cacheForMainRequest): Removed
2649         unnecessary preflight for removeFragmentIdentifier, which efficiently
2650         does nothing if there is no identifier. Use early return.
2651         (WebCore::ApplicationCacheGroup::fallbackCacheForMainRequest): More of
2652         the same.
2653         (WebCore::ApplicationCacheGroup::selectCache): Ditto, also take a reference,
2654         and use event names instead of a special enumeration to poast events.
2655         (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL): Ditto.
2656         (WebCore::ApplicationCacheGroup::finishedLoadingMainResource): Ditto.
2657         (WebCore::ApplicationCacheGroup::failedLoadingMainResource): Ditto.
2658         (WebCore::ApplicationCacheGroup::disassociateDocumentLoader): Ditto.
2659         (WebCore::ApplicationCacheGroup::cacheDestroyed): Ditto.
2660         (WebCore::ApplicationCacheGroup::stopLoadingInFrame): Ditto.
2661         (WebCore::ApplicationCacheGroup::setNewestCache): Use Ref&& instead of
2662         PassRefPtr.
2663         (WebCore::ApplicationCacheGroup::makeObsolete): More of the same.
2664         (WebCore::ApplicationCacheGroup::update): Ditto.
2665         (WebCore::ApplicationCacheGroup::abort): Ditto.
2666         (WebCore::ApplicationCacheGroup::didReceiveResponse): Ditto.
2667         (WebCore::ApplicationCacheGroup::didFinishLoading): Ditto.
2668         (WebCore::ApplicationCacheGroup::didFail): Ditto.
2669         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): Ditto.
2670         (WebCore::ApplicationCacheGroup::manifestNotFound): Ditto.
2671         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): Ditto.
2672         (WebCore::ApplicationCacheGroup::startLoadingEntry): Ditto.
2673         (WebCore::ApplicationCacheGroup::deliverDelayedMainResources): Use a modern
2674         for loop.
2675         (WebCore::ApplicationCacheGroup::addEntry): Use auto and simplify logic
2676         for adding.
2677         (WebCore::ApplicationCacheGroup::associateDocumentLoaderWithCache): Update since
2678         function result is a reference.
2679         (WebCore::ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback):
2680         Use auto.
2681         (WebCore::ApplicationCacheGroup::postListenerTask): Take event type instead of
2682         taking a special enumeration.
2683         * loader/appcache/ApplicationCacheGroup.h: Updated for the above.
2684
2685         * loader/appcache/ApplicationCacheHost.cpp:
2686         (WebCore::ApplicationCacheHost::ApplicationCacheHost): Move most member
2687         initialization to the class definition.
2688         (WebCore::ApplicationCacheHost::~ApplicationCacheHost): Use reference.
2689         (WebCore::ApplicationCacheHost::selectCacheWithoutManifest): Ditto.
2690         (WebCore::ApplicationCacheHost::selectCacheWithManifest): Ditto.
2691         (WebCore::ApplicationCacheHost::mainResourceDataReceived): Ditto.
2692         (WebCore::ApplicationCacheHost::failedLoadingMainResource): Ditto.
2693         (WebCore::ApplicationCacheHost::finishedLoadingMainResource): Ditto.
2694         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect): Ditto.
2695         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse): Ditto.
2696         (WebCore::ApplicationCacheHost::createFileURL): Ditto.
2697         (WebCore::ApplicationCacheHost::maybeLoadSynchronously): Ditto.
2698         (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Take event
2699         type instead of special enumeration.
2700         (WebCore::ApplicationCacheHost::stopLoadingInFrame): Use reference.
2701         (WebCore::ApplicationCacheHost::stopDeferringEvents): Updated to use
2702         event types instead of special enumeration and also repaired possible
2703         edge case where code in event handler somehow triggers additional events.
2704         (WebCore::ApplicationCacheHost::resourceList): Renamed from fillResourceList
2705         and changed to return a vector instead of populating one.
2706         (WebCore::ApplicationCacheHost::applicationCacheInfo): Tweak coding style a bit.
2707         (WebCore::createApplicationCacheEvent): Factored this helper out of
2708         dispatchDOMEvent so we can use Ref instead of RefPtr.
2709         (WebCore::ApplicationCacheHost::dispatchDOMEvent): Updated to recent event type
2710         rather than receiving an event id and mapping it to a type.
2711         (WebCore::ApplicationCacheHost::setApplicationCache): Take RefPtr&& instead of
2712         PassRefPtr.
2713         (WebCore::ApplicationCacheHost::update): Pass a reference.
2714         (WebCore::ApplicationCacheHost::swapCache): Ditto.
2715         (WebCore::ApplicationCacheHost::abort): Ditto.
2716         * loader/appcache/ApplicationCacheHost.h: Updated for the above.
2717
2718         * loader/appcache/ApplicationCacheStorage.cpp:
2719         (WebCore::ApplicationCacheStorage::loadCacheGroup): Pass a Ref instead of RefPtr.
2720         (WebCore::ApplicationCacheStorage::cacheGroupForURL): Ditto.
2721         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): Ditto.
2722         (WebCore::ApplicationCacheStorage::cacheGroupDestroyed): Take a reference.
2723         (WebCore::ApplicationCacheStorage::cacheGroupMadeObsolete): Ditto.
2724         (WebCore::ApplicationCacheStorage::storeNewestCache): Ditto.
2725         (WebCore::ApplicationCacheStorage::loadCache): Return RefPtr instead of PassRefPtr.
2726         (WebCore::ApplicationCacheStorage::deleteCacheGroup): Pass a reference.
2727         * loader/appcache/ApplicationCacheStorage.h: Updated for the above.
2728
2729         * loader/appcache/DOMApplicationCache.cpp:
2730         (WebCore::DOMApplicationCache::DOMApplicationCache): Take a reference.
2731         (WebCore::DOMApplicationCache::toEventType): Deleted.
2732         * loader/appcache/DOMApplicationCache.h: Updated for the above. Made most
2733         members private.
2734
2735         * loader/archive/Archive.cpp:
2736         (WebCore::Archive::clearAllSubframeArchives): Use a set for the logic that
2737         prevents us from walking the same archive more than once, rather than using
2738         a vector. Left it recursive, though.
2739         * loader/archive/Archive.h: Git rid of the type function, replacing it with
2740         three functions for the four different policies we currently have about the
2741         different archive types. Changed functions to take Ref&& instead of PassRefPtr
2742         and return const Vector<Ref>& instead of const Vector<RefPtr>&, changing the
2743         data members to match.
2744
2745         * loader/archive/ArchiveFactory.cpp:
2746         (WebCore::createArchiveMIMETypesMap): Factored this out of the archiveMIMETypes
2747         function so we don't need a boolean. Also use ASCIILiteral.
2748         (WebCore::archiveMIMETypes): Updated to se the above.
2749
2750         * loader/archive/ArchiveResourceCollection.cpp:
2751         (WebCore::ArchiveResourceCollection::addAllResources): Take a reference.
2752         (WebCore::ArchiveResourceCollection::popSubframeArchive): Return RefPtr instead
2753         of PassRefPtr.
2754         * loader/archive/ArchiveResourceCollection.h: Updated for the above.
2755
2756         * loader/archive/cf/LegacyWebArchive.cpp:
2757         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Use auto and
2758         fewer local variables, more references for argument types and return values.
2759         (WebCore::LegacyWebArchive::createResourceResponseFromPropertyListData): Ditto.
2760         (WebCore::LegacyWebArchive::createResource): Ditto.
2761         (WebCore::LegacyWebArchive::create): Ditto.
2762         (WebCore::LegacyWebArchive::extract): Ditto.
2763         (WebCore::LegacyWebArchive::type): Deleted.
2764         (WebCore::LegacyWebArchive::rawDataRepresentation): More of the same.
2765         (WebCore::LegacyWebArchive::createFromSelection): Ditto.
2766         * loader/archive/cf/LegacyWebArchive.h: Updated for the above. Also marked the
2767         class final and added overrides for the four new policy member functions.
2768
2769         * loader/archive/mhtml/MHTMLArchive.cpp:
2770         (WebCore::MHTMLArchive::create): Pass references.
2771         (WebCore::MHTMLArchive::generateMHTMLData): Return RefPtr instead of
2772         PassRefPtr.
2773         * loader/archive/mhtml/MHTMLArchive.h: Updated for the above. Also marked the
2774         class final and added overrides for the four new policy member functions.
2775
2776         * loader/archive/mhtml/MHTMLParser.cpp:
2777         (WebCore::MHTMLParser::parseArchiveWithHeader): Pass Ref instead of RefPtr
2778         to setMainResource and addSubframeArchive.
2779         (WebCore::MHTMLParser::addResourceToArchive): Ditto.
2780
2781         * loader/cache/CachedCSSStyleSheet.cpp:
2782         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet): Return RefPtr instead
2783         of PassRefPtr.
2784         * loader/cache/CachedCSSStyleSheet.h: Updated for the above.
2785
2786         * loader/cache/CachedResourceRequest.cpp:
2787         (WebCore::CachedResourceRequest::setInitiator): Take a reference instead of a
2788         PassRefPtr.
2789         * loader/cache/CachedResourceRequest.h: Updated for the above.
2790
2791         * loader/cocoa/DiskCacheMonitor.h: Removed. This is a duplicate, unused copy
2792         of DiskCacheMonitorCocoa.h.
2793
2794         * loader/cocoa/DiskCacheMonitorCocoa.h: Removed unneeded exporting and virtual
2795         member functions, made more things private, and changed return type to RefPtr
2796         instead of PassRefPtr.
2797         * loader/cocoa/DiskCacheMonitorCocoa.mm:
2798         (WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
2799         Changed return type to RefPtr instead of PassRefPtr.
2800
2801         * loader/icon/IconDatabase.cpp:
2802         (WebCore::IconDatabase::setIconDataForIconURL): Take raw pointer instead of
2803         PassRefPtr.
2804         (WebCore::IconDatabase::getOrCreateIconRecord): Return Ref instead of PassRefPtr.
2805         (WebCore::IconDatabase::getImageDataForIconURLFromSQLDatabase): Return RefPtr
2806         instead of PassRefPtr.
2807         * loader/icon/IconDatabase.h: Updated for the above. Also marked functions final
2808         instead of override.
2809         * loader/icon/IconDatabaseBase.h: Ditto.
2810
2811         * loader/icon/PageURLRecord.cpp:
2812         (WebCore::PageURLRecord::PageURLRecord): Moved initialization to the header.
2813         (WebCore::PageURLRecord::~PageURLRecord): Wrote code here instead of calling
2814         setIconRecord(nullptr).
2815         (WebCore::PageURLRecord::setIconRecord): Take RefPtr&& instead of PassRefPtr.
2816         * loader/icon/PageURLRecord.h: Updatd for the above.
2817
2818         * page/Chrome.cpp:
2819         (WebCore::Chrome::runOpenPanel): Updated to take two references.
2820         * page/Chrome.h: Ditto.
2821         * page/ChromeClient.h: ditto.
2822
2823         * page/DOMWindow.cpp:
2824         (WebCore::DOMWindow::applicationCache): Pass a reference.
2825         (WebCore::DOMWindow::setLocation): Ditto.
2826         (WebCore::DOMWindow::createWindow): Ditto.
2827         (WebCore::DOMWindow::open): Ditto.
2828
2829         * page/EditorClient.h: Changed arguments to references instead of PassRefPtr.
2830
2831         * page/History.cpp:
2832         (WebCore::History::stateObjectAdded): Pass an rvalue reference.
2833
2834         * page/Location.cpp:
2835         (WebCore::Location::reload): Pass reference instead of pointer.
2836         (WebCore::Location::setLocation): Ditto.
2837
2838         * platform/URL.cpp:
2839         (WebCore::URL::setFragmentIdentifier): Take a StringView rather than
2840         a String, which is more flexible for callers. Also eliminated an unneeded
2841         string allocation when the old string had a fragment that is being replaced.
2842         * platform/URL.h: Updated for the above.
2843
2844         * replay/ReplayInputDispatchMethods.cpp:
2845         (WebCore::InitialNavigation::dispatch): Pass reference.
2846         * svg/SVGFEImageElement.cpp:
2847         (WebCore::SVGFEImageElement::requestImageResource): Ditto.
2848         * svg/SVGFontFaceUriElement.cpp:
2849         (WebCore::SVGFontFaceUriElement::loadFont): Ditto.
2850         * svg/SVGUseElement.cpp:
2851         (WebCore::SVGUseElement::updateExternalDocument): Ditto.
2852
2853 2017-01-16  Filip Pizlo  <fpizlo@apple.com>
2854
2855         Make opaque root scanning truly constraint-based
2856         https://bugs.webkit.org/show_bug.cgi?id=165760
2857
2858         Reviewed by Geoffrey Garen.
2859
2860         No new tests yet. I think that writing tests for this is a big investigation:
2861         https://bugs.webkit.org/show_bug.cgi?id=165808
2862         
2863         Remove the previous advancing wavefront DOM write barrier. I don't think this will scale
2864         very well. It's super confusing.
2865         
2866         This change makes it so that visitAdditionalChildren can become a GC constraint that
2867         executes as part of the fixpoint. This changes all WebCore visitAdditionalChildren into
2868         output constraints by using new JSC API for Subspaces and MarkingConstraints.
2869
2870         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Added.
2871         * ForwardingHeaders/heap/MarkedBlockInlines.h: Added.
2872         * ForwardingHeaders/heap/MarkingConstraint.h: Added.
2873         * ForwardingHeaders/heap/SubspaceInlines.h: Added.
2874         * ForwardingHeaders/heap/VisitingTimeout.h: Added.
2875         * WebCore.xcodeproj/project.pbxproj:
2876         * bindings/js/CommonVM.cpp:
2877         (WebCore::commonVMSlow):
2878         (WebCore::writeBarrierOpaqueRootSlow): Deleted.
2879         * bindings/js/CommonVM.h:
2880         (WebCore::writeBarrierOpaqueRoot): Deleted.
2881         * bindings/js/JSDOMGlobalObject.cpp:
2882         (WebCore::JSDOMGlobalObject::finishCreation):
2883         (WebCore::JSDOMGlobalObject::scriptExecutionContext):
2884         * bindings/js/JSDOMWrapper.cpp:
2885         (WebCore::outputConstraintSubspaceFor):
2886         (WebCore::globalObjectOutputConstraintSubspaceFor):
2887         * bindings/js/JSDOMWrapper.h:
2888         * bindings/js/WebCoreJSClientData.cpp: Added.
2889         (WebCore::JSVMClientData::JSVMClientData):
2890         (WebCore::JSVMClientData::~JSVMClientData):
2891         (WebCore::JSVMClientData::getAllWorlds):
2892         (WebCore::initNormalWorldClientData):
2893         * bindings/js/WebCoreJSClientData.h:
2894         (WebCore::JSVMClientData::outputConstraintSpace):
2895         (WebCore::JSVMClientData::globalObjectOutputConstraintSpace):
2896         (WebCore::JSVMClientData::forEachOutputConstraintSpace):
2897         (WebCore::JSVMClientData::JSVMClientData): Deleted.
2898         (WebCore::JSVMClientData::~JSVMClientData): Deleted.
2899         (WebCore::JSVMClientData::getAllWorlds): Deleted.
2900         (WebCore::initNormalWorldClientData): Deleted.
2901         * bindings/scripts/CodeGeneratorJS.pm:
2902         (GenerateHeader):
2903         (GenerateImplementation):
2904         * dom/ContainerNodeAlgorithms.cpp:
2905         (WebCore::notifyChildNodeInserted):
2906         (WebCore::notifyChildNodeRemoved):
2907
2908 2017-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2909
2910         Unreviewed, rolling out r210834
2911         https://bugs.webkit.org/show_bug.cgi?id=165668
2912
2913         It introduced dozens of test timeouts.
2914
2915         Reverted changeset:
2916         "[Modern Media Controls] Turn modern media controls on by default"
2917         https://bugs.webkit.org/show_bug.cgi?id=165668
2918         http://trac.webkit.org/changeset/210834
2919
2920 2017-01-17  Zalan Bujtas  <zalan@apple.com>
2921
2922         Remove positionOutsideContainingSpecialElement
2923         https://bugs.webkit.org/show_bug.cgi?id=167150
2924
2925         Reviewed by Antti Koivisto.
2926
2927         It is not used anymore.
2928
2929         No change in functionality.
2930
2931         * editing/htmlediting.cpp:
2932         (WebCore::isFirstVisiblePositionInSpecialElement): Deleted.
2933         (WebCore::isLastVisiblePositionInSpecialElement): Deleted.
2934         (WebCore::positionOutsideContainingSpecialElement): Deleted.
2935         * editing/htmlediting.h:
2936
2937 2017-01-17  Chris Dumez  <cdumez@apple.com>
2938
2939         Unreviewed, fix nits found after landing r210833.
2940         https://bugs.webkit.org/show_bug.cgi?id=167065
2941
2942         * dom/ContainerNode.cpp:
2943         (WebCore::ContainerNode::replaceAllChildren):
2944         * dom/ContainerNode.h:
2945
2946 2017-01-17  Andreas Kling  <akling@apple.com>
2947
2948         WidthCache should be off while under memory pressure.
2949         <https://webkit.org/b/167141>
2950
2951         Reviewed by Antti Koivisto.
2952
2953         Since we empty all the WidthCaches when we come under memory pressure, we shouldn't
2954         repopulate them until the pressure has gone away.
2955
2956         * platform/graphics/WidthCache.h:
2957         (WebCore::WidthCache::add):
2958
2959 2017-01-17  Antti Koivisto  <antti@apple.com>
2960
2961         Persist derived data
2962         https://bugs.webkit.org/show_bug.cgi?id=167136
2963
2964         Reviewed by Andreas Kling.
2965
2966         * loader/LoaderStrategy.h:
2967         * loader/ResourceLoader.cpp:
2968         (WebCore::ResourceLoader::didRetrieveDerivedDataFromCache):
2969         * loader/ResourceLoader.h:
2970         (WebCore::ResourceLoader::options):
2971         * loader/ResourceLoaderOptions.h:
2972         * loader/SubresourceLoader.cpp:
2973         (WebCore::SubresourceLoader::didRetrieveDerivedDataFromCache):
2974         * loader/SubresourceLoader.h:
2975         * loader/cache/CachedResource.h:
2976         (WebCore::CachedResource::didRetrieveDerivedDataFromCache):
2977         * loader/cache/CachedResourceLoader.cpp:
2978         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
2979         * platform/network/ResourceResponseBase.h:
2980         (WebCore::ResourceResponseBase::cacheBodyKey):
2981         (WebCore::ResourceResponseBase::setCacheBodyKey):
2982         (WebCore::ResourceResponseBase::encode):
2983         (WebCore::ResourceResponseBase::decode):
2984
2985 2017-01-17  Antoine Quint  <graouts@apple.com>
2986
2987         [Modern Media Controls] Turn modern media controls on by default
2988         https://bugs.webkit.org/show_bug.cgi?id=165668
2989
2990         Reviewed by Dean Jackson.
2991
2992         Tests: media/modern-media-controls/fullscreen-support/ipad/fullscreen-support-tap.html
2993                media/modern-media-controls/pip-support/ipad/pip-support-enabled.html
2994                media/modern-media-controls/pip-support/ipad/pip-support-tap.html
2995                media/modern-media-controls/placard-support/ipad/placard-support-pip.html
2996                media/modern-media-controls/scrubber-support/ipad/scrubber-support-drag.html
2997
2998         Fix an error which may be triggered prior to Sierra where we would assume the presentation
2999         mode API was avaiable when it might not be, which caused a few tests to fail.
3000
3001         * Modules/modern-media-controls/media/pip-support.js:
3002         (PiPSupport.prototype.syncControl):
3003         (PiPSupport):
3004
3005 2017-01-17  Chris Dumez  <cdumez@apple.com>
3006
3007         Document title changed twice when setting document.title
3008         https://bugs.webkit.org/show_bug.cgi?id=167065
3009
3010         Reviewed by Darin Adler.
3011
3012         Setting document.title would call the document title to be set twice
3013         first to the empty string and then to the new title. This is because
3014         setting document.title is equivalent to setting title.textContent [1],
3015         which first removes all children and then inserts the new one [2], and
3016         we call updateTitle() for each step. This is because
3017         HTMLTitleElement::childrenChanged() is called twice (once for the
3018         removal of the existing children, and a second time when the new child
3019         is inserted), and childrenChanged() calls document::titleElementTextChanged().
3020
3021         Since no JS event is fired between those 2 mutations, it is safe (i.e. non
3022         observable from JS) to update the title only once after both mutations have
3023         taken place. To achieve this, add a new replaceAllChildren() function
3024         which implements [3]. This replaceAllChildren() has the benefit of
3025         calling ContainerNode::childrenChanged() only once, after both mutations
3026         have taken place, thus avoiding unnecessary work. This fixes the issue
3027         when setting the title and should be performance-positive in general.
3028
3029         [1] https://html.spec.whatwg.org/#document.title
3030         [2] https://dom.spec.whatwg.org/#dom-node-textcontent
3031         [3] https://dom.spec.whatwg.org/#concept-node-replace-all
3032
3033         Test: fast/dom/Node/textContent-mutationEvents.html
3034
3035         * dom/ContainerNode.cpp:
3036         (WebCore::ContainerNode::notifyChildInserted):
3037         (WebCore::ContainerNode::removeChild):
3038         (WebCore::ContainerNode::replaceAllChildren):
3039         (WebCore::ContainerNode::rebuildSVGExtensionsElementsIfNecessary):
3040         (WebCore::ContainerNode::removeChildren):
3041         (WebCore::ContainerNode::updateTreeAfterInsertion):
3042         * dom/ContainerNode.h:
3043         Add new replaceAllChildrenWith() function which implements [3]
3044         in a way that calls ContainerNode::childrenChanged() only once.
3045
3046         * dom/Element.cpp:
3047         (WebCore::Element::childrenChanged):
3048         Deal with new AllChildrenReplaced ChildChange type.
3049
3050         * dom/Node.cpp:
3051         (WebCore::Node::setTextContent):
3052         Call replaceAllChildrenWith() as per the specification:
3053         - https://dom.spec.whatwg.org/#dom-node-textcontent
3054
3055         * dom/Range.cpp:
3056         (WebCore::Range::surroundContents):
3057         Call replaceAllChildrenWith(nullptr) as per the specification:
3058         - https://dom.spec.whatwg.org/#dom-range-surroundcontents
3059
3060 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
3061
3062         ENABLE(USER_TIMING) Not Defined for Apple Windows or OS X Ports
3063         https://bugs.webkit.org/show_bug.cgi?id=116551
3064         <rdar://problem/13949830>
3065
3066         Reviewed by Alex Christensen.
3067
3068         * Configurations/FeatureDefines.xcconfig:
3069
3070 2017-01-17  Zalan Bujtas  <zalan@apple.com>
3071
3072         Editing nested RTL-LTR content makes the process unresponsive.
3073         https://bugs.webkit.org/show_bug.cgi?id=167140
3074         rdar://problem/29057611
3075
3076         Reviewed by Ryosuke Niwa.
3077
3078         Break out of the loop if we keep coming back to the same position.
3079         This is a workaround for the underlying editing/position bug -> webkit.org/b/167138.
3080
3081         Test: editing/rtl-to-ltr-editing-word-move-spin.html
3082
3083         * editing/VisibleUnits.cpp:
3084         (WebCore::visualWordPosition):
3085
3086 2017-01-16  Filip Pizlo  <fpizlo@apple.com>
3087
3088         JSCell::classInfo() shouldn't have a bunch of mitigations for being called during destruction
3089         https://bugs.webkit.org/show_bug.cgi?id=167066
3090
3091         Reviewed by Keith Miller and Michael Saboff.
3092
3093         No new tests because no new behavior.
3094         
3095         It's now necessary to avoid jsCast in destructors and finalizers. This was an easy
3096         rule to introduce because this used to always be the rule.
3097
3098         * bindings/js/JSCSSValueCustom.cpp:
3099         (WebCore::JSDeprecatedCSSOMValueOwner::finalize):
3100         * bindings/js/JSDOMIterator.h:
3101         (WebCore::IteratorTraits>::destroy):
3102         * bindings/scripts/CodeGeneratorJS.pm:
3103         (GenerateImplementation):
3104
3105 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
3106
3107         Remove unnecessary includes
3108         https://bugs.webkit.org/show_bug.cgi?id=167114
3109
3110         Reviewed by Alex Christensen.
3111
3112 2017-01-17  Andreas Kling  <akling@apple.com>
3113
3114         Kill the presentation attribute cache.
3115         <https://webkit.org/b/119542>
3116
3117         Reviewed by Antti Koivisto.
3118
3119         This cache was added to placate some old page cycler test that was measuring load times
3120         on pages captured in 2000. That content is not super relevant anymore, and I think
3121         we can live without this cache.
3122
3123         * dom/StyledElement.cpp:
3124         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
3125         (WebCore::presentationAttributeCache): Deleted.
3126         (WebCore::PresentationAttributeCacheCleaner::PresentationAttributeCacheCleaner): Deleted.
3127         (WebCore::PresentationAttributeCacheCleaner::didHitPresentationAttributeCache): Deleted.
3128         (WebCore::PresentationAttributeCacheCleaner::cleanCache): Deleted.
3129         (WebCore::presentationAttributeCacheCleaner): Deleted.
3130         (WebCore::StyledElement::clearPresentationAttributeCache): Deleted.
3131         (WebCore::attributeNameSort): Deleted.
3132         (WebCore::StyledElement::makePresentationAttributeCacheKey): Deleted.
3133         (WebCore::computePresentationAttributeCacheHash): Deleted.
3134         * dom/StyledElement.h:
3135         * page/MemoryRelease.cpp:
3136         (WebCore::releaseNoncriticalMemory):
3137
3138 2017-01-17  Filip Pizlo  <fpizlo@apple.com>
3139
3140         Unreviewed, roll out http://trac.webkit.org/changeset/210821
3141         It was causing crashes.
3142
3143         * bindings/js/JSCSSValueCustom.cpp:
3144         (WebCore::JSDeprecatedCSSOMValueOwner::finalize):
3145         * bindings/js/JSDOMIterator.h:
3146         (WebCore::IteratorTraits>::destroy):
3147         * bindings/scripts/CodeGeneratorJS.pm:
3148         (GenerateImplementation):
3149
3150 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
3151
3152         Crash when closing tab with debugger paused
3153         https://bugs.webkit.org/show_bug.cgi?id=161746
3154         <rdar://problem/15607819>
3155
3156         Reviewed by Brian Burg and Brent Fulgham.
3157
3158         * page/Page.h:
3159         (WebCore::Page::incrementNestedRunLoopCount):
3160         (WebCore::Page::decrementNestedRunLoopCount):
3161         (WebCore::Page::insideNestedRunLoop):
3162         Keep track of whether or not this Page is inside of a nested run loop.
3163         Currently the only nested run loop we know about is EventLoop used
3164         by Web Inspector when debugging JavaScript.
3165
3166         (WebCore::Page::whenUnnested):
3167         Callback that can be called when we are no longer inside of a nested
3168         run loop.
3169
3170         (WebCore::Page::~Page):
3171         Ensure we are not in a known nested run loop when destructing, since
3172         that could be unsafe.
3173
3174         * inspector/PageScriptDebugServer.cpp:
3175         (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
3176         Increment and decrement as we go into or leave the nested runloop.
3177
3178         * inspector/InspectorController.cpp:
3179         (WebCore::InspectorController::inspectedPageDestroyed):
3180         (WebCore::InspectorController::disconnectAllFrontends):
3181         Rework destruction to allow disconnectAllFrontends to happen earlier
3182         if necessary. WebKit clients may use this to disconnect remote
3183         frontends when closing a Page.
3184
3185 2017-01-16  Filip Pizlo  <fpizlo@apple.com>
3186
3187         JSCell::classInfo() shouldn't have a bunch of mitigations for being called during destruction
3188         https://bugs.webkit.org/show_bug.cgi?id=167066
3189
3190         Reviewed by Keith Miller and Michael Saboff.
3191
3192         No new tests because no new behavior.
3193         
3194         It's now necessary to avoid jsCast in destructors and finalizers. This was an easy
3195         rule to introduce because this used to always be the rule.
3196
3197         * bindings/js/JSCSSValueCustom.cpp:
3198         (WebCore::JSDeprecatedCSSOMValueOwner::finalize):
3199         * bindings/js/JSDOMIterator.h:
3200         (WebCore::IteratorTraits>::destroy):
3201         * bindings/scripts/CodeGeneratorJS.pm:
3202         (GenerateImplementation):
3203
3204 2017-01-17  Miguel Gomez  <magomez@igalia.com>
3205
3206         REGRESSION(r208997): [GLX] Google maps labels broken when using glXCreateContextAttribsARB
3207         https://bugs.webkit.org/show_bug.cgi?id=166489
3208
3209         Reviewed by Žan Doberšek.
3210
3211         The format GL_ALPHA that can be used in WebGL's texImage2D and texSubImage2D functions is deprecated
3212         in the OpenGL layer when using a core profile. Due to this, when using core, we need to transform
3213         that parameter into something supported by OpenGL.
3214
3215         What we do is to use a texture with just GL_RED format (that allows a single color component) to
3216         store the alpha values, and then configure the texture to swizzle red and alpha when accessing the
3217         pixel components.
3218
3219         No new tests added.
3220
3221         * platform/graphics/GraphicsContext3D.h:
3222         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3223         (WebCore::GraphicsContext3D::GraphicsContext3D):
3224         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
3225         (WebCore::GraphicsContext3D::texImage2D):
3226         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3227         (WebCore::GraphicsContext3D::texSubImage2D):
3228
3229 2017-01-17  Tomas Popela  <tpopela@redhat.com>
3230
3231         Unreviewed build fix for the Release build with enabled logging
3232
3233         * html/MediaElementSession.cpp:
3234         * html/track/InbandGenericTextTrack.cpp:
3235
3236 2017-01-17  Zan Dobersek  <zdobersek@igalia.com>
3237
3238         MediaKeySession: use existing 'message' event name
3239         https://bugs.webkit.org/show_bug.cgi?id=167095
3240
3241         Reviewed by Sam Weinig.
3242
3243         When dispatching the 'message' event in MediaKeySession::enqueueMessage(),
3244         use the messageEvent member that's provided by the EventNames object. This
3245         removes the need for a custom static AtomicString object.
3246
3247         * Modules/encryptedmedia/MediaKeySession.cpp:
3248         (WebCore::MediaKeySession::enqueueMessage):
3249         (WebCore::messageEventName): Deleted.
3250
3251 2017-01-16  Joseph Pecoraro  <pecoraro@apple.com>
3252
3253         Remove the REQUEST_ANIMATION_FRAME flag
3254         https://bugs.webkit.org/show_bug.cgi?id=156980
3255         <rdar://problem/25906849>
3256
3257         Reviewed by Simon Fraser.
3258
3259         * Configurations/FeatureDefines.xcconfig:
3260         * dom/Document.cpp:
3261         * dom/Document.h:
3262         * dom/RequestAnimationFrameCallback.idl:
3263         * dom/ScriptedAnimationController.cpp:
3264         * dom/ScriptedAnimationController.h:
3265         * loader/EmptyClients.h:
3266         * page/Chrome.cpp:
3267         * page/Chrome.h:
3268         * page/ChromeClient.h:
3269         * page/DOMWindow.cpp:
3270         * page/DOMWindow.h:
3271         * page/DOMWindow.idl:
3272         * page/FrameView.cpp:
3273         * page/FrameView.h:
3274         * page/animation/AnimationController.cpp:
3275         * page/animation/AnimationController.h:
3276         * page/animation/AnimationControllerPrivate.h:
3277         * platform/HostWindow.h:
3278         * platform/ScrollAnimationSmooth.h:
3279         * testing/Internals.cpp:
3280
3281 2017-01-16  Andy Estes  <aestes@apple.com>
3282
3283         [QuickLook] QLPreviewConverter should be owned by its delegate
3284         https://bugs.webkit.org/show_bug.cgi?id=167104
3285
3286         Reviewed by Andreas Kling.
3287         
3288         Instead of having QuickLookHandle own both the QLPreviewConverter and its delegate, have it
3289         just own the delegate and have the delegate own the QLPreviewConverter.
3290
3291         No change in behavior. Covered by existing tests.
3292
3293         * loader/ios/QuickLook.h:
3294         (WebCore::QuickLookHandle::converter): Moved out-of-line.
3295         * loader/ios/QuickLook.mm: Renamed WebPreviewConverterDelegate to WebPreviewConverter, and
3296         gave it ownership of the QLPreviewConverter, QuickLookHandleClient, and preview response.
3297         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]):
3298         Added a ResourceResponse parameter.
3299         (-[WebPreviewConverter setClient:]): Moved from QuickLookHandle::setClient().
3300         (-[WebPreviewConverter appendDataArray:]): Moved from QuickLookHandle::didReceiveDataArray().
3301         (-[WebPreviewConverter finishedAppending]): Moved from QuickLookHandle::didFinishLoading().
3302         (-[WebPreviewConverter failed]): Moved from QuickLookHandle::didFail().
3303         (-[WebPreviewConverter platformConverter]): Added to return the QLPreviewConverter.
3304         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Used _previewResponse directly.
3305         (WebCore::QuickLookHandle::~QuickLookHandle): Removed unneeded logging.
3306         (WebCore::QuickLookHandle::didReceiveData): Called -[WebPreviewConverter appendDataArray:].
3307         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
3308         (WebCore::QuickLookHandle::didFinishLoading): Called -[WebPreviewConverter finishedAppending].
3309         (WebCore::QuickLookHandle::didFail): Called -[WebPreviewConverter failed].
3310         (WebCore::QuickLookHandle::setClient): Called -[WebPreviewConverter setClient:].
3311         (WebCore::QuickLookHandle::previewFileName): Retrieved the QLPreviewConverter via
3312         -[WebPreviewConverter platformConverter].
3313         (WebCore::QuickLookHandle::previewUTI): Ditto.
3314         (WebCore::QuickLookHandle::previewRequestURL): Ditto.
3315         (WebCore::QuickLookHandle::converter): Ditto.
3316         (WebCore::QuickLookHandle::didReceiveDataArray): Deleted.
3317         (WebCore::QuickLookHandle::previewResponse): Deleted.
3318
3319 2017-01-16  Antti Koivisto  <antti@apple.com>
3320
3321         CrashTracer: com.apple.WebKit.WebContent at JavaScriptCore: WTF::StringImpl::containsOnlyWhitespace
3322         https://bugs.webkit.org/show_bug.cgi?id=167106
3323         <rdar://problem/24457632>
3324
3325         Reviewed by Tim Horton.
3326
3327         Speculative fix.
3328
3329         * editing/cocoa/DataDetection.mm:
3330         (WebCore::DataDetection::detectContentInRange):
3331
3332             Test before casting to Text.
3333
3334 2017-01-16  Javier Fernandez  <jfernandez@igalia.com>
3335
3336         [css-grid] Implementing baseline positioning for grid containers
3337         https://bugs.webkit.org/show_bug.cgi?id=165063
3338
3339         Reviewed by Darin Adler and Sergio Villar Senin.
3340
3341         Implementation of the 'first-line' baseline for Grid containers,
3342         according to the CSS Grid Layout spec.
3343         https://drafts.csswg.org/css-grid/#grid-baselines
3344
3345         The self-baseline and content-baseline alignment logic is still
3346         not implemented, hence some cases will be implemented in
3347         future patches.
3348
3349         Tests: fast/css-grid-layout/grid-baseline-margins.html
3350                fast/css-grid-layout/grid-baseline-must-respect-grid-order.html
3351                fast/css-grid-layout/grid-baseline.html
3352
3353         * rendering/RenderGrid.cpp:
3354         (WebCore::synthesizedBaselineFromBorderBox):
3355         (WebCore::RenderGrid::isInlineBaselineAlignedChild):
3356         (WebCore::RenderGrid::baselinePosition):
3357         (WebCore::RenderGrid::firstLineBaseline):
3358         (WebCore::RenderGrid::inlineBlockBaseline):
3359         * rendering/RenderGrid.h:
3360
3361 2017-01-16  Andy Estes  <aestes@apple.com>
3362
3363         [QuickLook] Do some cleanup in QuickLookHandle
3364         https://bugs.webkit.org/show_bug.cgi?id=166864
3365
3366         Reviewed by Darin Adler.
3367
3368         * loader/ios/QuickLook.h: Stopped including QuickLookHandleClient.h and forward-declared
3369         instead; changed setClient() to take a Ref<QuickLookHandleClient>&&; renamed nsResponse() to
3370         previewResponse(); changed QuickLookHandle() to take a ResourceLoader& and const
3371         ResourceResponse&; gave m_delegate a stronger type; removed unused m_quicklookFileHandle;
3372         initialized m_finishedLoadingDataIntoConverter to false.
3373         (WebCore::QuickLookHandle::firstRequestURL): Stopped exporting.
3374         (WebCore::QuickLookHandle::setClient): Moved definition out-of-line.
3375         * loader/ios/QuickLook.mm: Renamed WebResourceLoaderQuickLookDelegate to
3376         WebPreviewConverterDelegate and stopped conforming to NSURLConnectionDelegate and
3377         WebCoreResourceLoaderDelegate; removed @property quickLookHandle and initialized
3378         _quickLookHandle in the initializer instead.
3379         (-[WebPreviewConverter initWithResourceLoader:quickLookHandle:]): Changed to take references
3380         to resourceLoader and quickLookHandle.
3381         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Stopped checking for a nil
3382         _quickLookHandle, since it is never nil.
3383         (-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): Deleted.
3384         QLPreviewConverter never calls this method.
3385         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Stopped checking for a
3386         nil _resourceLoader, since it is never nil.
3387         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
3388         (-[WebPreviewConverter connection:didFailWithError:]): Ditto.
3389         (WebCore::emptyClient): Changed to return a reference.
3390         (WebCore::QuickLookHandle::QuickLookHandle): Moved creation of the delegate,
3391         firstRequestURL, and response to here from QuickLookHandle::create(). Called
3392         ResourceLoader::didCreateQuickLookHandle() here instead of in QuickLookHandle::create().
3393         (WebCore::QuickLookHandle::create): Used std::make_unique to create the QuickLookHandle.
3394         (WebCore::QuickLookHandle::didFinishLoading): Set m_finishedLoadingDataIntoConverter to true
3395         instead of YES.
3396         (WebCore::QuickLookHandle::setClient): Moved the client rvalue reference into m_client.
3397         (WebCore::QuickLookHandle::~QuickLookHandle): Stopped clearing m_converter and calling
3398         -detachHandle.
3399         (WebCore::QuickLookHandle::previewRequestURL): Used dot syntax.
3400         (WebCore::QuickLookHandle::previewResponse): Renamed from nsResponse().
3401
3402 2017-01-16  Simon Fraser  <simon.fraser@apple.com>
3403
3404         Remove CSSPropertyNames.in from the project. It's not used any more,
3405         now that we generate files from CSSProperties.json.
3406
3407         * WebCore.xcodeproj/project.pbxproj:
3408
3409 2017-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
3410
3411         [SOUP] Accept-language could be set twice in a row for the default context
3412         https://bugs.webkit.org/show_bug.cgi?id=167089
3413
3414         Reviewed by Žan Doberšek.
3415
3416         If NetworkStorageSession doesn't have a SoupNetworkSession yet, we are creating it only to set the
3417         languages. Since we already set the global value, the languages will be set when the SoupNetworkSession is
3418         created later. This is not a big deal for the language property, but it will be for proxies after bug #128674.
3419         Since NetworkStorageSession::soupNetworkSession() it's actually getting or creating the SoupNetworkSession, this
3420         patch renames it as NetworkStorageSession::getOrCreateSoupNetworkSession() and now
3421         NetworkStorageSession::soupNetworkSession() returns a pointer without creating the SoupNetworkSession, so it can
3422         be nullptr. This can now be used to only use the default SoupNetworkSession when it has already been created.
3423
3424         * platform/network/NetworkStorageSession.h:
3425         (WebCore::NetworkStorageSession::soupNetworkSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
3426         * platform/network/soup/DNSSoup.cpp:
3427<