29a1f763f5d598f5b13fbbcf373374458962f356
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-06-15  Chris Dumez  <cdumez@apple.com>
2
3         Add API test coverage for SW RegistrationDatabase destruction and fix issues found by the test
4         https://bugs.webkit.org/show_bug.cgi?id=186681
5
6         Reviewed by Brady Eidson.
7
8         * workers/service/server/RegistrationDatabase.cpp:
9         (WebCore::RegistrationDatabase::RegistrationDatabase):
10         (WebCore::RegistrationDatabase::importRecords):
11         * workers/service/server/RegistrationDatabase.h:
12         Rename m_session to m_sessionID for clarity.
13
14         * workers/service/server/RegistrationStore.cpp:
15         (WebCore::RegistrationStore::~RegistrationStore):
16         Drop bad assertion now that the RegistrationDatabase is refcounted
17         and can outlive the RegistrationStore. The RegistrationDatabase will
18         take care of closing / destroying the SQLiteDatabase on the background
19         thread when destroyed.
20
21 2018-06-15  Timothy Hatcher  <timothy@apple.com>
22
23         REGRESSION (r232799): Form controls are blank in dark mode.
24
25         https://bugs.webkit.org/show_bug.cgi?id=186677
26         rdar://problem/41162899
27
28         Reviewed by Wenson Hsieh.
29
30         * rendering/RenderThemeMac.mm:
31         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
32         Dark mode controls don't have borders, just a semi-transparent background of shadows.
33         In the dark mode case we can't disable borders, or we will not paint anything for the control.
34
35 2018-06-15  Zalan Bujtas  <zalan@apple.com>
36
37         [LFC] Fix static position left/top
38         https://bugs.webkit.org/show_bug.cgi?id=186640
39
40         Reviewed by Antti Koivisto.
41
42         In visual formatting model, we normally go like [top, left] while LayoutPoint takes [x, y]. Let's make this less error prone.
43
44         * layout/FormattingContext.h:
45         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const):
46         * layout/blockformatting/BlockFormattingContext.h:
47         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
48         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
49         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
50
51 2018-06-15  Chris Dumez  <cdumez@apple.com>
52
53         Crash under WebCore::SWServer::registrationStoreImportComplete()
54         https://bugs.webkit.org/show_bug.cgi?id=186644
55         <rdar://problem/40982257>
56
57         Reviewed by Brady Eidson.
58
59         Fix lifetime management issues with RegistrationDatabase. RegistrationDatabase
60         was previously subclassing CrossThreadTaskHandler. CrossThreadTaskHandler
61         currently is not safe for objects that can get destroyed (such as
62         RegistrationDatabase). This is because it does not keep the object alive
63         when going to the background thread or back to the main thread. This would
64         cause crashes such as the one in the radar.
65
66         To address the issue, stop subclassing CrossThreadTaskHandler and use a
67         simple WorkQueue instead. RegistrationDatabase is now ThreadSafeRefCounted
68         and we take care of ref'ing it whenever we dispatch a task to the work queue
69         or back to the main thread. Because the RegistrationDatabase can now outlive
70         the RegistrationStore, m_store is now a WeakPtr.
71
72         * workers/service/server/RegistrationDatabase.cpp:
73         (WebCore::RegistrationDatabase::RegistrationDatabase):
74         (WebCore::RegistrationDatabase::~RegistrationDatabase):
75         (WebCore::RegistrationDatabase::postTaskToWorkQueue):
76         (WebCore::RegistrationDatabase::openSQLiteDatabase):
77         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
78         (WebCore::RegistrationDatabase::pushChanges):
79         (WebCore::RegistrationDatabase::clearAll):
80         (WebCore::RegistrationDatabase::importRecords):
81         (WebCore::RegistrationDatabase::addRegistrationToStore):
82         (WebCore::RegistrationDatabase::databaseFailedToOpen):
83         (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
84         * workers/service/server/RegistrationDatabase.h:
85         (WebCore::RegistrationDatabase::create):
86         * workers/service/server/RegistrationStore.cpp:
87         (WebCore::RegistrationStore::RegistrationStore):
88         (WebCore::RegistrationStore::~RegistrationStore):
89         (WebCore::RegistrationStore::pushChangesToDatabase):
90         (WebCore::RegistrationStore::clearAll):
91         * workers/service/server/RegistrationStore.h:
92
93 2018-06-15  Zalan Bujtas  <zalan@apple.com>
94
95         [LFC] Align compute functions styles.
96         https://bugs.webkit.org/show_bug.cgi?id=186649
97
98         Reviewed by Antti Koivisto.
99
100         Improve code readability.
101
102         * layout/FormattingContext.h:
103         * layout/FormattingContextGeometry.cpp:
104         (WebCore::Layout::contentHeightForFormattingContextRoot):
105         (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto):
106         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
107         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
108         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
109         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
110         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
111         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
112         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
113         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
114         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
115         (WebCore::Layout::computedValueIfNotAuto): Deleted.
116         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
117         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
118         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
119         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
120         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
121         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
122
123 2018-06-15  Zalan Bujtas  <zalan@apple.com>
124
125         [LFC] Add FormattingContextLayout logging channel
126         https://bugs.webkit.org/show_bug.cgi?id=186637
127
128         Reviewed by Antti Koivisto.
129
130         Add some basic layout logging (-WebCoreLogging "FormattingContextLayout").
131
132         * layout/FormattingContext.cpp:
133         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
134         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
135         * layout/FormattingContextGeometry.cpp:
136         (WebCore::Layout::contentHeightForFormattingContextRoot):
137         (WebCore::Layout::shrinkToFitWidth):
138         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
139         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
140         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
141         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
142         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
143         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
144         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
145         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
146         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
147         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
148         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
149         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
150         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
151         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
152         * layout/Verification.cpp:
153         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
154         (WebCore::Layout::verifyAndOutputSubtree):
155         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
156         * layout/blockformatting/BlockFormattingContext.cpp:
157         (WebCore::Layout::BlockFormattingContext::layout const):
158         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
159         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
160         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
161         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
162         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
163         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
164         * layout/layouttree/LayoutTreeBuilder.cpp:
165         (WebCore::Layout::outputLayoutBox):
166         (WebCore::Layout::outputLayoutTree):
167         (WebCore::Layout::TreeBuilder::showLayoutTree):
168         (WebCore::Layout::printLayoutTreeForLiveDocuments):
169         * layout/layouttree/LayoutTreeBuilder.h:
170         * platform/Logging.h:
171
172 2018-06-15  Antoine Quint  <graouts@apple.com>
173
174         [Web Animations] CSS Animations should take precedence over CSS Transitions
175         https://bugs.webkit.org/show_bug.cgi?id=186651
176
177         Reviewed by Dean Jackson.
178
179         Ensure CSS Animations override CSS Transitions by modifying the order in which animations are returned by animationsForElement().
180
181         * animation/AnimationTimeline.cpp:
182         (WebCore::AnimationTimeline::animationsForElement const):
183
184 2018-06-14  Youenn Fablet  <youenn@apple.com>
185
186         Make NetworkProcess get cache storage parameters at creation of the CacheStorage engine
187         https://bugs.webkit.org/show_bug.cgi?id=186166
188
189         Reviewed by Alex Christensen.
190
191         Covered by existing tests.
192
193         * platform/network/NetworkStorageSession.h:
194         (WebCore::NetworkStorageSession::cacheStorageDirectory const): Deleted.
195         (WebCore::NetworkStorageSession::setCacheStorageDirectory): Deleted.
196         (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const): Deleted.
197         (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota): Deleted.
198
199 2018-06-14  Matt Lewis  <jlewis3@apple.com>
200
201         Unreviewed, rolling out r232823.
202
203         This caused both test timeouts and api failures.
204
205         Reverted changeset:
206
207         "[Mail] Use the Mail Viewer width as the base for resolving
208         horizontal viewport units"
209         https://bugs.webkit.org/show_bug.cgi?id=186585
210         https://trac.webkit.org/changeset/232823
211
212 2018-06-14  Nan Wang  <n_wang@apple.com>
213
214         AX: Crash in AccessibilityNodeObject::textUnderElement(WebCore::AccessibilityTextUnderElementMode) const + 536
215         https://bugs.webkit.org/show_bug.cgi?id=186629
216
217         Reviewed by Chris Fleizach.
218
219         This crashed when we passed a null node to ancestorsOfType. Fixed it
220         by adding a null check.
221
222         Test: accessibility/hidden-object-text-value-crash.html
223
224         * accessibility/AccessibilityNodeObject.cpp:
225         (WebCore::AccessibilityNodeObject::textUnderElement const):
226
227 2018-06-14  Timothy Hatcher  <timothy@apple.com>
228
229         Expose more semantic system colors.
230
231         https://bugs.webkit.org/show_bug.cgi?id=186609
232         rdar://problem/39287277
233
234         Reviewed by Tim Horton.
235
236         Add the following semantic colors:
237          -apple-system-control-accent
238          -apple-system-even-alternating-content-background
239          -apple-system-odd-alternating-content-background
240          -apple-system-selected-content-background
241          -apple-system-unemphasized-selected-content-background
242          -apple-system-selected-text
243          -apple-system-unemphasized-selected-text
244          -apple-system-selected-text-background
245          -apple-system-unemphasized-selected-text-background
246          -apple-system-placeholder-text
247          -apple-system-find-highlight-background
248          -apple-system-separator
249
250         * css/CSSValueKeywords.in:
251         * rendering/RenderThemeMac.mm:
252         (WebCore::RenderThemeMac::systemColor const):
253
254 2018-06-14  Eric Carlson  <eric.carlson@apple.com>
255
256         [iOS] WebAVPlayerController isPlayingOnSecondScreen should be declared read-write
257         https://bugs.webkit.org/show_bug.cgi?id=186621
258         <rdar://problem/40243303>
259
260         Reviewed by Jer Noble.
261
262         * platform/ios/WebAVPlayerController.h:
263
264 2018-06-13  Zalan Bujtas  <zalan@apple.com>
265
266         [LFC] Miscellaneous fixes to be able to layout <div> with fixed width/height
267         https://bugs.webkit.org/show_bug.cgi?id=186616
268
269         Reviewed by Antti Koivisto.
270
271         1. Move box horizontally/vertically when relevant margin is computed.
272         2. Fix isStretchedToViewport() logic and make sure that the width/height is adjusted with the margin when the box is stretchy.
273         3. Fix isPaddingApplicable() and add "GenericElement" for elements that don't need special handling.
274
275         With this patch LFC produces the correct geometry for the following content:
276         <html><body><div style="width: 100px; height: 100px;"></div></body></html>
277
278         * layout/FormattingContext.cpp:
279         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
280         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
281         * layout/blockformatting/BlockFormattingContext.cpp:
282         (WebCore::Layout::BlockFormattingContext::layout const):
283         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
284         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const):
285         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
286         (WebCore::Layout::isStretchedToViewport):
287         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
288         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
289         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
290         * layout/displaytree/DisplayBox.h:
291         (WebCore::Display::Box::moveHorizontally):
292         (WebCore::Display::Box::moveVertically):
293         (WebCore::Display::Box::Rect::setWidth):
294         (WebCore::Display::Box::Rect::setHeight):
295         (WebCore::Display::Box::Rect::moveHorizontally):
296         (WebCore::Display::Box::Rect::moveVertically):
297         * layout/layouttree/LayoutBox.cpp:
298         (WebCore::Layout::Box::isPaddingApplicable const):
299         * layout/layouttree/LayoutBox.h:
300         * layout/layouttree/LayoutTreeBuilder.cpp:
301         (WebCore::Layout::TreeBuilder::createSubTree):
302
303 2018-06-13  Chris Dumez  <cdumez@apple.com>
304
305         Crash under SWServer::unregisterConnection(Connection&)
306         https://bugs.webkit.org/show_bug.cgi?id=186584
307         <rdar://problem/40931680>
308
309         Reviewed by Youenn Fablet.
310
311         The crash was due to SWServer::Connection objects outliving their SWServer, even
312         though SWServer::Connection::m_server is a C++ reference. This was possible because
313         SWServer does not own the connections, StorageToWebProcessConnection does. This
314         started crashing recently, after r232423, because SWServer can get destroyed now.
315         The SWServer might get destroyed before the StorageToWebProcessConnection, in which
316         case the SWServer::Connection objects will get destroyed later. We were crashing
317         because the SWServer::Connection destructor tries to unregister the connection from
318         the SWServer (which is dead).
319
320         To address the issue, the SWServer now owns the connections. StorageToWebProcessConnection
321         merely has weak pointers to the connections.
322
323         * workers/service/server/SWServer.cpp:
324         (WebCore::SWServer::Connection::Connection):
325         (WebCore::SWServer::addConnection):
326         (WebCore::SWServer::removeConnection):
327         (WebCore::SWServer::resolveRegistrationReadyRequests):
328         * workers/service/server/SWServer.h:
329         (WebCore::SWServer::Connection::~Connection):
330         (WebCore::SWServer::Connection::server):
331         (WebCore::SWServer::connection):
332         * workers/service/server/SWServerRegistration.cpp:
333         (WebCore::SWServerRegistration::forEachConnection):
334         (WebCore::SWServerRegistration::notifyClientsOfControllerChange):
335         (WebCore::SWServerRegistration::controlClient):
336
337 2018-06-13  Zalan Bujtas  <zalan@apple.com>
338
339         [Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units
340         https://bugs.webkit.org/show_bug.cgi?id=186585
341         <rdar://problem/30685325>
342
343         Reviewed by Tim Horton.
344
345         Use the existing "override viewport size for viewport units" mechanism to compute the preferred
346         viewport unit values for the Mail Viewer html content. 
347
348         Test: fast/dynamic/mail-autosize-viewport-unit.html
349
350         * page/FrameView.cpp:
351         (WebCore::FrameView::FrameView):
352         (WebCore::FrameView::enableAutoSizeMode):
353         (WebCore::FrameView::clearViewportSizeOverrideForCSSViewportUnits):
354         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
355         (WebCore::FrameView::overrideViewportSizeForCSSViewportUnits):
356         (WebCore::FrameView::viewportSizeForCSSViewportUnits const):
357         * page/FrameView.h:
358
359 2018-06-13  Dean Jackson  <dino@apple.com>
360
361         Disable AR support in WKWebView clients
362         https://bugs.webkit.org/show_bug.cgi?id=186611
363         <rdar://problem/39544684>
364
365         Reviewed by Jon Lee.
366
367         Since it hasn't been adequately tested, System Preview (AR) should
368         be disabled by default for WKWebViews.
369
370         Add a new RuntimeEnabledFeature to control this, and guard for
371         this case everywhere we use system previews.
372
373         * html/HTMLAnchorElement.cpp:
374         (WebCore::HTMLAnchorElement::isSystemPreviewLink const):
375         (WebCore::HTMLAnchorElement::handleClick):
376         * html/HTMLImageElement.cpp:
377         (WebCore::HTMLImageElement::isSystemPreviewImage const):
378         * html/HTMLPictureElement.cpp:
379         (WebCore::HTMLPictureElement::isSystemPreviewImage const):
380         * page/RuntimeEnabledFeatures.h:
381         (WebCore::RuntimeEnabledFeatures::setSystemPreviewEnabled):
382         (WebCore::RuntimeEnabledFeatures::systemPreviewEnabled const):
383         * rendering/RenderImage.cpp:
384         (WebCore::RenderImage::paintIntoRect):
385
386 2018-06-13  Youenn Fablet  <youenn@apple.com>
387
388         Supported plugin check should be based on plugin identifier
389         https://bugs.webkit.org/show_bug.cgi?id=186578
390         <rdar://problem/40523828>
391
392         Reviewed by Darin Adler.
393
394         Rename SupportedPluginName in SupportedPluginIdentifier.
395         Add cross-platform support for plug-in identifier.
396
397         Update built-in PDF plug-in to check its identifier instead of its name.
398         This is stronger as the name may change according localization.
399
400         * loader/EmptyClients.cpp:
401         * plugins/PluginData.cpp:
402         (WebCore::isBuiltInPDFPlugIn):
403         (WebCore::PluginData::initPlugins):
404         * plugins/PluginData.h:
405         (WebCore::operator==):
406         (WebCore::isSupportedPlugin):
407         (WebCore::SupportedPluginIdentifier::decode):
408         (WebCore::SupportedPluginIdentifier::encode const):
409         (WebCore::SupportedPluginName::decode): Deleted.
410         (WebCore::SupportedPluginName::encode const): Deleted.
411         * plugins/PluginInfoProvider.h:
412
413 2018-06-13  Chris Dumez  <cdumez@apple.com>
414
415         PSON: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html ASSERTS with process swap enabled
416         https://bugs.webkit.org/show_bug.cgi?id=186545
417
418         Reviewed by Brady Eidson.
419
420         Move frame navigation logging for ITP purposes from the WebProcess to the UIProcess.
421         This information was previously logged in DocumentLoader::willSendRequest() and was getting
422         sync'd to the UIProcess at regular intervals or when the layout tests call testRunner's
423         statisticsNotifyObserver(). We now do the logging directly in the UIProcess, in
424         WebPageProxy::decidePolicyForNavigationAction (which was getting called via IPC from
425         DocumentLoader::willSendRequest()).
426
427         This is more efficient and will also be needed soon due to the way process swap on navigation
428         deals with cross-origin redirects. On cross-origin redirect of the main frame, PSON cancels
429         the load and started a new load to the redirected to URL in the new WebProcess. As a result,
430         the new WebProcess is not aware that the load is a redirect, which is information that ITP
431         requires. By moving the ITP logging to the UIProcess, we still have access to this
432         information. 
433
434         * loader/DocumentLoader.cpp:
435         (WebCore::DocumentLoader::willSendRequest):
436         Stop logging the navigation now that it is logged in the UIProcess.
437
438         * loader/EmptyClients.cpp:
439         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
440         * loader/EmptyFrameLoaderClient.h:
441         * loader/FrameLoader.cpp:
442         (WebCore::FrameLoader::loadURL):
443         (WebCore::FrameLoader::loadWithDocumentLoader):
444         * loader/FrameLoaderClient.h:
445         * loader/PolicyChecker.cpp:
446         (WebCore::PolicyChecker::checkNavigationPolicy):
447         * loader/PolicyChecker.h:
448         We now pass the full redirect request to the decidePolicyForNavigationAction
449         delegate instead of a simple isRedirect boolean, so that we have the redirect
450         response URL in the UIProcess for ITP logging.
451
452         * loader/ResourceLoadObserver.cpp:
453         (WebCore::areDomainsAssociated):
454         (WebCore::ResourceLoadObserver::logSubresourceLoading):
455         (WebCore::ResourceLoadObserver::logWebSocketLoading):
456         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
457         * loader/ResourceLoadObserver.h:
458         * loader/ResourceLoadStatistics.cpp:
459         (WebCore::ResourceLoadStatistics::areDomainsAssociated):
460         (WebCore::ResourceLoadStatistics::reduceTimeResolution):
461         * loader/ResourceLoadStatistics.h:
462         - Remove ResourceLoadObserver::logFrameNavigation() now that it is on the WebResourceLoadStatisticsStore.
463         - Move some code from ResourceLoadObserver to ResourceLoadStatistics so that it can
464           be called from the UIProcess and to avoid code duplication.
465
466 2018-06-13  Mark Lam  <mark.lam@apple.com>
467
468         FloatingPointEnvironment is only needed for ARM CPUs.
469         https://bugs.webkit.org/show_bug.cgi?id=186567
470         <rdar://problem/40929441>
471
472         Reviewed by Michael Saboff.
473
474         No new tests.  This behavior is already covered by existing tests.
475
476         * platform/ios/wak/FloatingPointEnvironment.cpp:
477         * platform/ios/wak/FloatingPointEnvironment.h:
478         (WebCore::FloatingPointEnvironment::enableDenormalSupport):
479         (WebCore::FloatingPointEnvironment::saveMainThreadEnvironment):
480         (WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment):
481         (WebCore::FloatingPointEnvironment::singleton):
482
483 2018-06-13  Timothy Hatcher  <timothy@apple.com>
484
485         Input form controls have a white background in dark mode, when they should not.
486
487         https://bugs.webkit.org/show_bug.cgi?id=186577
488         rdar://problem/39258325
489
490         Reviewed by Tim Horton.
491
492         * DerivedSources.make: Allow WTF_PLATFORM_MAC ifdefs to preprocess in html.css.
493         * css/CSSValueKeywords.in: Added -apple-system-control-background.
494         * css/MediaQueryExpression.cpp:
495         (WebCore::featureWithValidIdent): Allow dark mode media query in user agent stylesheets.
496         (WebCore::isFeatureValidWithoutValue): Ditto.
497         * css/MediaQueryParserContext.cpp:
498         (WebCore::MediaQueryParserContext::MediaQueryParserContext): Transfer the CSSParserMode from CSSParserContext.
499         * css/MediaQueryParserContext.h:
500         * css/html.css: Set color and background-color to semantic colors for input, textarea, and select.
501         Make input background-color transparent in dark mode to match AppKit.
502         * rendering/RenderThemeMac.mm:
503         (WebCore::RenderThemeMac::systemColor const): Added -apple-system-control-background.
504         (WebCore::RenderThemeMac::paintTextField): Adjust the drawing rect to match new artwork in macOS 10.14.
505
506 2018-06-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
507
508         TileFirstPaint strategy for async image decoding should be disabled for non root RenderLayers
509         https://bugs.webkit.org/show_bug.cgi?id=186336
510         <rdar://problem/40808099>
511
512         Reviewed by Simon Fraser.
513
514         When showing a composited RenderLayer for the first time, the images in 
515         this layer have to be decoded synchronously to avoid unwanted flashing.
516
517         To create a layout test for this patch, FrameDecodingDurationForTesting
518         needs to be generalized for large and animated images. The decoding thread
519         now forces the decoding time to be at least equal to 
520         FrameDecodingDurationForTesting.
521
522         Test: fast/images/async-image-composited-show.html
523
524         * platform/graphics/BitmapImage.cpp:
525         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const):
526         (WebCore::BitmapImage::internalStartAnimation):
527         (WebCore::BitmapImage::advanceAnimation):
528         * platform/graphics/BitmapImage.h:
529         * platform/graphics/ImageSource.cpp:
530         (WebCore::ImageSource::startAsyncDecodingQueue):
531         * platform/graphics/ImageSource.h:
532         (WebCore::ImageSource::setFrameDecodingDurationForTesting):
533         (WebCore::ImageSource::frameDecodingDurationForTesting const):
534         * rendering/RenderLayer.cpp:
535         (WebCore::RenderLayer::paintLayerContents):
536
537 2018-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
538
539         CSS "background-color" style no longer affects natively rendered text fields
540         https://bugs.webkit.org/show_bug.cgi?id=186597
541         <rdar://problem/41050528>
542
543         Reviewed by Tim Horton.
544
545         AppKit currently does not support rendering background color to the edges of a text field cell. This means that
546         in WebCore, when natively rendering text inputs with background color, we need to only draw the bezels of a text
547         field, such that the background color we paint behind the text field will be shown. Currently, the way we
548         accomplish this is by intercepting an internal NSTextField method that computes drawing options for CoreUI, and
549         inserting a `"borders only" => true` entry.
550
551         However, in a recent build of macOS Mojave, AppKit tweaked -_coreUIDrawOptionsWithFrame:inView:includeFocus: to
552         add an extra argument (such that it's now -_coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:), which
553         negates the above workaround. To fix this in the short term, augment the workaround to apply to the latest macOS
554         Mojave as well. A longer-term fix is already tracked in <rdar://problem/11385461>, which would allow WebKit to
555         simply specify a background color on the text field cell, and have AppKit render it properly to the edges of the
556         bezels.
557
558         Covered by a test that is currently failing on Mojave: fast/forms/hidpi-textfield-background-bleeding.html
559
560         * rendering/RenderThemeMac.mm:
561         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
562         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
563         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:]):
564
565 2018-06-13  Thibault Saunier  <tsaunier@igalia.com>
566
567         [WPE] Build getUserMedia support
568         https://bugs.webkit.org/show_bug.cgi?id=186547
569
570         Reviewed by Alejandro G. Castro.
571
572         Enable mediastream tests.
573
574         * PlatformWPE.cmake: Build MediaStream support.
575         * SourcesGTK.txt: Moved GStreamer related files to GStreamer.cmake.
576         * SourcesWPE.txt: Removed `platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp`
577         which is now in GStreamer.cmake.
578         * platform/GStreamer.cmake: Build more MediaStream/webrtc related files.
579         * platform/graphics/ImageBuffer.cpp: Handle the fact that toBGRAData is
580         now built directly into the Cairo backend and not GTK anymore.
581         * platform/graphics/cairo/ImageBufferCairo.cpp: Implement `toBGRAData`
582         * platform/graphics/gtk/ImageBufferGtk.cpp: Removed `toBGRAData` as it is
583         now implemented in the Cairo backend itself.
584         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Switch an
585         ASSERT to RELEASE_ASSERT when adding the GhostPad to itself. This was making
586         test fail when built in RELEASE mode.
587         (WebCore::webkitMediaStreamSrcChain): Minor variable name change to make it
588         more accurate.
589         (WebCore::webkitMediaStreamSrcAddPad): Now add the ghost pad to the element
590         before setting its chain function, making things clearer.
591         (WebCore::webkitMediaStreamSrcSetupSrc): Remove extra new line.
592
593 2018-06-13  Philippe Normand  <pnormand@igalia.com>
594
595         [GStreamer] fast/canvas/webgl crashes
596         https://bugs.webkit.org/show_bug.cgi?id=186590
597
598         Reviewed by Carlos Alberto Lopez Perez.
599
600         After r232747 the sample managed by the player can be empty,
601         without buffer. So we need to check for this before mapping video
602         frames. Also use the GstVideoFrameHolder in more places to reduce
603         copy-paste churn.
604
605         * platform/graphics/gstreamer/ImageGStreamer.h:
606         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
607         (ImageGStreamer::ImageGStreamer):
608         (ImageGStreamer::~ImageGStreamer):
609         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
610         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
611         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
612         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
613
614 2018-06-13  Philippe Normand  <pnormand@igalia.com>
615
616         Unreviewed GTK build fix for --cmakeargs=-DUSE_GSTREAMER_GL=OFF
617
618         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
619         (WebCore::MediaPlayerPrivateGStreamer::load):
620         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
621         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
622
623 2018-06-12  Philippe Normand  <pnormand@igalia.com>
624
625         [GStreamer] Video freezes when GStreamerGL is not installed
626         https://bugs.webkit.org/show_bug.cgi?id=184925
627
628         Reviewed by Žan Doberšek.
629
630         At runtime when the GStreamer opengl plugin isn't available the
631         player will fallback to the internal WebKit video sink. The
632         VideoFrameHolder was refactored to handle both cases (opengl,
633         non-opengl).
634
635         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
636         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
637         (WebCore::GstVideoFrameHolder::~GstVideoFrameHolder):
638         (WebCore::GstVideoFrameHolder::frame const):
639         (WebCore::GstVideoFrameHolder::updateTexture):
640         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
641         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
642         (WebCore::GstVideoFrameHolder::isValid const): Deleted.
643         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Deleted.
644         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
645
646 2018-06-12  Zalan Bujtas  <zalan@apple.com>
647
648         Complex text handling should opt out of bounded text layout.
649         https://bugs.webkit.org/show_bug.cgi?id=186571
650         <rdar://problem/41060908>
651
652         Reviewed by Tim Horton.
653
654         Test: fast/text/complex-long-text-crash.html
655
656         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
657         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
658
659 2018-06-12  Ryan Haddad  <ryanhaddad@apple.com>
660
661         Unreviewed, rolling out r232774.
662
663         Breaks internal builds.
664
665         Reverted changeset:
666
667         "Complex text handling should opt out of bounded text layout."
668         https://bugs.webkit.org/show_bug.cgi?id=186571
669         https://trac.webkit.org/changeset/232774
670
671 2018-06-12  Ryosuke Niwa  <rniwa@webkit.org>
672
673         iOS WK1: Occasional crash in FrameView::setScrollPosition
674         https://bugs.webkit.org/show_bug.cgi?id=186575
675
676         Reviewed by David Kilzer.
677
678         The bug was caused by ScrollView::platformSetScrollPosition releasing the web thread lock
679         and DumpRenderTree requesting a new page load thereby destroying FrameView.
680
681         Fixed the crash by keeping FrameView alive while scrollToFocusedElementTimerFired is getting called.
682
683         No new tests since the bug is caught by existing layout tests under guard malloc.
684
685         * page/FrameView.cpp:
686         (WebCore::FrameView::scrollToFocusedElementTimerFired):
687
688 2018-06-12  Zalan Bujtas  <zalan@apple.com>
689
690         Complex text handling should opt out of bounded text layout.
691         https://bugs.webkit.org/show_bug.cgi?id=186571
692         <rdar://problem/40801429>
693
694         Reviewed by Tim Horton.
695
696         Test: fast/text/complex-long-text-crash.html
697
698         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
699         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
700
701 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
702
703         Unreviewed, fix the Windows build after r232757
704
705         * editing/ReplaceSelectionCommand.cpp:
706         (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren):
707
708 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
709
710         REGRESSION(r228724): Occasional crash when executing ReplaceSelectionCommand at the end of the document
711         https://bugs.webkit.org/show_bug.cgi?id=186555
712         <rdar://problem/39703004>
713
714         Reviewed by Ryosuke Niwa.
715
716         r228724 removed a null check for m_lastNodeInserted in InsertedNodes::pastLastLeaf(). This null check was
717         guarding against the case where m_firstNodeInserted might exist, but m_lastNodeInserted is null, which may
718         happen when inserting content at the end of the document, since InsertedNodes::willRemoveNodePreservingChildren
719         may cause m_lastNodeInserted to be null. This is because the removed node may be at the very end of the document
720         _and also_ not have any children, which means that both `node->lastChild()` as well as
721         `NodeTraversal::nextSkippingChildren(*node)` will be null.
722
723         After getting into this state, we subsequently crash when attempting to compute InsertedNodes::pastLastLeaf().
724         To fix this, avoid accidentally clearing out m_lastNodeInserted; if the last inserted node has neither a child
725         nor a next node, seek backwards to the previous node in the DOM instead, and clamp to the first inserted node,
726         such that the last inserted node's document position is at or after the first inserted node's position.
727
728         Test: editing/execCommand/insert-apple-style-span-at-document-end.html
729
730         * editing/ReplaceSelectionCommand.cpp:
731         (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren):
732
733 2018-06-12  Jianjun Zhu  <jianjun.zhu@intel.com>
734
735         Hash deviceId and groupId of MediaTrackCapabilities.
736         https://bugs.webkit.org/show_bug.cgi?id=186471
737
738         Reviewed by Eric Carlson.
739
740         This change makes the identifier for the source of the MediaStreamTrack
741         has the same value returned by enumerateDevices(). It also prevents real
742         device ID being leaked.
743
744         (WebCore::MediaStreamTrack::getCapabilities const):
745         * Modules/mediastream/MediaStreamTrack.h:
746         * Modules/mediastream/MediaStreamTrack.idl:
747
748 2018-06-12  Philippe Normand  <pnormand@igalia.com>
749
750         Unreviewed WPE build fix after r232749.
751
752         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
753
754 2018-06-12  Zalan Bujtas  <zalan@apple.com>
755
756         [LFC] Add vertical margin computation for inflow non-replaced box and for the (10.6.6) complicated cases.
757         https://bugs.webkit.org/show_bug.cgi?id=186469
758
759         Reviewed by Antti Koivisto.
760
761         * layout/FormattingContextGeometry.cpp:
762         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
763         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
764         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
765         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
766         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
767
768 2018-06-12  Philippe Normand  <pnormand@igalia.com>
769
770         [GStreamer] Bump required version to 1.8.3
771         https://bugs.webkit.org/show_bug.cgi?id=186558
772
773         Reviewed by Xabier Rodriguez-Calvar.
774
775         * platform/GStreamer.cmake: Remove useless file.
776         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
777         (webKitWebAudioSrcChangeState): Remove useless version check.
778         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
779         Removed. createDecryptor() is dead code since the decryptors moved
780         to the MSE playback pipeline.
781         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
782         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
783
784 2018-06-11  Philippe Normand  <philn@igalia.com>
785
786         [GStreamer] flush video sample upon DRAIN query
787         https://bugs.webkit.org/show_bug.cgi?id=186481
788
789         Reviewed by Xabier Rodriguez-Calvar.
790
791         Use the appsink sink pad pad probe for both event and drain query
792         management. This patch is partially based on
793         https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d3a336523d123119fe1dd53da5d9006c92cf078c
794         by Enrique Ocaña González <eocanha@igalia.com>.
795
796         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
797         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
798         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
799
800 2018-06-11  Zalan Bujtas  <zalan@apple.com>
801
802         [LFC] Replace HorizontalGeometry::width and margin with WidthAndMargin (Vertical too)
803         https://bugs.webkit.org/show_bug.cgi?id=186556
804
805         Reviewed by Sam Weinig.
806
807         HorizontalGeometry::width and margin -> WidthAndMargin
808         VerticalGeometry::height and margin -> HeightAndMargin
809
810         * layout/FormattingContext.cpp:
811         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
812         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
813         * layout/FormattingContext.h:
814         * layout/FormattingContextGeometry.cpp:
815         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
816         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
817         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
818         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
819         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
820         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
821         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
822
823 2018-06-11  Youenn Fablet  <youenn@apple.com>
824
825         Improve error messages in case FetchEvent.respondWith has a rejected promise
826         https://bugs.webkit.org/show_bug.cgi?id=186368
827
828         Reviewed by Chris Dumez.
829
830         Covered by rebased tests.
831
832         Introduce a new error domain for service worker ResourceError.
833         Used this domain to log in the console any such error.
834
835         Update FetchEvent implementation to get meaningful error messages for respondWith error cases.
836         In particular, convert the rejected promise JS value as a string to populate the error message.
837
838         * loader/SubresourceLoader.cpp:
839         (WebCore::SubresourceLoader::didFail):
840         * platform/network/ResourceErrorBase.cpp:
841         * platform/network/ResourceErrorBase.h:
842         * testing/ServiceWorkerInternals.cpp:
843         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
844         * workers/service/FetchEvent.cpp:
845         (WebCore::FetchEvent::~FetchEvent):
846         (WebCore::FetchEvent::createResponseError):
847         (WebCore::FetchEvent::onResponse):
848         (WebCore::FetchEvent::respondWithError):
849         (WebCore::FetchEvent::processResponse):
850         (WebCore::FetchEvent::promiseIsSettled):
851         * workers/service/FetchEvent.h:
852         * workers/service/context/ServiceWorkerFetch.cpp:
853         (WebCore::ServiceWorkerFetch::processResponse):
854         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
855
856 2018-06-11  Chris Dumez  <cdumez@apple.com>
857
858         http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html times out with PSON enabled
859         https://bugs.webkit.org/show_bug.cgi?id=186546
860
861         Reviewed by Brady Eidson.
862
863         Add a hasOpenedFrames flag to NavigationAction, which we'll use in the UIProcess when deciding
864         to process swap on navigation or not.
865
866         Test: http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html
867
868         * loader/FrameLoader.cpp:
869         (WebCore::FrameLoader::loadURL):
870         * loader/NavigationAction.h:
871         (WebCore::NavigationAction::hasOpenedFrames const):
872         (WebCore::NavigationAction::setHasOpenedFrames):
873
874 2018-06-11  Tim Horton  <timothy_horton@apple.com>
875
876         Link drag image is inconsistently unreadable in dark mode
877         https://bugs.webkit.org/show_bug.cgi?id=186472
878
879         Reviewed by Timothy Hatcher.
880
881         * platform/mac/DragImageMac.mm:
882         (WebCore::createDragImageForLink):
883         Use LocalDefaultSystemAppearance so that NSColors used inside
884         createDragImageForLink are interpreted correctly. This function
885         always follows the system appearance regardless of what the preference
886         is set to, because it's generating UI that isn't part of the page.
887
888         Use controlBackgroundColor to get a consistently contrasting background
889         for the link drag image.
890
891 2018-06-11  Chris Dumez  <cdumez@apple.com>
892
893         http/tests/security/cors-post-redirect-307.html fails with PSON enabled
894         https://bugs.webkit.org/show_bug.cgi?id=186441
895
896         Reviewed by Brady Eidson.
897
898         When we are continuing a load in a new process, we currently bypass the navigation policy
899         check. We now also bypass the adding of headers such as the Origin one since the request
900         was already processed in the previous process. This is important because in the case of
901         a cross-origin redirect, the previous process has removed the Origin header from the
902         request and we do not want the new process to add it again.
903
904         Test: http/tests/security/cors-post-redirect-307-pson.html
905
906         * WebCore.xcodeproj/project.pbxproj:
907         * history/BackForwardController.cpp:
908         (WebCore::BackForwardController::goBackOrForward):
909         (WebCore::BackForwardController::goBack):
910         (WebCore::BackForwardController::goForward):
911         * loader/FrameLoadRequest.h:
912         (WebCore::FrameLoadRequest::setShouldTreatAsContinuingLoad):
913         (WebCore::FrameLoadRequest::shouldTreatAsContinuingLoad const):
914         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): Deleted.
915         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): Deleted.
916         * loader/FrameLoader.cpp:
917         (WebCore::FrameLoader::loadURLIntoChildFrame):
918         (WebCore::FrameLoader::load):
919         (WebCore::FrameLoader::loadWithNavigationAction):
920         (WebCore::FrameLoader::loadWithDocumentLoader):
921         (WebCore::FrameLoader::reloadWithOverrideEncoding):
922         (WebCore::FrameLoader::reload):
923         (WebCore::FrameLoader::addExtraFieldsToRequest):
924         (WebCore::FrameLoader::addHTTPOriginIfNeeded):
925         (WebCore::FrameLoader::loadDifferentDocumentItem):
926         (WebCore::FrameLoader::loadItem):
927         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
928         * loader/FrameLoader.h:
929         * loader/HistoryController.cpp:
930         (WebCore::HistoryController::goToItem):
931         (WebCore::HistoryController::setDefersLoading):
932         (WebCore::HistoryController::recursiveGoToItem):
933         * loader/HistoryController.h:
934         * loader/ShouldTreatAsContinuingLoad.h: Renamed from Source/WebCore/loader/NavigationPolicyCheck.h.
935         * page/Page.cpp:
936         (WebCore::Page::goToItem):
937         * page/Page.h:
938
939 2018-06-11  Youenn Fablet  <youenn@apple.com>
940
941         Accept request header values should be more tightly checked after r232572 in case of CORS load
942         https://bugs.webkit.org/show_bug.cgi?id=186533
943         <rdar://problem/40933880>
944
945         Reviewed by Darin Adler.
946
947         Covered by updated test.
948
949         * platform/network/HTTPParsers.cpp:
950         (WebCore::isValidAcceptHeaderValue): Checking that Accept header value conforms with RFC7370.
951         If not, this will trigger preflighting for CORS cross origin loads.
952         Current checks for Accept-Language and Content-Language are sufficient to ensure values conform with RFC7370.
953
954 2018-06-11  Chris Dumez  <cdumez@apple.com>
955
956         Crash under com.apple.WebKit.Networking at WebCore: WebCore::NetworkStorageSession::hasStorageAccess const
957         https://bugs.webkit.org/show_bug.cgi?id=186433
958         <rdar://problem/40750907>
959
960         Reviewed by Geoffrey Garen.
961
962         Do some hardening in NetworkStorageSession::hasStorageAccess() to make sure
963         we do not try and do a HashMap lookup with a null firstPartyDomain, as this
964         would crash.
965
966         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
967         (WebCore::NetworkStorageSession::hasStorageAccess const):
968
969 2018-06-11  Zalan Bujtas  <zalan@apple.com>
970
971         [LFC] Remove redundant position functions for out-of-flow elements
972         https://bugs.webkit.org/show_bug.cgi?id=186525
973
974         Reviewed by Antti Koivisto.
975
976         Position is computed as part of the Horizontal/Vertical geometry computation.
977         (see outOfFlow(Non)ReplacedHorizontalGeometry/outOfFlow(Non)ReplacedVerticalGeometry functions)
978
979         * layout/FormattingContext.cpp:
980         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
981         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): Deleted.
982         * layout/FormattingContext.h:
983         * layout/FormattingContextGeometry.cpp:
984         (WebCore::Layout::outOfFlowNonReplacedPosition): Deleted.
985         (WebCore::Layout::outOfFlowReplacedPosition): Deleted.
986         (WebCore::Layout::FormattingContext::Geometry::outOfFlowPosition): Deleted.
987
988 2018-06-11  Zalan Bujtas  <zalan@apple.com>
989
990         [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow replaced elements
991         https://bugs.webkit.org/show_bug.cgi?id=186524
992
993         Reviewed by Antti Koivisto.
994
995         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-height
996         (10.6.5 Absolutely positioned, replaced elements)
997
998         * layout/FormattingContextGeometry.cpp:
999         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1000
1001 2018-06-11  Zalan Bujtas  <zalan@apple.com>
1002
1003         [LFC] Merge left, right, width and horizontal margin computation for out-of-flow replaced elements
1004         https://bugs.webkit.org/show_bug.cgi?id=186475
1005
1006         Reviewed by Antti Koivisto.
1007
1008         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-width
1009         (10.3.8 Absolutely positioned, replaced elements)
1010
1011         * layout/FormattingContext.cpp:
1012         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1013         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1014         (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted.
1015         * layout/FormattingContext.h:
1016         * layout/FormattingContextGeometry.cpp:
1017         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1018         (WebCore::Layout::computedValueIfNotAuto):
1019         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1020         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1021         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted.
1022         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted.
1023         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted.
1024
1025 2018-06-11  Zalan Bujtas  <zalan@apple.com>
1026
1027         [LFC] Merge left, right, width and horizontal margin computation for out-of-flow non-replaced elements
1028         https://bugs.webkit.org/show_bug.cgi?id=186474
1029
1030         Reviewed by Antti Koivisto.
1031
1032         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-width 
1033         (10.3.7 Absolutely positioned, non-replaced elements)
1034
1035         * layout/FormattingContext.cpp:
1036         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1037         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1038         (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted.
1039         * layout/FormattingContext.h:
1040         * layout/FormattingContextGeometry.cpp:
1041         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1042         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1043         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1044         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted.
1045         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted.
1046         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted.
1047
1048 2018-06-10  Zalan Bujtas  <zalan@apple.com>
1049
1050         [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow non-replaced elements
1051         https://bugs.webkit.org/show_bug.cgi?id=186476
1052
1053         Reviewed by Antti Koivisto.
1054
1055         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height
1056         (10.6.4 Absolutely positioned, non-replaced elements)
1057
1058         * layout/FormattingContext.cpp:
1059         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1060         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1061         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): Deleted.
1062         * layout/FormattingContext.h:
1063         * layout/FormattingContextGeometry.cpp:
1064         (WebCore::Layout::computedValueIfNotAuto):
1065         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1066         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1067         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
1068         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin): Deleted.
1069         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin): Deleted.
1070         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin): Deleted.
1071
1072 2018-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1073
1074         [GTK][WPE] Add API run run javascript from a WebKitWebView in an isolated world
1075         https://bugs.webkit.org/show_bug.cgi?id=186192
1076
1077         Reviewed by Michael Catanzaro.
1078
1079         * bindings/js/ScriptController.cpp:
1080         (WebCore::ScriptController::executeScriptInWorld): Add ExceptionDetails parameter.
1081         * bindings/js/ScriptController.h:
1082
1083 2018-06-10  Michael Catanzaro  <mcatanzaro@igalia.com>
1084
1085         [WPE][GTK] paypal.com requires user agent quirk
1086         https://bugs.webkit.org/show_bug.cgi?id=186466
1087
1088         Reviewed by Carlos Garcia Campos.
1089
1090         * platform/UserAgentQuirks.cpp:
1091         (WebCore::urlRequiresMacintoshPlatform):
1092
1093 2018-06-09  Dan Bernstein  <mitz@apple.com>
1094
1095         [Xcode] Clean up and modernize some build setting definitions
1096         https://bugs.webkit.org/show_bug.cgi?id=186463
1097
1098         Reviewed by Sam Weinig.
1099
1100         * Configurations/Base.xcconfig: Removed definition for macOS 10.11.
1101         * Configurations/DebugRelease.xcconfig: Ditto.
1102         * Configurations/FeatureDefines.xcconfig: Simplified the definitions of ENABLE_APPLE_PAY and
1103           ENABLE_VIDEO_PRESENTATION_MODE now macOS 10.12 is the earliest supported version.
1104         * Configurations/Version.xcconfig: Removed definition for macOS 10.11.
1105         * Configurations/WebCore.xcconfig: Simplified the definition of WK_PRIVATE_FRAMEWORKS_DIR
1106           now that WK_XCODE_SUPPORTS_TEXT_BASED_STUBS is true for all supported Xcode versions.
1107         * Configurations/WebKitTargetConditionals.xcconfig: Removed definitions for macOS 10.11.
1108
1109 2018-06-09  Dan Bernstein  <mitz@apple.com>
1110
1111         Added missing file references to the Configuration group.
1112
1113         * WebCore.xcodeproj/project.pbxproj:
1114
1115 2018-06-09  Zalan Bujtas  <zalan@apple.com>
1116
1117         REGRESSION (r230480): Cannot adjust photo position on LinkedIn's profile page
1118         https://bugs.webkit.org/show_bug.cgi?id=186464
1119         <rdar://problem/40369448>
1120
1121         Reviewed by Simon Fraser.
1122
1123         The optimization logic for skipping image layout when we only need overflow computation should check if the image actually needs
1124         simplified layout only. The needsSimplifiedNormalFlowLayout() flag means that the overflow information needs to be updated but
1125         it does not mean that overflow is the only property that we need to recompute.
1126
1127         Test: fast/images/positioned-image-when-transform-is-present.html
1128
1129         * rendering/RenderImage.cpp:
1130         (WebCore::RenderImage::layout):
1131         * rendering/RenderObject.h:
1132         (WebCore::RenderObject::needsSimplifiedNormalFlowLayoutOnly const):
1133
1134 2018-06-09  Ryosuke Niwa  <rniwa@webkit.org>
1135
1136         REGRESSION(macOS Mojave): move-by-word-visually-multi-line.html fails
1137         https://bugs.webkit.org/show_bug.cgi?id=186454
1138
1139         Reviewed by Darin Adler.
1140
1141         Like r232635, this patch fixes a selection test failure caused by the change in ICU's behavior in macOS Mojave,
1142         which caused isWordTextBreak to return true in more cases.
1143
1144         In this particular failing test case, previousTextOrLineBreakBox and nextTextOrLineBreakBox were failing to find
1145         an inline text box when it found an inline box for a BR, which was mentioned by an existing FIXME comment.
1146         Consequently, visualWordPosition were erroneously detecting the end of a word followed by a blank line created by
1147         a BR as a valid word boundary to move when the Windows editing behavior is enacted.
1148
1149         Addressed the FIXME comment by finding the next inline text box skipping all inline boxes for BRs. Renamed
1150         misleadingly named previousBoxInDifferentBlock and nextBoxInDifferentBlock to previousBoxInDifferentLine and
1151         nextBoxInDifferentLine respectively, and set them to true as they're really indicating whether line boxes
1152         belong to a distinct line or not; whether an inline box belong to two (render) blocks or not is irrelevant.
1153
1154         Finally, this patch fixes a bug in visualWordPosition that it was failing to skip blank lines when a word break is
1155         found as we traversed past a line break. In those cases, we must skip all line breaks before stopping.
1156
1157         Tests: editing/selection/move-by-word-visually-mac.html
1158                editing/selection/move-by-word-visually-multi-line.htm
1159
1160         * editing/VisibleUnits.cpp:
1161         (WebCore::CachedLogicallyOrderedLeafBoxes::previousTextOrLineBreakBox):
1162         (WebCore::CachedLogicallyOrderedLeafBoxes::nextTextOrLineBreakBox):
1163         (WebCore::CachedLogicallyOrderedLeafBoxes::boxIndexInLeaves const):
1164         (WebCore::logicallyPreviousBox):
1165         (WebCore::logicallyNextBox):
1166         (WebCore::wordBreakIteratorForMinOffsetBoundary):
1167         (WebCore::wordBreakIteratorForMaxOffsetBoundary):
1168         (WebCore::visualWordPosition):
1169
1170 2018-06-09  Zalan Bujtas  <zalan@apple.com>
1171
1172         [LFC] MarginCollapse functions should be able to resolve non-fixed margin values
1173         https://bugs.webkit.org/show_bug.cgi?id=186461
1174
1175         Reviewed by Antti Koivisto.
1176
1177         We need the containing block's computed width to resolve vertical and horizontal margins.
1178
1179         * layout/blockformatting/BlockFormattingContext.h:
1180         * layout/blockformatting/BlockMarginCollapse.cpp:
1181         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
1182         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
1183         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
1184         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
1185         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
1186         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
1187         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
1188         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
1189         (WebCore::Layout::collapsedMarginTopFromFirstChild): Deleted.
1190         (WebCore::Layout::nonCollapsedMarginTop): Deleted.
1191
1192 2018-06-08  Darin Adler  <darin@apple.com>
1193
1194         [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC
1195         https://bugs.webkit.org/show_bug.cgi?id=186436
1196
1197         Reviewed by Anders Carlsson.
1198
1199         * bridge/objc/objc_class.mm: Use import instead of include.
1200
1201         * bridge/objc/objc_instance.h: Replaced _pool member to hold an object with
1202         m_autoreleasePool member to hold a token from objc_autoreleasePoolPush. Also
1203         initialize all data members here in the class definition.
1204
1205         * bridge/objc/objc_instance.mm:
1206         (ObjcInstance::ObjcInstance): Moved most initialization to class definition.
1207         (ObjcInstance::virtualBegin): Use objc_autoreleasePoolPush instead of
1208         NSAutoreleasePool class.
1209         (ObjcInstance::virtualEnd): Use objc_autoreleasePoolPop.
1210
1211         * bridge/objc/objc_runtime.mm: Use import instead of include.
1212         * bridge/objc/objc_utility.mm: Ditto.
1213
1214         * platform/audio/mac/AudioBusMac.mm:
1215         (WebCore::AudioBus::loadPlatformResource): Use @autoreleasepool.
1216
1217         * platform/ios/wak/WebCoreThread.mm: Re-sorted includes. Removed declaration of
1218         autorelease pool SPI and use FoundationSPI.h instead.
1219
1220         * platform/network/cocoa/ResourceResponseCocoa.mm:
1221         (WebCore::ResourceResponse::platformLazyInit): Use @autoreleasepool.
1222
1223 2018-06-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1224
1225         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 1)
1226         https://bugs.webkit.org/show_bug.cgi?id=186442
1227         <rdar://problem/40879364>
1228
1229         Reviewed by Tim Horton.
1230
1231         No change in behavior.
1232
1233         * Configurations/FeatureDefines.xcconfig:
1234         * page/DisabledAdaptations.cpp:
1235         (WebCore::extraZoomModeAdaptationName):
1236
1237 2018-06-08  Per Arne Vollan  <pvollan@apple.com>
1238
1239         Only display refresh monitors having requested display refresh callback should get notified on screen updates.
1240         https://bugs.webkit.org/show_bug.cgi?id=186397
1241         <rdar://problem/40897835>
1242
1243         Reviewed by Brent Fulgham.
1244
1245         Since all display refresh monitors in the WebContent process share a single UI process display link,
1246         we should make sure that only the monitors having requested callback are getting notified on screen
1247         updates. I have not been able to reproduce a case where a monitor is being notified without having
1248         requested updates, but we should safeguard the code for future code changes.
1249
1250         No new tests, since this is a safeguarding measure.
1251
1252         * platform/graphics/DisplayRefreshMonitor.h:
1253         (WebCore::DisplayRefreshMonitor::hasRequestedRefreshCallback const):
1254         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1255         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
1256
1257 2018-06-07  Jer Noble  <jer.noble@apple.com>
1258
1259         REGRESSION:  Cannot listen to audio on Google Translate with side switch set to "vibrate"
1260         https://bugs.webkit.org/show_bug.cgi?id=186415
1261         <rdar://problem/40584651>
1262
1263         Reviewed by Eric Carlson.
1264
1265         Test: platform/mac/media/audio-session-category-audio-autoplay.html
1266
1267         Make sure that the PlatformMediaSession's state has already been set when calling updateSessionStates().
1268
1269         * platform/audio/PlatformMediaSession.cpp:
1270         (WebCore::PlatformMediaSession::setState):
1271         * platform/audio/PlatformMediaSessionManager.cpp:
1272         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
1273         (WebCore::PlatformMediaSessionManager::sessionStateChanged):
1274
1275 2018-06-08  Dean Jackson  <dino@apple.com>
1276
1277         'setRenderPipelineState:' is unavailable: not available on iOS
1278         https://bugs.webkit.org/show_bug.cgi?id=186449
1279         <rdar://problem/40880602>
1280
1281         Reviewed by Simon Fraser.
1282
1283         Be more explicit about the protocol type to avoid
1284         the compiler getting confused by a similar signature.
1285
1286         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm:
1287         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
1288
1289 2018-06-08  Darin Adler  <darin@apple.com>
1290
1291         Fix iOS build.
1292
1293         * platform/ios/QuickLookSoftLink.mm: Removed QLPreviousScheme, which I said I did in the
1294         change log but looks like it didn't happen.
1295
1296 2018-06-08  Darin Adler  <darin@apple.com>
1297
1298         [Cocoa] Make more of our soft linking ARC-compatible
1299         https://bugs.webkit.org/show_bug.cgi?id=186437
1300
1301         Reviewed by Daniel Bates.
1302
1303         * editing/cocoa/DataDetection.mm:
1304         (WebCore::removeResultLinksFromAnchor): Fix comment referring to unused constant DDURLScheme.
1305
1306         * platform/cocoa/DataDetectorsCoreSoftLink.h: Removed unused DDURLScheme.
1307         * platform/cocoa/DataDetectorsCoreSoftLink.mm: Ditto.
1308
1309         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1310         Use SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using
1311         SOFT_LINK_POINTER_OPTIONAL. Required moving iOS-specific items inside the
1312         #if PLATFORM(IOS) section.
1313         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Use the
1314         canLoad functions instead of checking for null to handle possibly-missing string constants.
1315         (WebCore::metadataType): Ditto.
1316
1317         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Removed unused
1318         AVMediaTypeVideo, AVMediaTypeAudio, and AVMediaTypeText soft linking.
1319
1320         * platform/ios/QuickLook.mm:
1321         (WebCore::isQuickLookPreviewURL): Removed unneeded assertion.
1322
1323         * platform/ios/QuickLookSoftLink.h: Removed unneeded QLPreviousScheme, which was used only
1324         for an assertion, one we can do without.
1325         * platform/ios/QuickLookSoftLink.mm: Ditto.
1326
1327         * platform/mediastream/mac/AVVideoCaptureSource.mm: Removed unused soft linking of
1328         AVCaptureVideoPreviewLayer class and AVCaptureSessionPresetLow string constant. Use
1329         SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using
1330         SOFT_LINK_POINTER_OPTIONAL.
1331         (WebCore::AVVideoCaptureSource::initializeCapabilities): Use the canLoad functions
1332         instead of checking for null to handle possibly-missing string constants.
1333         (WebCore::sizeForPreset): Ditto.
1334         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions const): Ditto.
1335
1336 2018-06-08  Aditya Keerthi  <akeerthi@apple.com>
1337
1338         [Datalist] Allow TextFieldInputType to show and hide suggestions
1339         https://bugs.webkit.org/show_bug.cgi?id=186151
1340
1341         Reviewed by Tim Horton.
1342
1343         TextFieldInputTypes with a list attribute should be able to display suggestions as the user
1344         interacts with the input field. In order to display suggestions for an input field with a list
1345         attribute, we need provide certain information - including the items to suggest and the location
1346         to present the suggestions. TextFieldInputType can now provide this information by conforming to
1347         the DataListSuggestionsClient interface.
1348
1349         In this initial patch, the suggestions can be shown in two ways. The first is by clicking on the
1350         input field. The other is by typing text in the field. In a later patch, we will add a third way
1351         to display suggestions, using a button. These ways to activate the suggestions are enumerated in
1352         DataListSuggestionInformation.
1353
1354         We hide the suggestions if there are no more to show, or if the input has blurred.
1355
1356         Tests to be added once work has been done in the UIProcess.
1357
1358         * WebCore.xcodeproj/project.pbxproj:
1359         * html/DataListSuggestionInformation.h: Added. Contains the information necessary to display suggestions.
1360         * html/TextFieldInputType.cpp:
1361         (WebCore::TextFieldInputType::~TextFieldInputType):
1362         (WebCore::TextFieldInputType::handleClickEvent): Show suggestions when the element is clicked.
1363         (WebCore::TextFieldInputType::handleKeydownEvent): Allow users to interact with the suggestions using the keyboard.
1364         (WebCore::TextFieldInputType::elementDidBlur): Hide the suggestions.
1365         (WebCore::TextFieldInputType::shouldRespectListAttribute):
1366         (WebCore::TextFieldInputType::didSetValueByUserEdit): Update the suggestions if the text has changed.
1367         (WebCore::TextFieldInputType::elementRectRelativeToRootView const): Provide the location where the suggestions should be shown.
1368         (WebCore::TextFieldInputType::suggestions const): Provide the list of suggestions.
1369         (WebCore::TextFieldInputType::didSelectDataListOption): Update the text once an suggestion has been selected.
1370         (WebCore::TextFieldInputType::didCloseSuggestions):
1371         (WebCore::TextFieldInputType::displaySuggestions):
1372         (WebCore::TextFieldInputType::closeSuggestions):
1373         * html/TextFieldInputType.h:
1374         * loader/EmptyClients.cpp:
1375         (WebCore::EmptyChromeClient::createDataListSuggestionPicker):
1376         * loader/EmptyClients.h:
1377         * page/Chrome.cpp:
1378         (WebCore::Chrome::createDataListSuggestionPicker):
1379         * page/Chrome.h:
1380         * page/ChromeClient.h:
1381         * platform/DataListSuggestionPicker.h: Added.
1382         (WebCore::DataListSuggestionPicker::close):
1383         (WebCore::DataListSuggestionPicker::handleKeydownWithIdentifier):
1384         (WebCore::DataListSuggestionPicker::displayWithActivationType):
1385         * platform/DataListSuggestionsClient.h: Added.
1386
1387 2018-06-07  Ryosuke Niwa  <rniwa@webkit.org>
1388
1389         REGRESSION(macOS Mojave): move-by-word-visually-inline-block-positioned-element.html fails
1390         https://bugs.webkit.org/show_bug.cgi?id=186424
1391
1392         Reviewed by Wenson Hsieh.
1393
1394         The test failure is ultimately caused by the change in ICU's behavior. With the CPU in the latest macOS Mojave,
1395         ubrk_getRuleStatus returns 200 / UBRK_WORD_LETTER at the end of a buffer given to UBreakIterator. This caused
1396         isWordTextBreak to return true instead of false in isLogicalStartOfWord at the end of the buffer.
1397
1398         This ICU behavior shouldn't have caused a problem in theory. However, WebKit had a bug in visualWordPosition which
1399         caused UBreakIterator to not include the succeeding word when traversing words to the left (backwards in LTR text)
1400         at the beginning of the last block element with exactly one line box after an non-statically positioned element.
1401
1402         In this case, visualWordPosition invokes wordBreakIteratorForMaxOffsetBoundary (because adjacentCharacterPosition
1403         is now at the end of the last word in the non-statically positioned element) to setup UBreakIterator. Because
1404         there are no line boxes left in the current line (in the last block element with exactly one line box),
1405         logicallyNextBox enters the while loop and invoke nextRootInlineBoxCandidatePosition to find the next root line box.
1406         However, the visible position given to this function is at the beginning of the first word in the block element.
1407         As a result, nextRootInlineBoxCandidatePosition skips over this entire line and finds no line box after the one
1408         we had in the non-statically positioned element.
1409
1410         Let us consider the following concrete example in which a position: static div is followed by another div, and each
1411         div contains text nodes "hello" and "world" respectively:
1412         - div position: static (1)
1413             - "hello"
1414         - div (2)
1415             - "world"
1416         Suppose we're at the offset 0 of "world", and trying to move to the left. In this case, adjacentCharacterPosition is
1417         at offset 5 of "world". The next line box should be that of "world". However, because we invoke logicallyNextBox via
1418         wordBreakIteratorForMaxOffsetBoundary with the visible position at offset 0 of "world", it skips this line and return
1419         nullptr.
1420
1421         This patch addresses this test failure by fixing visualWordPosition by passing adjacentCharacterPosition (at offset 5
1422         of "hello") as the visible position to find the next text box so that nextRootInlineBoxCandidatePosition invoked in
1423         logicallyNextBox would not skip the line ("world") from which we started the traversal to find the next line box.
1424
1425         Tests: editing/selection/move-by-word-visually-inline-block-positioned-element.html
1426
1427         * editing/VisibleUnits.cpp:
1428         (WebCore::visualWordPosition):
1429
1430 2018-06-08  Brent Fulgham  <bfulgham@apple.com>
1431
1432         REGRESSION (r230930): Link drag image is very blurry
1433         https://bugs.webkit.org/show_bug.cgi?id=186435
1434         <rdar://problem/40797202>
1435
1436         Reviewed by Tim Horton.
1437
1438         Tell NSImage the proper display scale factor it needs when performing a 'lockFocus' by passing
1439         the correct scaling transform as an NSImageHintCTM.
1440
1441         I reviewed the other drag operations (selection, image, and attachment) and confirmed through
1442         manual testing that these operations already properly scale the images. It appears that links
1443         were the only place where we relied on NSImage to determine and use the relevant device scale
1444         factor.
1445
1446         * SourcesCocoa.txt: Add new WebKitNSImageExtras.mm file.
1447         * WebCore.xcodeproj/project.pbxproj: Update for new files.
1448         * platform/graphics/mac/WebKitNSImageExtras.h: Added.
1449         * platform/graphics/mac/WebKitNSImageExtras.mm: Added.
1450         (-[NSImage _web_lockFocusWithTransform:]): Helper method that takes a device scale factor, creates the
1451         relevant scaling NSAffineTransform and passes it to the internal NSImage 'lockFocusWithRect' as the
1452         NSImageHintCTM hint.
1453         * platform/mac/DragImageMac.mm:
1454         (WebCore::createDragImageForLink): Use the new helper function.
1455
1456 2018-06-08  Zalan Bujtas  <zalan@apple.com>
1457
1458         [LFC] Add vertical margin computation for inline, block-level, inline-block and floating replaced elements
1459         https://bugs.webkit.org/show_bug.cgi?id=186432
1460
1461         Reviewed by Antti Koivisto.
1462
1463         * layout/FormattingContext.h:
1464         * layout/FormattingContextGeometry.cpp:
1465         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1466         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Use the computed non-auto values when margin is not auto.
1467         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1468         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1469         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1470
1471 2018-06-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1472
1473         [WTF] Add WorkerPool
1474         https://bugs.webkit.org/show_bug.cgi?id=174569
1475
1476         Reviewed by Carlos Garcia Campos.
1477
1478         We start using WorkerPool for NicosiaPaintingEngineThreaded instead of glib thread pool.
1479         This makes NicosiaPaintingEngineThreaded platform-independent and usable for WinCairo.
1480
1481         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
1482         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
1483         (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded):
1484         (Nicosia::PaintingEngineThreaded::paint):
1485         (Nicosia::s_threadFunc): Deleted.
1486         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
1487
1488 2018-06-08  Miguel Gomez  <magomez@igalia.com>
1489
1490         [GTK][WPE] Wrong result when calling ImageBufferCairo's getImageData()
1491         https://bugs.webkit.org/show_bug.cgi?id=186384
1492
1493         Reviewed by Michael Catanzaro.
1494
1495         Fix calculations so the result is the expected one.
1496
1497         * platform/graphics/cairo/ImageBufferCairo.cpp:
1498         (WebCore::getImageData):
1499
1500 2018-06-07  Fujii Hironori  <Hironori.Fujii@sony.com>
1501
1502         Add base class to get WeakPtrFactory member and avoid some boilerplate code
1503         https://bugs.webkit.org/show_bug.cgi?id=186407
1504         <rdar://problem/40922716>
1505
1506         Unreviewed WinCairo build fix
1507
1508         MediaPlayerPrivateMediaFoundation.cpp(1726): error C2039: 'makeWeakPtr': is not a member of 'WebCore::MediaPlayerPrivateMediaFoundation'
1509
1510         No new tests (No behavior change).
1511
1512         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1513         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
1514
1515 2018-06-07  Chris Dumez  <cdumez@apple.com>
1516
1517         Add base class to get WeakPtrFactory member and avoid some boilerplate code
1518         https://bugs.webkit.org/show_bug.cgi?id=186407
1519
1520         Reviewed by Brent Fulgham.
1521
1522         Add CanMakeWeakPtr base class to get WeakPtrFactory member and its getter, in
1523         order to avoid some boilerplate code in every class needing a WeakPtrFactory.
1524         This also gets rid of old-style createWeakPtr() methods in favor of the newer
1525         makeWeakPtr().
1526
1527         * Modules/credentialmanagement/CredentialsMessenger.h:
1528         * Modules/credentialmanagement/NavigatorCredentials.cpp:
1529         (WebCore::NavigatorCredentials::credentials):
1530         * Modules/encryptedmedia/CDM.cpp:
1531         (WebCore::CDM::doSupportedConfigurationStep):
1532         (WebCore::CDM::getConsentStatus):
1533         * Modules/encryptedmedia/CDM.h:
1534         * Modules/encryptedmedia/MediaKeySession.cpp:
1535         (WebCore::MediaKeySession::generateRequest):
1536         (WebCore::MediaKeySession::load):
1537         (WebCore::MediaKeySession::update):
1538         (WebCore::MediaKeySession::close):
1539         (WebCore::MediaKeySession::remove):
1540         * Modules/encryptedmedia/MediaKeySession.h:
1541         * Modules/encryptedmedia/MediaKeys.cpp:
1542         (WebCore::MediaKeys::createSession):
1543         * Modules/encryptedmedia/MediaKeys.h:
1544         * Modules/gamepad/GamepadManager.cpp:
1545         (WebCore::GamepadManager::platformGamepadDisconnected):
1546         (WebCore::GamepadManager::makeGamepadVisible):
1547         * Modules/mediastream/MediaDevices.cpp:
1548         (WebCore::MediaDevices::MediaDevices):
1549         * Modules/mediastream/MediaDevices.h:
1550         * Modules/mediastream/MediaStreamTrack.cpp:
1551         (WebCore::MediaStreamTrack::applyConstraints):
1552         * Modules/mediastream/MediaStreamTrack.h:
1553         * Modules/webauthn/cocoa/LocalAuthenticator.h:
1554         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
1555         (WebCore::LocalAuthenticator::makeCredential):
1556         * accessibility/AccessibilityRenderObject.h:
1557         * accessibility/AccessibilitySVGRoot.cpp:
1558         (WebCore::AccessibilitySVGRoot::setParent):
1559         * crypto/SubtleCrypto.cpp:
1560         (WebCore::SubtleCrypto::encrypt):
1561         (WebCore::SubtleCrypto::decrypt):
1562         (WebCore::SubtleCrypto::sign):
1563         (WebCore::SubtleCrypto::verify):
1564         (WebCore::SubtleCrypto::digest):
1565         (WebCore::SubtleCrypto::generateKey):
1566         (WebCore::SubtleCrypto::deriveKey):
1567         (WebCore::SubtleCrypto::deriveBits):
1568         (WebCore::SubtleCrypto::importKey):
1569         (WebCore::SubtleCrypto::exportKey):
1570         (WebCore::SubtleCrypto::wrapKey):
1571         (WebCore::SubtleCrypto::unwrapKey):
1572         * crypto/SubtleCrypto.h:
1573         * css/CSSFontFace.cpp:
1574         (WebCore::CSSFontFace::CSSFontFace):
1575         (WebCore::CSSFontFace::wrapper):
1576         (WebCore::CSSFontFace::setWrapper):
1577         * css/DeprecatedCSSOMValue.h:
1578         * css/FontFace.cpp:
1579         * css/FontFace.h:
1580         * css/MediaQueryEvaluator.cpp:
1581         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
1582         * css/StyleSheetContents.h:
1583         * css/parser/CSSDeferredParser.cpp:
1584         (WebCore::CSSDeferredParser::CSSDeferredParser):
1585         * dom/DataTransferItemList.cpp:
1586         (WebCore::DataTransferItemList::add):
1587         (WebCore::DataTransferItemList::ensureItems const):
1588         (WebCore::DataTransferItemList::didSetStringData):
1589         * dom/DataTransferItemList.h:
1590         * dom/Document.cpp:
1591         (WebCore::Document::postTask):
1592         (WebCore::Document::hasStorageAccess):
1593         (WebCore::Document::requestStorageAccess):
1594         * dom/Document.h:
1595         (WebCore::Document::setContextDocument):
1596         * dom/MessagePort.h:
1597         * html/HTMLImageElement.cpp:
1598         (WebCore::HTMLImageElement::setPictureElement):
1599         * html/HTMLInputElement.h:
1600         * html/HTMLMediaElement.cpp:
1601         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
1602         * html/HTMLMediaElement.h:
1603         * html/HTMLPictureElement.h:
1604         * html/parser/HTMLResourcePreloader.h:
1605         * layout/layouttree/LayoutBox.h:
1606         (WebCore::Layout::Box::style const):
1607         * loader/FormState.h:
1608         * loader/LinkLoader.cpp:
1609         (WebCore::LinkLoader::preconnectIfNeeded):
1610         * loader/LinkLoader.h:
1611         * loader/LinkPreloadResourceClients.cpp:
1612         (WebCore::LinkPreloadResourceClient::LinkPreloadResourceClient):
1613         * loader/MediaResourceLoader.cpp:
1614         (WebCore::MediaResourceLoader::MediaResourceLoader):
1615         * loader/MediaResourceLoader.h:
1616         * page/DOMWindow.h:
1617         * page/EventHandler.cpp:
1618         (WebCore::widgetForElement):
1619         (WebCore::EventHandler::updateLastScrollbarUnderMouse):
1620         * platform/GenericTaskQueue.cpp:
1621         (WebCore::TaskDispatcher<Timer>::postTask):
1622         * platform/GenericTaskQueue.h:
1623         (WebCore::GenericTaskQueue::enqueueTask):
1624         (WebCore::GenericTaskQueue::cancelAllTasks):
1625         * platform/ScrollView.h:
1626         * platform/ScrollableArea.h:
1627         * platform/Scrollbar.h:
1628         * platform/Widget.cpp:
1629         (WebCore::Widget::setParent):
1630         * platform/Widget.h:
1631         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
1632         (WebCore::AudioFileReader::decodeAudioForBusCreation):
1633         * platform/audio/mac/AudioHardwareListenerMac.cpp:
1634         (WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac):
1635         * platform/audio/mac/AudioHardwareListenerMac.h:
1636         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1637         (WebCore::CDMInstanceClearKey::requestLicense):
1638         (WebCore::CDMInstanceClearKey::updateLicense):
1639         (WebCore::CDMInstanceClearKey::loadSession):
1640         (WebCore::CDMInstanceClearKey::closeSession):
1641         (WebCore::CDMInstanceClearKey::removeSessionData):
1642         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1643         * platform/graphics/FontCascade.h:
1644         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1645         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
1646         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
1647         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1648         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1649         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1650         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
1651         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
1652         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1653         (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
1654         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
1655         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1656         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1657         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
1658         (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
1659         (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
1660         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
1661         (WebCore::MediaPlayerPrivateAVFoundationObjC::createSession):
1662         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
1663         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1664         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1665         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1666         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
1667         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
1668         * platform/graphics/cv/TextureCacheCV.h:
1669         * platform/graphics/cv/TextureCacheCV.mm:
1670         (WebCore::TextureCacheCV::textureFromImage):
1671         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1672         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
1673         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
1674         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1675         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1676         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1677         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1678         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
1679         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1680         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1681         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
1682         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
1683         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
1684         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
1685         * platform/graphics/texmap/TextureMapperLayer.cpp:
1686         (WebCore::TextureMapperLayer::setMaskLayer):
1687         (WebCore::TextureMapperLayer::setReplicaLayer):
1688         * platform/graphics/texmap/TextureMapperLayer.h:
1689         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1690         (WebCore::MediaPlayerPrivateMediaFoundation::endCreatedMediaSource):
1691         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
1692         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
1693         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1694         * platform/ios/RemoteCommandListenerIOS.h:
1695         * platform/ios/RemoteCommandListenerIOS.mm:
1696         (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
1697         * platform/mac/RemoteCommandListenerMac.h:
1698         * platform/mac/RemoteCommandListenerMac.mm:
1699         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
1700         * platform/mediastream/MediaStreamPrivate.cpp:
1701         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
1702         * platform/mediastream/MediaStreamPrivate.h:
1703         * platform/mediastream/RealtimeMediaSource.cpp:
1704         (WebCore::RealtimeMediaSource::scheduleDeferredTask):
1705         * platform/mediastream/RealtimeMediaSource.h:
1706         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1707         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1708         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
1709         * platform/vr/VRPlatformDisplay.h:
1710         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp:
1711         (WebCore::VRPlatformManagerOpenVR::getVRDisplays):
1712         * rendering/FloatingObjects.h:
1713         (WebCore::FloatingObject::setOriginatingLine):
1714         * rendering/RenderObject.h:
1715         * rendering/RootInlineBox.cpp:
1716         * rendering/RootInlineBox.h:
1717         * svg/SVGPathElement.h:
1718         * svg/SVGPathSegWithContext.h:
1719         (WebCore::SVGPathSegWithContext::SVGPathSegWithContext):
1720         (WebCore::SVGPathSegWithContext::setContextAndRole):
1721         * svg/SVGTransformList.h:
1722         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1723         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
1724         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
1725         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
1726         * svg/properties/SVGAnimatedPropertyTearOff.h:
1727         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
1728         * svg/properties/SVGListProperty.h:
1729         (WebCore::SVGListProperty::initializeValuesAndWrappers):
1730         (WebCore::SVGListProperty::getItemValuesAndWrappers):
1731         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
1732         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
1733         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
1734         * svg/properties/SVGMatrixTearOff.h:
1735         * svg/properties/SVGPropertyTearOff.h:
1736         * testing/MockCDMFactory.cpp:
1737         (WebCore::MockCDMFactory::createCDM):
1738         (WebCore::MockCDM::createInstance):
1739         * testing/MockCDMFactory.h:
1740         * workers/service/ExtendableEvent.h:
1741         * workers/service/FetchEvent.cpp:
1742         (WebCore::FetchEvent::respondWith):
1743         * workers/service/server/SWServer.h:
1744         * xml/DOMParser.cpp:
1745         (WebCore::DOMParser::DOMParser):
1746
1747 2018-06-07  Chris Dumez  <cdumez@apple.com>
1748
1749         PopStateEvent should not be cancelable by default
1750         https://bugs.webkit.org/show_bug.cgi?id=186420
1751
1752         Reviewed by Darin Adler.
1753
1754         PopStateEvent should not be cancelable by default:
1755         - https://github.com/web-platform-tests/wpt/pull/11355
1756         - https://html.spec.whatwg.org/#history-traversal
1757
1758         All other browsers agree with the specification.
1759
1760         No new tests, updated existing tests.
1761
1762         * dom/PopStateEvent.cpp:
1763         (WebCore::PopStateEvent::PopStateEvent):
1764
1765 2018-06-07  Simon Fraser  <simon.fraser@apple.com>
1766
1767         Remove a log that was left in by mistake.
1768
1769         * loader/cache/MemoryCache.cpp:
1770         (WebCore::MemoryCache::pruneLiveResourcesToSize):
1771
1772 2018-06-07  Antoine Quint  <graouts@apple.com>
1773
1774         [ASan / StressGC] DumpRenderTree crashed in com.apple.WebCore: WebCore::EventTarget::ref + 16
1775         https://bugs.webkit.org/show_bug.cgi?id=186207
1776         <rdar://problem/40568747>
1777
1778         Reviewed by Dean Jackson.
1779
1780         Ensure that we clear the DOM event queue for declarative animations once an animation is cleared for
1781         an element since the element can be deleted before events get dispatched asynchronouly for this animation.
1782
1783         We also only call AnimationTimeline::removeAnimationsForElement() from RenderTreeUpdater::tearDownRenderers()
1784         in the case where we're tearing down the whole document as otherwise this would yield early clearing of the event
1785         queue in the case where an element would get a "display: none" style.
1786
1787         * animation/AnimationTimeline.cpp:
1788         (WebCore::AnimationTimeline::removeAnimationsForElement):
1789         * animation/DeclarativeAnimation.cpp:
1790         (WebCore::DeclarativeAnimation::~DeclarativeAnimation):
1791         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval):
1792         * animation/DeclarativeAnimation.h:
1793         * animation/WebAnimation.cpp:
1794         (WebCore::WebAnimation::prepareAnimationForRemoval):
1795         * animation/WebAnimation.h:
1796         * rendering/updating/RenderTreeUpdater.cpp:
1797         (WebCore::RenderTreeUpdater::tearDownRenderers):
1798
1799 2018-06-07  Don Olmstead  <don.olmstead@sony.com>
1800
1801         [CoordGraphics] Fix compilation errors around USE(COORDINATED_GRAPHICS)
1802         https://bugs.webkit.org/show_bug.cgi?id=186374
1803
1804         Reviewed by Žan Doberšek.
1805
1806         No new tests. No change in behavior.
1807
1808         * page/scrolling/AsyncScrollingCoordinator.cpp:
1809         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1810         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
1811         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
1812         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp:
1813         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp:
1814         * platform/PlatformWheelEvent.h:
1815         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
1816         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
1817         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1818         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
1819
1820 2018-06-07  Thibault Saunier  <tsaunier@igalia.com> and Alejandro G. Castro  <alex@igalia.com>
1821
1822         [GTK][WPE] Start implementing MediaStream API
1823         https://bugs.webkit.org/show_bug.cgi?id=185787
1824
1825         Reviewed by Philippe Normand.
1826
1827         We are adding all the required classes to make the
1828         MediaStream API work, that means our own RealtimeMediaSourceCenterLibWebRTC
1829         for the platform, the GStreamerCaptureDeviceManager, the audio/video capturers
1830         and their respective audio/video sources as well as a dedicated GStreamer Source
1831         that adds support for using MediaStream stream inside playbin3.
1832         We are using the GstDeviceMonitor to list devices on the devices.
1833
1834         Enable mediastream tests.
1835
1836         * platform/GStreamer.cmake: Added the new files to the compilation.
1837         * platform/audio/AudioStreamDescription.h: Added new GStreamer type.
1838         * platform/audio/PlatformAudioData.h: Added new GStreamer type for
1839         the GStreamerAudioData class.
1840         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1841         (WebCore::simpleBusMessageCallback): This function and the next
1842         one help us to connect a monitoring callback to a pipeline for
1843         debugging.
1844         (WebCore::connectSimpleBusMessageCallback): Ditto.
1845         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto
1846         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1847         (WebCore::MediaPlayerPrivateGStreamer::load): Make use of the loadFull() method.
1848         (WebCore::MediaPlayerPrivateGStreamer::loadFull): Very similar to load()
1849         but allows specifying what pipeline type to use (null to let the function determine
1850         which one should be used). This is required as we force to always use playbin3 for the
1851         mediastream source as it relies on the GstStream API.
1852         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Style fix.
1853         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const): Added, use MediaStream specific information if available.
1854         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Some style fixes.
1855         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Enhance dotfiles names.
1856         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Minor formatting fix.
1857         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Set MediaStream on WebKitMediaStreamSource when setting it up.
1858         (WebCore::MediaPlayerPrivateGStreamer::supportsType): Advertise that we support MediaStream if support is built.
1859         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Make sure playbin3 is forced when loading a MediaStream.
1860         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add a reference to the MediaStream object and declare loadFull and naturalSize override.
1861         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1862         (WebCore::registerWebKitGStreamerElements): Register the new MediaStreamSrc element.
1863         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1864         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): Make sure that MediaStream MAIN tracks are selected by default. We have no way to do it in MediaStreamSrc now as the GstStreamCollection is recreated by parsebin.
1865         * platform/mediastream/RealtimeMediaSource.h: Make CaptureFailed a virtual method as in our mocks we require need to make
1866         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1867         (WebCore::RealtimeMediaSourceCenter::singleton): Remove the code
1868         used for compilation for the platform when we do not have a
1869         RealtimeMediaSourceCenterLibWebRTC. Now we return the proper class
1870         for the platform.
1871         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1872         Added class representing the RealtimeMediaSource for the Audio
1873         with GStreamer.
1874         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
1875         Ditto.
1876         * platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp: Added
1877         this class that represents the GStreamer pipeline that captures
1878         audio from the system devices, it inherits from GStreamerCapturer.
1879         * platform/mediastream/gstreamer/GStreamerAudioCapturer.h: Dito.
1880         * platform/mediastream/gstreamer/GStreamerAudioData.h: Added this
1881         class implementing PlatformAudioData for the GStreamer platform,
1882         used to pass the samples information.
1883         * platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h:
1884         Added this class implementing AudioStreamDescription to export the
1885         information about the audio stream to libwebrtc.
1886         * platform/mediastream/gstreamer/GStreamerCaptureDevice.h: Added
1887         this base class for the audio and video capturing devices, it
1888         implements general WebKit CaptureDevice class.
1889         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
1890         Added this class that implements the system monitor to get the
1891         list of available devices in the system. It uses GstDeviceMonitor
1892         to handle the operation. It uses two singleton device managers one
1893         for audio and another one for video, as required by the
1894         RealtimeMediaSourceCenter design.
1895         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: Ditto.
1896         * platform/mediastream/gstreamer/GStreamerCapturer.cpp: Added this
1897         base class representing how GStreamer captures the media from the
1898         input devices in the system. Two classes inherit from this one to
1899         capture audio and video. It setups the GStreamer pipeline and adds
1900         functions to control it.
1901         * platform/mediastream/gstreamer/GStreamerCapturer.h: Ditto.
1902         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Added.
1903         Implements a subclass of GstBin as a source element that will contain several
1904         GstAppSrc, basically one per MediaStreamTrackPrivate of the MediaStreamPrivate
1905         passed in parameter. It adds Observers on the MediaStreamTracks and
1906         pushes the data to the sources as required. The element implements the GstURIHandler
1907         interface so it can be used in playbin. The MediaPlayerPrivateGStreamer is responsible
1908         for passing the MediaStreamPrivate object to the source when required.
1909         (WebCore::webkitMediaStreamSrcPadProbeCb): Event probe that fixes stream_start events (setting the ID etc)
1910         and finally add src pads to the pipeline.
1911         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h: Ditto.
1912         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1913         Added this RealtimeMediaSource representing the source of the
1914         video data for the GStreamer platform. It handles the settings and
1915         capabilities of the source and creates the capturer used to
1916         control the operation of the stream.
1917         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h: Ditto.
1918         * platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp: Added
1919         this class that inherits from the GStreamerCapturer and controls
1920         the GStreamer pipelines of the video streams of the system.
1921         * platform/mediastream/gstreamer/GStreamerVideoCapturer.h: Ditto.
1922         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: Added. Implementation of a Mock capturer for audio stream.
1923         Subclasses GStreamerAudioCapturer and wraps a MockRealtimeAudioSource so that the behaviour is the same a MockRealtimeAudioSource
1924         but still the GStreamer implementation code paths are tested.
1925         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h: Ditto.
1926         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: Added. Implementation of a Mock capturer for video stream.
1927         Subclasses GStreamerVideoCapturer and wraps a MockRealtimeVideoSource so that the behaviour is the same a MockRealtimeVideoSource
1928         but still the GStreamer implementation code paths are tested.
1929         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: Ditto.
1930         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
1931         Added this class that implements the key RealtimeMediaSourceCenter
1932         functions to configure the base class for the platform, using the
1933         other GStreamer classes.
1934         * platform/mock/MockRealtimeAudioSource.cpp: Do not build ::create if GStreamer implementation is built
1935         * platform/mock/MockRealtimeVideoSource.cpp: Do not build ::create if GStreamer implementation is built
1936
1937 2018-06-07  Brent Fulgham  <bfulgham@apple.com>
1938
1939         Handle Storage Access API calls in the absence of an attached frame
1940         https://bugs.webkit.org/show_bug.cgi?id=186373
1941         <rdar://problem/40028265>
1942
1943         Reviewed by Daniel Bates.
1944
1945         Tests: http/tests/storageAccess/has-storage-access-crash.html
1946                http/tests/storageAccess/request-storage-access-crash.html
1947
1948         The new frame-specific storage access checks were done without confirming a
1949         frame was present, although the frame state was validated in other parts of
1950         the same method.
1951         
1952         This patch checks for a non-null frame before making frame-specific calls.
1953
1954         * dom/Document.cpp:
1955         (WebCore::Document::hasStorageAccess):
1956         (WebCore::Document::requestStorageAccess):
1957
1958 2018-06-07  Zalan Bujtas  <zalan@apple.com>
1959
1960         [LFC] Merge height and vertical margin computation
1961         https://bugs.webkit.org/show_bug.cgi?id=186394
1962
1963         Reviewed by Antti Koivisto.
1964
1965         To match the spec (and the width/horizontal margin computation). -currently with default values.
1966
1967         * layout/FormattingContext.cpp:
1968         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
1969         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
1970         (WebCore::Layout::FormattingContext::computeFloatingHeight const): Deleted.
1971         * layout/FormattingContext.h:
1972         * layout/FormattingContextGeometry.cpp:
1973         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin):
1974         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin):
1975         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
1976         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1977         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin):
1978         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1979         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1980         (WebCore::Layout::outOfFlowNonReplacedHeight): Deleted.
1981         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): Deleted.
1982         (WebCore::Layout::floatingNonReplacedHeight): Deleted.
1983         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): Deleted.
1984         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeight): Deleted.
1985         (WebCore::Layout::FormattingContext::Geometry::floatingHeight): Deleted.
1986         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight): Deleted.
1987         * layout/blockformatting/BlockFormattingContext.cpp:
1988         (WebCore::Layout::BlockFormattingContext::layout const):
1989         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1990         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
1991         (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
1992         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): Deleted.
1993         * layout/blockformatting/BlockFormattingContext.h:
1994         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1995         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1996         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1997         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): Deleted.
1998         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeight): Deleted.
1999
2000 2018-06-07  Antti Koivisto  <antti@apple.com>
2001
2002         Don't start service worker fetch when there is substitute data
2003         https://bugs.webkit.org/show_bug.cgi?id=186349
2004         <rdar://problem/38881568>
2005
2006         Reviewed by Youenn Fablet.
2007
2008         Loading content via WKWebView.loadData may also end up starting a main resource service worker fetch.
2009         This breaks DocumentWriter assumptions.
2010
2011         * loader/DocumentLoader.cpp:
2012         (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache):
2013         (WebCore::DocumentLoader::tryLoadingSubstituteData):
2014
2015         Factor substitute resource loading out from tryLoadingRequestFromApplicationCache.
2016
2017         (WebCore::DocumentLoader::startLoadingMainResource):
2018
2019         If we have substitute data already (typically from WKWebView.loadData), allow service worker registration
2020         but load the main resource using the substitute data.
2021
2022         (WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Deleted.
2023
2024         Merge to tryLoadingSubstituteData.
2025
2026         * loader/DocumentLoader.h:
2027
2028 2018-06-07  Thibault Saunier  <tsaunier@igalia.com>
2029
2030         [GStreamer] Fix the way GstStreamCollection is handled
2031         https://bugs.webkit.org/show_bug.cgi?id=184588
2032
2033         Reviewed by Philippe Normand.
2034
2035         The stream collection message replaces the collection of stream previously
2036         advertised, this means that we should rebuild our set of Track from scratch
2037         and not update previously exposed tracks.
2038
2039         In the end, this simplifies the code as we do not care about what
2040         tracks existed previously, we just need to expose what GStreamer tells
2041         us, deleting any previous state.
2042
2043         Handle the STREAM_COLLECTION message from the sync handler so that tracks
2044         are updated before we mark the pipeline as READY for the live case (everything
2045         happen synchronously with the call to the `load()` method in that case),
2046         the update still always happens on the main thread.
2047
2048         No new tests is added as this is mostly refactoring, it is already tested and it
2049         will fix MediaStream tests that are currently disabled as the support is being
2050         implemented in #185787.
2051
2052         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2053         (WebCore::MediaPlayerPrivateGStreamer::clearTracks): Removes all tracks.
2054         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Updates configured tracks from the new GstStreamColection track.
2055         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Stop handling GST_STREAM_COLLECTION event.
2056         (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): Handle stream collection event synchronously.
2057         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add handleSyncMessage
2058
2059 2018-06-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2060
2061         Remove unused image encoders
2062         https://bugs.webkit.org/show_bug.cgi?id=186365
2063
2064         Reviewed by Carlos Garcia Campos.
2065
2066         * platform/image-encoders/JPEGImageEncoder.cpp: Removed.
2067         * platform/image-encoders/JPEGImageEncoder.h: Removed.
2068         * platform/image-encoders/PNGImageEncoder.cpp: Removed.
2069         * platform/image-encoders/PNGImageEncoder.h: Removed.
2070
2071 2018-06-06  Youenn Fablet  <youenn@apple.com>
2072
2073         HTTP Header values validation is too strict
2074         https://bugs.webkit.org/show_bug.cgi?id=167112
2075
2076         Reviewed by Alex Christensen.
2077
2078         Moving header values and names from DOMString to ByteString as per spec.
2079         Updating WebCore::isValidHTTPHeaderValue as per https://fetch.spec.whatwg.org/#terminology-headers.
2080
2081         Covered by rebased and updated tests.
2082         Updated test is now also passing in other browsers.
2083
2084         * platform/network/HTTPParsers.cpp:
2085         (WebCore::isValidHTTPHeaderValue):
2086
2087 2018-06-06  Youenn Fablet  <youenn@apple.com>
2088
2089         Add Accept-Encoding: identity to Range requests
2090         https://bugs.webkit.org/show_bug.cgi?id=186335
2091         <rdar://problem/40837190>
2092
2093         Reviewed by Eric Carlson.
2094
2095         Tests: imported/w3c/web-platform-tests/fetch/range/general.any.html
2096                imported/w3c/web-platform-tests/fetch/range/general.any.worker.html
2097
2098         * loader/cache/CachedResourceLoader.cpp:
2099         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
2100         * loader/cache/CachedResourceRequest.cpp:
2101         (WebCore::CachedResourceRequest::updateAcceptEncodingHeader):
2102         * loader/cache/CachedResourceRequest.h:
2103
2104 2018-06-06  Per Arne Vollan  <pvollan@apple.com>
2105
2106         Display links are sometimes not notifying WebCore when fired.
2107         https://bugs.webkit.org/show_bug.cgi?id=186367
2108         <rdar://problem/40439109>
2109
2110         Reviewed by Brent Fulgham.
2111
2112         When the WebContent process is receiving an IPC message notifying about a screen update, all display refresh monitors
2113         are notified by the manager in DisplayRefreshMonitorManager::displayWasUpdated(). The manager checks that the monitor
2114         is scheduled before notifying. This is a problem, since the scheduled flag is always set to false in the
2115         DisplayRefreshMonitor::displayDidRefresh() method, when the monitor is first notified about a screen update. This can
2116         lead to display links running without notifying the monitors, causing extra CPU usage. It can also prevent them from
2117         being deleted, since the monitors are not notified. Instead, we can check that the display refresh monitor is active
2118         before notifying it. This matches the original display link implementation used when the WebContent process has
2119         WindowServer access, where the monitors are always notified.
2120
2121         No new tests, since I have not been able to reproduce this in a test case yet.
2122
2123         * platform/graphics/DisplayRefreshMonitorManager.cpp:
2124         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
2125
2126 2018-06-06  Antoine Quint  <graouts@apple.com>
2127
2128         Rename color-filter to -apple-color-filter and do not expose it to Web content
2129         https://bugs.webkit.org/show_bug.cgi?id=186306
2130         <rdar://problem/39874167>
2131
2132         Reviewed by Simon Fraser.
2133
2134         Rename the color-filter CSS property to -apple-color-filter.
2135
2136         * animation/KeyframeEffectReadOnly.cpp:
2137         (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists):
2138         * css/CSSComputedStyleDeclaration.cpp:
2139         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2140         * css/CSSGradientValue.cpp:
2141         (WebCore::CSSGradientValue::image):
2142         (WebCore::CSSGradientValue::computeStops):
2143         (WebCore::CSSGradientValue::knownToBeOpaque const):
2144         * css/CSSProperties.json:
2145         * css/parser/CSSPropertyParser.cpp:
2146         (WebCore::CSSPropertyParser::parseSingleValue):
2147         * page/animation/CSSPropertyAnimation.cpp:
2148         (WebCore::blendFunc):
2149         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2150         * page/animation/ImplicitAnimation.cpp:
2151         (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists):
2152         * page/animation/KeyframeAnimation.cpp:
2153         (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists):
2154         * rendering/InlineTextBox.cpp:
2155         (WebCore::InlineTextBox::paintMarkedTextForeground):
2156         (WebCore::InlineTextBox::paintMarkedTextDecoration):
2157         * rendering/style/RenderStyle.cpp:
2158         (WebCore::RenderStyle::changeRequiresRepaint const):
2159         (WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
2160         (WebCore::RenderStyle::colorByApplyingColorFilter const):
2161         * rendering/style/RenderStyle.h:
2162         (WebCore::RenderStyle::mutableAppleColorFilter):
2163         (WebCore::RenderStyle::appleColorFilter const):
2164         (WebCore::RenderStyle::hasAppleColorFilter const):
2165         (WebCore::RenderStyle::setAppleColorFilter):
2166         (WebCore::RenderStyle::initialAppleColorFilter):
2167         (WebCore::RenderStyle::mutableColorFilter): Deleted.
2168         (WebCore::RenderStyle::colorFilter const): Deleted.
2169         (WebCore::RenderStyle::hasColorFilter const): Deleted.
2170         (WebCore::RenderStyle::setColorFilter): Deleted.
2171         (WebCore::RenderStyle::initialColorFilter): Deleted.
2172         * rendering/style/StyleRareInheritedData.cpp:
2173         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2174         (WebCore::StyleRareInheritedData::operator== const):
2175         (WebCore::StyleRareInheritedData::hasColorFilters const):
2176         * rendering/style/StyleRareInheritedData.h:
2177
2178 2018-06-06  Jer Noble  <jer.noble@apple.com>
2179
2180         REGRESSION (r231817?): Layout Test media/track/track-delete-during-setup.html is a flaky timeout
2181         https://bugs.webkit.org/show_bug.cgi?id=185889
2182         <rdar://problem/40583180>
2183
2184         Reviewed by Eric Carlson.
2185
2186         Explicitly update the network and ready states when detaching the AVPlayerItem
2187         from the AVPlayer.
2188
2189         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2190         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
2191
2192 2018-06-06  Antoine Quint  <graouts@apple.com>
2193
2194         Use the default label for snapshotted plug-ins if no mime-type is available
2195         https://bugs.webkit.org/show_bug.cgi?id=186348
2196
2197         Reviewed by Jon Lee.
2198
2199         In case the mime-type is not available, use the default labels otherwise we'd crash trying to look up the empty string in the HashMap.
2200
2201         * html/HTMLPlugInImageElement.cpp:
2202         (WebCore::titleText):
2203         (WebCore::subtitleText):
2204
2205 2018-06-06  Timothy Hatcher  <timothy@apple.com>
2206
2207         Wrong NSVisualEffectMaterial used for exit full screen overlay in dark mode.
2208
2209         https://bugs.webkit.org/show_bug.cgi?id=186350
2210         rdar://problem/39135535
2211
2212         Reviewed by Anders Carlsson.
2213
2214         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
2215         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
2216         Use the NSVisualEffectMaterialFullScreenUI on macOS 10.14 and don't
2217         set an explicit NSAppearance.
2218
2219 2018-06-06  Jer Noble  <jer.noble@apple.com>
2220
2221         Regions outside of the fullscreen window are exposed during zoom operations
2222         https://bugs.webkit.org/show_bug.cgi?id=186330
2223         <rdar://problem/34698009>
2224
2225         Reviewed by Simon Fraser.
2226
2227         Test: fullscreen/full-screen-layer-dump.html
2228
2229         Introduce the concept of "requiresBackgroundLayer" to RenderLayerBacking, for use by
2230         RenderFullScreen. Previously, the backgroundLayer in RenderLayerBacking was only used
2231         by the root renderer with fixed backgrounds. Give the RenderFullScreen a background layer
2232         that's approximately 3x as tall and wide as the renderer itself, so nothing is exposed
2233         during pinch operations.
2234
2235         * rendering/RenderLayerBacking.cpp:
2236         (WebCore::RenderLayerBacking::RenderLayerBacking):
2237         (WebCore::RenderLayerBacking::updateConfiguration):
2238         (WebCore::RenderLayerBacking::updateGeometry):
2239         (WebCore::RenderLayerBacking::updateDrawsContent):
2240         (WebCore::RenderLayerBacking::setRequiresBackgroundLayer):
2241         (WebCore::RenderLayerBacking::updateBackgroundLayer):
2242         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
2243         (WebCore::RenderLayerBacking::paintIntoLayer):
2244         * rendering/RenderLayerBacking.h:
2245
2246 2018-06-06  Jer Noble  <jer.noble@apple.com>
2247
2248         Set the AVAssetResourceLoaderRequest's contentType to AVStreamingKeyDeliveryContentKeyType in the case of a FPS key request.
2249         https://bugs.webkit.org/show_bug.cgi?id=186328
2250         <rdar://problem/40829228>
2251
2252         Reviewed by Eric Carlson.
2253
2254         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2255         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
2256
2257 2018-06-06  Zalan Bujtas  <zalan@apple.com>
2258
2259         [LFC] Add margin computation for floating, replaced elements.
2260         https://bugs.webkit.org/show_bug.cgi?id=186337
2261
2262         Reviewed by Antti Koivisto.
2263
2264         If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'.
2265
2266         * layout/FormattingContext.h:
2267         * layout/FormattingContextGeometry.cpp:
2268         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2269         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2270
2271 2018-06-06  Zalan Bujtas  <zalan@apple.com>
2272
2273         [LFC] Add margin computation for floating, no-replaced elements.
2274         https://bugs.webkit.org/show_bug.cgi?id=186334
2275
2276         Reviewed by Antti Koivisto.
2277
2278         If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
2279
2280         * layout/FormattingContextGeometry.cpp:
2281         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2282
2283 2018-06-06  Antti Koivisto  <antti@apple.com>
2284
2285         Use minimal coverage rect for tiled layers when under memory pressure
2286         https://bugs.webkit.org/show_bug.cgi?id=186185
2287         <rdar://problem/40713608>
2288
2289         Reviewed by Darin Adler.
2290
2291         We do this for the main content layer already.
2292
2293         * platform/graphics/ca/GraphicsLayerCA.cpp:
2294         (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
2295
2296 2018-06-05  Antoine Quint  <graouts@apple.com>
2297
2298         [Web Animations] Only expose CSSAnimation and CSSTransition if the WebAnimationsCSSIntegration runtime flag is enabled
2299         https://bugs.webkit.org/show_bug.cgi?id=186305
2300
2301         Reviewed by Dean Jackson.
2302
2303         * animation/CSSAnimation.idl:
2304         * animation/CSSTransition.idl:
2305
2306 2018-06-05  Per Arne Vollan  <pvollan@apple.com>
2307
2308         Move OpenGL display mask to screen data struct.
2309         https://bugs.webkit.org/show_bug.cgi?id=186198
2310         <rdar://problem/40724854>
2311
2312         Reviewed by Brent Fulgham.
2313
2314         Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since
2315         it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be
2316         resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each
2317         display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes
2318         the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host
2319         window is available, the OpenGL display mask of the main display is used.
2320
2321         No new tests, since testing this requires two Web views in the same WebContent process, displayed on
2322         two different monitors.
2323
2324         * html/HTMLCanvasElement.cpp:
2325         (WebCore::HTMLCanvasElement::createImageBuffer const):
2326         * platform/PlatformScreen.h:
2327         * platform/ScreenProperties.h:
2328         (WebCore::ScreenProperties::encode const):
2329         (WebCore::ScreenProperties::decode):
2330         (WebCore::ScreenData::encode const):
2331         (WebCore::ScreenData::decode):
2332         * platform/graphics/GraphicsContext3D.h:
2333         * platform/graphics/ImageBuffer.cpp:
2334         (WebCore::ImageBuffer::create):
2335         * platform/graphics/ImageBuffer.h:
2336         * platform/graphics/cg/ImageBufferCG.cpp:
2337         (WebCore::ImageBuffer::createCompatibleBuffer):
2338         (WebCore::ImageBuffer::ImageBuffer):
2339         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2340         (WebCore::GraphicsContext3D::GraphicsContext3D):
2341         (WebCore::GraphicsContext3D::allowOfflineRenderers const):
2342         (WebCore::GraphicsContext3D::setOpenGLDisplayMask): Deleted.
2343         (WebCore::GraphicsContext3D::getOpenGLDisplayMask): Deleted.
2344         * platform/graphics/cocoa/IOSurface.h:
2345         * platform/graphics/cocoa/IOSurface.mm:
2346         (WebCore::IOSurface::ensurePlatformContext):
2347         * platform/mac/PlatformScreenMac.mm:
2348         (WebCore::screenProperties):
2349         (WebCore::collectScreenProperties):
2350         (WebCore::setScreenProperties):
2351         (WebCore::screenData):
2352         (WebCore::primaryOpenGLDisplayMask):
2353         (WebCore::displayMaskForDisplay):
2354         (WebCore::getScreenProperties):
2355         (WebCore::screenIsMonochrome):
2356         (WebCore::screenHasInvertedColors):
2357         (WebCore::screenDepth):
2358         (WebCore::screenDepthPerComponent):
2359         (WebCore::screenRectForDisplay):
2360         (WebCore::screenRect):
2361         (WebCore::screenAvailableRect):
2362         (WebCore::screenColorSpace):
2363         (WebCore::screenSupportsExtendedColor):
2364
2365 2018-06-05  Jer Noble  <jer.noble@apple.com>
2366
2367         REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in
2368         https://bugs.webkit.org/show_bug.cgi?id=186326
2369         <rdar://problem/40778157>
2370
2371         Reviewed by Eric Carlson.
2372
2373         Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag.
2374
2375         * html/MediaElementSession.cpp:
2376         (WebCore::MediaElementSession::visibilityChanged):
2377         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2378
2379 2018-06-05  Zalan Bujtas  <zalan@apple.com>
2380
2381         [LFC] Move inflow, replaced width and margin computation to a dedicated function.
2382         https://bugs.webkit.org/show_bug.cgi?id=186327
2383
2384         Reviewed by Sam Weinig.
2385
2386         I was searching for the function inFlowReplacedWidthAndMargin() and there was none.
2387
2388         * layout/blockformatting/BlockFormattingContext.h:
2389         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2390         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2391         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2392
2393 2018-06-05  Zalan Bujtas  <zalan@apple.com>
2394
2395         [LFC] Add missing margins for inflow, non replaced block and replaced inline elements
2396         https://bugs.webkit.org/show_bug.cgi?id=186332
2397
2398         Reviewed by Darin Adler.
2399
2400         * layout/FormattingContextGeometry.cpp:
2401         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2402         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2403         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2404
2405 2018-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2406
2407         [macOS] Spelling errors in the middle of an inserted paragraph are not displayed
2408         https://bugs.webkit.org/show_bug.cgi?id=185584
2409         <rdar://problem/38676081>
2410
2411         Reviewed by Ryosuke Niwa.
2412
2413         Currently when typing, we only consider the range of adjacent words when determining where to place spelling
2414         correction markers, even though we provide NSSpellChecker with the full context of the sentence (and get back
2415         results encompassing the full range). In macOS Mojave, NSSpellChecker may now return spell checking results that
2416         include correctly spelled words that are misused in the context of the sentence. This means that while typing a
2417         sentence, a different part of the sentence may gain or lose spelling markers as a result.
2418
2419         To support this, WebKit needs to mark or unmark spelling corrections in the full range of the sentence whenever
2420         a full word is typed (since the context of other words within the sentence may have changed, resulting in
2421         different platform spellchecking results). In markMisspellingsAfterTypingToWord, we expand the spell checking
2422         range past the adjacent words so that it encompasses the largest subrange of the full sentence that includes the
2423         start of the typed word, and does not include any position that is under an element with `spellcheck=false`.
2424
2425         This guarantees that we don't erroneously place spelling document markers under elements where spellchecking is
2426         disabled, while allowing for sentence retro corrections when spellchecking is enabled. However, this doesn't
2427         handle the case where an element with spellchecking disabled lies between a sentence retro correction range and
2428         the currently typed word. In the future, we could fix this by refactoring SpellCheckRequest to track a list of
2429         non-contiguous spelling correction ranges — see the FIXME in markMisspellingsAfterTypingToWord for more detail.
2430
2431         Covered by 2 new layout tests, as well as an existing spell-checking test that should now be passing.
2432
2433         Tests: editing/spelling/retro-correction-spelling-markers.html
2434                editing/spelling/spelling-markers-after-pasting-sentence.html
2435
2436         * editing/Editor.cpp:
2437         (WebCore::Editor::markMisspellingsAfterTypingToWord):
2438         * testing/Internals.h:
2439         * testing/Internals.idl:
2440
2441         Add an internal testing helper to determine whether retro sentence corrections are enabled.
2442
2443 2018-06-05  Darin Adler  <darin@apple.com>
2444
2445         [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
2446         https://bugs.webkit.org/show_bug.cgi?id=186324
2447
2448         Reviewed by Anders Carlsson.
2449
2450         * platform/FileMonitor.h: Use OSObjectPtr instead of DispatchPtr.
2451         * platform/cocoa/FileMonitorCocoa.mm:
2452         (WebCore::FileMonitor::FileMonitor): Ditto.
2453
2454 2018-06-05  Ryan Haddad  <ryanhaddad@apple.com>
2455
2456         Unreviewed, fix the macOS build with recent SDKs.
2457
2458         * page/mac/ServicesOverlayController.mm:
2459         (WebCore::ServicesOverlayController::Highlight::paintContents):
2460
2461 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
2462
2463         Adjust compile and runtime flags to match shippable state of features
2464         https://bugs.webkit.org/show_bug.cgi?id=186319
2465         <rdar://problem/40352045>
2466
2467         Reviewed by Maciej Stachowiak, Jon Lee, and others.
2468
2469         * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR
2470         or ENABLE_INPUT_TYPE_COLOR_POPOVER.
2471
2472 2018-06-05  Timothy Hatcher  <timothy@apple.com>
2473
2474         Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query
2475
2476         https://bugs.webkit.org/show_bug.cgi?id=186323
2477         rdar://problem/38382252
2478
2479         Reviewed by Tim Horton.
2480
2481         * css/MediaFeatureNames.h:
2482         * css/MediaQueryEvaluator.cpp:
2483         (WebCore::prefersDarkInterfaceEvaluate):
2484         (WebCore::defaultAppearanceEvaluate): Deleted.
2485         * css/MediaQueryExpression.cpp:
2486         (WebCore::featureWithValidIdent):
2487         (WebCore::isFeatureValidWithoutValue):
2488         * platform/mac/LocalDefaultSystemAppearance.mm:
2489         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2490
2491 2018-06-05  Darin Adler  <darin@apple.com>
2492
2493         [Cocoa] Improve some soft linking compatibility with ARC
2494         https://bugs.webkit.org/show_bug.cgi?id=186309
2495
2496         Reviewed by Anders Carlsson.
2497
2498         * platform/audio/ios/AudioSessionIOS.mm: Use SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER
2499         for NSString constants.
2500         * platform/audio/ios/MediaSessionManagerIOS.mm: Ditto.
2501         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: Ditto.
2502         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Ditto.
2503         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm: Ditto.
2504         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
2505         (WebCore::MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState): Use __bridge for
2506         some bridging casts.
2507         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto.
2508         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto.
2509         (WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Ditto.
2510         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: Use
2511         SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER for NSString constants.
2512         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Ditto.
2513         * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto.
2514         * platform/mediastream/mac/AVMediaCaptureSource.mm: Ditto.
2515         * platform/mediastream/mac/AVVideoCaptureSource.mm: Ditto.
2516
2517 2018-06-05  Youenn Fablet  <youenn@apple.com>
2518
2519         ServiceWorker registration should store any script fetched through importScripts
2520         https://bugs.webkit.org/show_bug.cgi?id=182444
2521         <rdar://problem/37164835>
2522
2523         Reviewed by Chris Dumez.
2524
2525         Covered by added test http/wpt/service-workers/persistent-importScripts.html.
2526
2527         Update importScripts implementation to look for/update the resource map in case of service worker scope.
2528         This resource map is stored persistently and sent when running the service worker.
2529
2530         Add support to persistent storage of this resource map.
2531         This requires updating the schema database.
2532         The schema version is bumped to 2 and we delete any data related to old registrations.
2533
2534         When updating the service worker, the resource map is currently flushed so that all scripts will be retrieved from the network.
2535
2536         Did some limited refactoring to put more loading handling in WorkerScriptLoader.
2537
2538         * workers/WorkerGlobalScope.cpp:
2539         (WebCore::WorkerGlobalScope::importScripts):
2540         * workers/WorkerScriptLoader.cpp:
2541         (WebCore::WorkerScriptLoader::loadSynchronously):
2542         (WebCore::WorkerScriptLoader::script):
2543         * workers/WorkerScriptLoader.h:
2544         * workers/service/ServiceWorkerContextData.cpp:
2545         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2546         * workers/service/ServiceWorkerContextData.h:
2547         (WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
2548         (WebCore::ServiceWorkerContextData::ImportedScript::encode const):
2549         (WebCore::ServiceWorkerContextData::ImportedScript::decode):
2550         (WebCore::ServiceWorkerContextData::encode const):
2551         (WebCore::ServiceWorkerContextData::decode):
2552         * workers/service/ServiceWorkerGlobalScope.cpp:
2553         (WebCore::ServiceWorkerGlobalScope::scriptResource const):
2554         (WebCore::ServiceWorkerGlobalScope::setScriptResource):
2555         * workers/service/ServiceWorkerGlobalScope.h:
2556         * workers/service/context/SWContextManager.h:
2557         * workers/service/server/RegistrationDatabase.cpp:
2558         (WebCore::v1RecordsTableSchema):
2559         (WebCore::RegistrationDatabase::doPushChanges):
2560         (WebCore::RegistrationDatabase::importRecords):
2561         * workers/service/server/SWServer.cpp:
2562         (WebCore::SWServer::addRegistrationFromStore):
2563         (WebCore::SWServer::updateWorker):
2564         (WebCore::SWServer::installContextData):
2565         * workers/service/server/SWServer.h:
2566         * workers/service/server/SWServerJobQueue.cpp:
2567         (WebCore::SWServerJobQueue::scriptFetchFinished):
2568         * workers/service/server/SWServerToContextConnection.cpp:
2569         (WebCore::SWServerToContextConnection::setScriptResource):
2570         * workers/service/server/SWServerToContextConnection.h:
2571         * workers/service/server/SWServerWorker.cpp:
2572         (WebCore::SWServerWorker::SWServerWorker):
2573         (WebCore::m_scriptResourceMap):
2574         (WebCore::SWServerWorker::contextData const):
2575         (WebCore::SWServerWorker::setScriptResource):
2576         * workers/service/server/SWServerWorker.h:
2577
2578 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
2579
2580         Revise DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to work properly on Apple builds
2581         https://bugs.webkit.org/show_bug.cgi?id=186286
2582         <rdar://problem/40782992>
2583
2584         Reviewed by Dan Bernstein.
2585
2586         Use the WK_RELOCATABLE_FRAMEWORKS flag (which is always defined for non-production builds)
2587         to define ENABLE(EXPERIMENTAL_FEATURES) so that we do not need to manually
2588         change this flag when preparing for a production release.
2589
2590         * Configurations/FeatureDefines.xcconfig: Use WK_RELOCATABLE_FRAMEWORKS to determine
2591         whether experimental features should be enabled, and use it to properly define the
2592         feature flag.
2593
2594 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
2595
2596         Unreviewed build fix after r232511.
2597         https://bugs.webkit.org/show_bug.cgi?id=186304
2598
2599         * platform/ios/WebItemProviderPasteboard.mm: Add missing include.
2600
2601 2018-06-05  Antoine Quint  <graouts@apple.com>
2602
2603         Fix the iOS build after r232496
2604         https://bugs.webkit.org/show_bug.cgi?id=186304
2605
2606         Reviewed by Brent Fulgham.
2607
2608         The changes in r232496 changed the InputType::element() signature from HTMLInputElement&
2609         to HTMLInputElement* and some call sites did not expect that.
2610
2611         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2612         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
2613         (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree):
2614         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue):
2615         (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
2616         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent):
2617         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent):
2618         (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction):
2619         (WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const):
2620         * html/BaseDateAndTimeInputType.cpp:
2621         (WebCore::BaseDateAndTimeInputType::setValueAsDate const):
2622         (WebCore::BaseDateAndTimeInputType::valueAsDouble const):
2623         (WebCore::BaseDateAndTimeInputType::setValueAsDecimal const):
2624         (WebCore::BaseDateAndTimeInputType::typeMismatch const):
2625         (WebCore::BaseDateAndTimeInputType::serializeWithComponents const):
2626         (WebCore::BaseDateAndTimeInputType::localizeValue const):
2627         (WebCore::BaseDateAndTimeInputType::visibleValue const):
2628         (WebCore::BaseDateAndTimeInputType::valueMissing const):
2629         (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
2630         * html/DateInputType.cpp:
2631         (WebCore::DateInputType::createStepRange const):
2632         * html/DateTimeLocalInputType.cpp:
2633         (WebCore::DateTimeLocalInputType::createStepRange const):
2634         * html/MonthInputType.cpp:
2635         (WebCore::MonthInputType::valueAsDate const):
2636         (WebCore::MonthInputType::createStepRange const):
2637         * html/TimeInputType.cpp:
2638         (WebCore::TimeInputType::createStepRange const):
2639         * html/WeekInputType.cpp:
2640         (WebCore::WeekInputType::createStepRange const):
2641
2642 2018-06-03  Darin Adler  <darin@apple.com>
2643
2644         Simplify and remove some unused video element code (helpful for ARC-compatibility)
2645         https://bugs.webkit.org/show_bug.cgi?id=186258
2646
2647         Reviewed by Daniel Bates.
2648
2649         My main mission was to remove the PlatformMedia struct, which had a union
2650         of Objective-C object pointers in it, which doesn't work in ARC. However, I
2651         found some other unused code to remove and simple mistakes to fix.
2652
2653         * Modules/mediasource/VideoPlaybackQuality.cpp:
2654         (WebCore::VideoPlaybackQuality::create): Use unsigned instead of unsigned long,
2655         since IDL "unsigned long" really means unsigned.
2656         (WebCore::VideoPlaybackQuality::VideoPlaybackQuality): Ditto.
2657         * Modules/mediasource/VideoPlaybackQuality.h: Updated for the above.
2658
2659         * html/HTMLMediaElement.cpp:
2660         (WebCore::HTMLMediaElement::platformMedia const): Deleted.
2661         * html/HTMLMediaElement.h: Updated for the above.
2662
2663         * platform/graphics/MediaPlayer.cpp:
2664         (WebCore::MediaPlayer::MediaPlayer): Moved initialization of many data members
2665         to the class definition.
2666         (WebCore::MediaPlayer::load): Use nullptr instead of 0.
2667         (WebCore::MediaPlayer::platformMedia const): Deleted.
2668         (WebCore::MediaPlayer::videoPlaybackQualityMetrics): Updated name of return type.
2669         (WebCore::MediaPlayer::objCAVFoundationAVPlayer const): Added. Replaces
2670         platformMedia for the one case where it was being used.
2671         * platform/graphics/MediaPlayer.h: Removed unneeded includes. Re-sorted things.
2672         Updated for the above. Removed PlatformMedia struct and NoPlatformMedia constant.
2673         Removed explicit constructor in MediaEngineSupportParameters. Renamed
2674         PlatformVideoPlaybackQualityMetrics struct to VideoPlaybackQualityMetrics,
2675         removed its constructor, and changed types from unsigned long to unsigned.
2676         Un-nested #if statements. Removed some Chromium-specific comments.
2677
2678         * platform/graphics/MediaPlayerPrivate.h: Removed unneeded includes and
2679         forward declarations. Removed platformMedia. Updated return type for
2680         videoPlaybackQualityMetrics. Added objCAVFoundationAVPlayer.
2681
2682         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
2683         Removed platformMedia.
2684
2685         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2686         (WebCore::MediaPlayerPrivateAVFoundation::platformMedia const): Deleted.
2687         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
2688         Updated for the above.
2689
2690         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2691         Added override of objCAVFoundationAVPlayer. Removed platformMedia.
2692         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2693         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const): Deleted.
2694
2695         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2696         Removed platformMedia. Updated return type for videoPlaybackQualityMetrics.
2697         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2698         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformMedia const): Deleted.
2699         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
2700         Updated return type, changed to use aggregate initialization instead of
2701         calling a constructor, and added casts to unsigned.
2702
2703         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Switched from
2704         unsigned long to unsigned for frame counts and from long to int for
2705         quality of service tier.
2706
2707         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2708         (WebCore::MediaPlayerPrivateGStreamerBase::platformMedia): Deleted.
2709         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2710         Updated for the above.
2711
2712         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2713         Removed videoPlaybackQualityMetrics since it was overriding a derived function
2714         without changing its behavior, and the type has changed.
2715
2716         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2717         (WebCore::MockMediaPlayerMediaSource::load): Pass two references.
2718         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
2719         Updated return type.
2720         * platform/mock/mediasource/MockMediaPlayerMediaSource.h: Updated for the above.
2721
2722         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2723         (WebCore::MockMediaSourcePrivate::create): Return a Ref, take references.
2724         (WebCore::MockMediaSourcePrivate::MockMediaSourcePrivate): Moved most data
2725         member initialization into the class definition. Take references.
2726         (WebCore::MockMediaSourcePrivate::~MockMediaSourcePrivate): Use a modern for loop.
2727         (WebCore::MockMediaSourcePrivate::durationChanged): Update since m_player is a
2728         reference.
2729         (WebCore::MockMediaSourcePrivate::markEndOfStream): Ditto.
2730         (WebCore::MockMediaSourcePrivate::readyState): Ditto.
2731         (WebCore::MockMediaSourcePrivate::setReadyState): Ditto.
2732         (WebCore::MockMediaSourcePrivate::waitForSeekCompleted): Ditto.
2733         (WebCore::MockMediaSourcePrivate::seekCompleted): Ditto.
2734         (WebCore::MockMediaSourcePrivate::removeSourceBuffer): Use Vector::removeFirst
2735         instead of find/remove pairs.
2736         (WebCore::MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState): Ditto.
2737         (WebCore::MockMediaSourcePrivate::seekToTime): Use modern for loop.
2738         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics): Updated return
2739         type, changed to use aggregate initialization instead of calling a constructor.
2740         * platform/mock/mediasource/MockMediaSourcePrivate.h: Updated for the above.
2741
2742         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2743         (WebCore::MockSourceBufferPrivate::readyState): Updated since player is now
2744         a reference.
2745         (WebCore::MockSourceBufferPrivate::setReadyState): Ditto.
2746
2747 2018-06-04  Darin Adler  <darin@apple.com>
2748
2749         [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr)
2750         https://bugs.webkit.org/show_bug.cgi?id=186300
2751
2752         Reviewed by Daniel Bates.
2753
2754         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: Removed unnecessary
2755         include of OSObjectPtr.h.
2756         * platform/ios/WebItemProviderPasteboard.mm: Ditto.
2757
2758 2018-06-05  Joanmarie Diggs  <jdiggs@igalia.com>
2759
2760         AX: Implement support for new blockquote, caption, and paragraph ARIA roles
2761         https://bugs.webkit.org/show_bug.cgi?id=186274
2762
2763         Reviewed by Chris Fleizach.
2764
2765         Add the three new ARIA roles to the internal rolemap so that they are treated in
2766         the same fashion as their HTML element counterparts. Also ensure that an element
2767         with an explicit caption role does not get pruned from the macOS accessibility tree.
2768
2769         No new tests. Instead add the roles to the existing role-exposure tests.
2770
2771         * accessibility/AccessibilityObject.cpp:
2772         (WebCore::initializeRoleMap):
2773         * accessibility/mac/AccessibilityObjectMac.mm:
2774         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
2775         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2776         (createAccessibilityRoleMap):
2777
2778 2018-06-05  Zalan Bujtas  <zalan@apple.com>
2779
2780         [LFC] Merge width and margin computation for block-level, replaced elements in normal flow
2781         https://bugs.webkit.org/show_bug.cgi?id=186270
2782
2783         Reviewed by Sam Weinig.
2784
2785         https://www.w3.org/TR/CSS22/visudet.html#block-replaced-width
2786         10.3.4 Block-level, replaced elements in normal flow
2787
2788         The used value of 'width' is determined as for inline replaced elements.
2789         Then the rules for non-replaced block-level elements are applied to determine the margins.
2790
2791         * layout/blockformatting/BlockFormattingContext.h:
2792         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2793         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2794         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2795
2796 2018-06-04  Enrique Ocaña González  <eocanha@igalia.com>
2797
2798         [GStreamer][MSE] MediaPlayerPrivateGStreamerMSE.h includes and forward declares PlaybackPipeline
2799         https://bugs.webkit.org/show_bug.cgi?id=186190
2800
2801         Reviewed by Xabier Rodriguez-Calvar.
2802
2803         This is just a compilation improvement.
2804
2805         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2806         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2807         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2808
2809 2018-06-03  Darin Adler  <darin@apple.com>
2810
2811         [Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption
2812         https://bugs.webkit.org/show_bug.cgi?id=186245
2813
2814         Reviewed by Daniel Bates.
2815
2816         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2817         (convertToNSArray): Explicitly cast to WebAccessibilityObjectWrapperBase so we don't
2818         make method calls on WebAccessibilityObjectWrapper, a forward-declared class.
2819         (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Use CFAutorelease
2820         for the CGPathRef return value instead of Objective-C autorelease. Another option
2821         would be to use RetainPtr for the return type instead.
2822
2823         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2824         (AXObjectIsTextMarker): Use __bridge for bridging typecast.
2825         (AXObjectIsTextMarkerRange): Ditto.
2826         (AXTextMarkerRange): Ditto.
2827         (AXTextMarkerRangeStart): Ditto.
2828         (AXTextMarkerRangeEnd): Ditto.
2829         (isTextMarkerIgnored): Ditto.
2830         (accessibilityObjectForTextMarker): Ditto.
2831         (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): Ditto.
2832         (-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]): Ditto.
2833         (visiblePositionForStartOfTextMarkerRange): Ditto.
2834         (visiblePositionForEndOfTextMarkerRange): Ditto.
2835         (AXAttributeStringSetFont): Ditto. Also use @{} syntax to make NSDictionary
2836         and @() to make NSNumber.
2837         (AXAttributeStringSetColor): Use __bridge for bridging typecast, rearranging
2838         code so that the typecasts are on function arguments, not local variables,
2839         which makes lifetimes clearer.
2840         (AXAttributeStringSetElement): Use __bridge for bridging typecast.
2841         (WebTransformCGPathToNSBezierPath):
2842         (-[WebAccessibilityObjectWrapper bezierPathFromPath:]): Added a bridging
2843         typecast when passing an NSBezierPath through as a void* context argument;
2844         silent conversion to void* is not compatible with ARC.
2845         (createAccessibilityRoleMap): Use __unsafe_unretained for a table of
2846         NSString constants.
2847
2848         * bindings/js/ScriptControllerMac.mm:
2849         (WebCore::ScriptController::createScriptInstanceForWidget): Use __bridge
2850         for bridging typecast.
2851
2852         * bridge/objc/objc_class.mm:
2853         (JSC::Bindings::ObjcClass::classForIsA): Added bridging typecasts
2854         to convert a Class into a CFTypeRef.
2855         (JSC::Bindings::ObjcClass::methodNamed const): Use __bridge for bridging
2856         typecast.
2857         (JSC::Bindings::ObjcClass::fieldNamed const): Ditto.
2858         * bridge/objc/objc_instance.mm:
2859         (ObjcInstance::invokeObjcMethod): Ditto.
2860         * bridge/objc/objc_runtime.mm:
2861         (JSC::Bindings::ObjcField::valueFromInstance const): Ditto.
2862         (JSC::Bindings::ObjcField::setValueToInstance const): Ditto.
2863         * bridge/objc/objc_utility.mm:
2864         (JSC::Bindings::convertObjcValueToValue): Ditto. Also add a missing const
2865         to make it clearer to the compiler that the code is correct.
2866         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2867         (WebCore::createAndStoreMasterKey): Ditto.
2868         (WebCore::findMasterKey): Ditto.
2869         * editing/cocoa/DataDetection.mm:
2870         (WebCore::detectItemAtPositionWithRange): Ditto.
2871         * editing/cocoa/EditorCocoa.mm:
2872         (WebCore::Editor::fontAttributesForSelectionStart const): Ditto.
2873         * editing/cocoa/HTMLConverter.mm:
2874         (_font): Ditto.
2875         (fileWrapperForElement): Ditto.
2876         * fileapi/FileCocoa.mm:
2877         (WebCore::File::shouldReplaceFile): Ditto.
2878         * loader/archive/cf/LegacyWebArchiveMac.mm:
2879         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Ditto.
2880         * page/mac/TextIndicatorWindow.mm:
2881         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Ditto.
2882         (createContentCrossfadeAnimation): Ditto.
2883         * platform/cocoa/LocalizedStringsCocoa.mm:
2884         (WebCore::localizedString): Ditto.
2885         * platform/cocoa/SharedBufferCocoa.mm:
2886         (WebCore::SharedBuffer::create): Ditto.
2887         (WebCore::SharedBuffer::append): Ditto.
2888         * platform/graphics/FontPlatformData.h:
2889         (WebCore::toCTFont): Ditto.
2890         (WebCore::toNSFont): Ditto.
2891         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
2892         (WebCore::assetTrackMeetsHardwareDecodeRequirements): Ditto.
2893         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2894         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Ditto.
2895         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2896         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Ditto.
2897         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2898         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Ditto.
2899         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2900         (WebCore::MediaDescriptionAVFObjC::MediaDescriptionAVFObjC): Ditto.
2901         (WebCore::bufferWasConsumedCallback): Ditto.
2902         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
2903         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
2904         (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): Ditto.
2905         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): Ditto.
2906         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2907         (PlatformCALayerCocoa::create): Ditto.
2908         (PlatformCALayer::platformCALayer): Ditto.
2909         (PlatformCALayerCocoa::superlayer const): Ditto.
2910         (PlatformCALayerCocoa::contents const): Ditto.
2911         (PlatformCALayerCocoa::setContents): Ditto.
2912         * platform/graphics/cocoa/IOSurface.h: Ditto.
2913         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
2914         (TextTrackRepresentationCocoa::update): Ditto.
2915         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2916         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): Ditto.
2917         (WebCore::WebCoreDecompressionSession::resetQosTier): Ditto.
2918         * platform/graphics/cocoa/WebGLLayer.mm:
2919         (-[WebGLLayer display]): Ditto.
2920         * platform/graphics/mac/ImageMac.mm:
2921         (WebCore::BitmapImage::nsImage): Ditto.
2922         (WebCore::BitmapImage::snapshotNSImage): Ditto.
2923         * platform/graphics/mac/WebLayer.mm:
2924         (-[WebLayer drawInContext:]): Ditto.
2925         (-[WebSimpleLayer setNeedsDisplay]): Ditto.
2926         (-[WebSimpleLayer setNeedsDisplayInRect:]): Ditto.
2927         (-[WebSimpleLayer display]): Ditto.
2928         (-[WebSimpleLayer drawInContext:]): Ditto.
2929
2930         * platform/mac/CursorMac.mm:
2931         (WebCore::cursor): Mark pointer __strong to match the globals it points to.
2932
2933         * platform/mac/FileSystemMac.mm:
2934         (WebCore::FileSystem::setMetadataURL): Use RetainPtr instead of autorelease.
2935
2936         * platform/mac/PlatformPasteboardMac.mm:
2937         (WebCore::PlatformPasteboard::bufferForType): Use __bridge for bridging
2938         typecast.
2939         * platform/mac/PlatformSpeechSynthesizerMac.mm:
2940         (WebCore::speechSynthesisGetVoiceIdentifiers): Ditto.
2941         (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale): Ditto.
2942
2943         * platform/mac/PluginBlacklist.h: Use RetainPtr instead of explicit retain
2944         and release for NSDictionary and NSSet.
2945         * platform/mac/PluginBlacklist.mm:
2946         (WebCore::PluginBlacklist::create): Use __bridge for bridging typecast.
2947         (WebCore::PluginBlacklist::~PluginBlacklist): Remove explicit CFRelease calls.
2948         (WebCore::PluginBlacklist::PluginBlacklist): Add adoptNS calls and remove
2949         explciit CFRetain/release pairs.
2950
2951         * platform/mac/PublicSuffixMac.mm:
2952         (WebCore::isPublicSuffix): Use __bridge for bridging typecast.
2953         * platform/mac/RemoteCommandListenerMac.mm:
2954         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto.
2955         * platform/mac/SerializedPlatformRepresentationMac.mm:
2956         (WebCore::jsValueWithDictionaryInContext): Ditto.
2957         * platform/mac/URLMac.mm:
2958         (WebCore::URL::URL): Ditto.
2959         (WebCore::URL::createCFURL const): Ditto.
2960
2961         * platform/mac/WebCoreNSURLExtras.mm:
2962         (WebCore::collectRangesThatNeedMapping): Mark pointer __strong to match the
2963         local variable it eventually points to.
2964         (WebCore::stringByTrimmingWhitespace): Use __bridge for bridging typecast.
2965         (WebCore::URLByTruncatingOneCharacterBeforeComponent): Use
2966         CFBridgingRelease instead of autorelease, reducing typecasts.
2967         (WebCore::URLByRemovingComponentAndSubsequentCharacter): Ditto.
2968         (WebCore::userVisibleString): Use __bridge for bridging typecast.
2969         (WebCore::isUserVisibleURL): Ditto.
2970
2971         * platform/mac/WebGLBlacklist.mm:
2972         (WebCore::WebGLBlacklist::create): Use __bridge for bridging typecast.
2973         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2974         (WebCore::AVVideoCaptureSource::setPreset): Ditto.
2975         (WebCore::AVVideoCaptureSource::setupCaptureSession): Ditto. Also use @()
2976         instead of NSNumber.
2977         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2978         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Ditto.
2979         * platform/network/cocoa/ResourceRequestCocoa.mm:
2980         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): Ditto.
2981
2982         * platform/network/cocoa/ResourceResponseCocoa.mm: Use CFStringRef and
2983         CFSTR for constant string array commonHeaderFields rather than using
2984         NSString * and then relying on implicit bridging conversion.
2985
2986         * platform/network/mac/CertificateInfoMac.mm:
2987         (WebCore::CertificateInfo::dump const): Use __bridge for bridging typecast.
2988         * platform/network/mac/FormDataStreamMac.mm:
2989         (WebCore::createHTTPBodyNSInputStream): Ditto.
2990         (WebCore::httpBodyFromStream): Ditto.
2991         * platform/network/mac/ResourceErrorMac.mm:
2992         (WebCore::ResourceError::ResourceError): Ditto.
2993         (WebCore::ResourceError::cfError const): Ditto.
2994
2995         * rendering/RenderThemeMac.mm:
2996         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
2997         Use CFSTR("") instead of @"" for a string that is passed to CFDIctionaryRef.
2998         (WebCore::AttachmentLayout::layOutTitle): Use __bridge for bridging typecast.
2999         (WebCore::AttachmentLayout::layOutSubtitle): Ditto.
3000
3001         * testing/cocoa/WebArchiveDumpSupport.mm:
3002         (WebCoreTestSupport::createCFURLResponseFromResponseData): Use __bridge for
3003         bridging typecast.
3004         (WebCoreTestSupport::supportedNonImageMIMETypes): Deleted.
3005         (WebCoreTestSupport::convertWebResourceDataToString): Use the
3006         MIMETypeRegistry::isSupportedNonImageMIMEType function directly instead of
3007         building a CFArray out of MIMETypeRegistry::getSupportedNonImageMIMETypes
3008         and using CFArrayContainsValue. This is both much more direct and much more
3009         efficient as well.
3010
3011 2018-06-04  Timothy Hatcher  <timothy@apple.com>
3012
3013         [Win] REGRESSION(r232486) 'WebCore::RenderTheme::activeListBoxSelectionBackgroundColor': function does not take 0 arguments
3014         https://bugs.webkit.org/show_bug.cgi?id=186296
3015
3016         Unreviewed build fix.
3017
3018         * platform/win/PopupMenuWin.cpp:
3019         (WebCore::PopupMenuWin::paint):
3020         * rendering/RenderThemeWin.cpp:
3021         (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
3022
3023 2018-06-04  Chris Dumez  <cdumez@apple.com>
3024
3025         Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy"
3026         https://bugs.webkit.org/show_bug.cgi?id=186287
3027         <rdar://problem/40783352>
3028
3029         Reviewed by Youenn Fablet.
3030
3031         Tests: http/wpt/cross-origin-window-policy/allow-postmessage-from-deny.html
3032                http/wpt/cross-origin-window-policy/allow-postmessage.html
3033                http/wpt/cross-origin-window-policy/cross-origin-window-policy-header.html
3034                http/wpt/cross-origin-window-policy/navigation-from-opener-via-open-target.html
3035                http/wpt/cross-origin-window-policy/navigation-from-subframe-via-anchor-target.html
3036
3037         * bindings/js/JSDOMBindingSecurity.cpp:
3038         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginWindowPolicy):
3039         * bindings/js/JSDOMBindingSecurity.h:
3040         * bindings/js/JSDOMWindowCustom.cpp:
3041         (WebCore::effectiveCrossOriginWindowPolicyForAccess):
3042         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
3043         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
3044         (WebCore::addCrossOriginWindowPropertyNames):
3045         (WebCore::addScopedChildrenIndexes):
3046         * bindings/scripts/CodeGeneratorJS.pm:
3047         (GenerateAttributeGetterBodyDefinition):
3048         (GetCrossOriginsOptionsFromExtendedAttributeValue):
3049         (GenerateAttributeSetterBodyDefinition):
3050         (GenerateOperationBodyDefinition):
3051         * bindings/scripts/IDLAttributes.json:
3052         * dom/Document.cpp:
3053         (WebCore::Document::canNavigate):
3054         * loader/FrameLoader.cpp:
3055         (WebCore::FrameLoader::didBeginDocument):
3056         * page/AbstractDOMWindow.cpp:
3057         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
3058         * page/AbstractDOMWindow.h:
3059         (WebCore::AbstractDOMWindow::crossOriginWindowPolicy):
3060         (WebCore::AbstractDOMWindow::setCrossOriginWindowPolicy):
3061         * page/DOMWindow.idl:
3062         * page/Settings.yaml:
3063         * platform/network/HTTPHeaderNames.in:
3064         * platform/network/HTTPParsers.cpp:
3065         (WebCore::parseCrossOriginWindowPolicyHeader):
3066         * platform/network/HTTPParsers.h:
3067
3068 2018-06-04  Brent Fulgham  <bfulgham@apple.com>
3069
3070         REGRESSION(r231291): InputType should hold a WeakPtr to its HTMLInputElement
3071         https://bugs.webkit.org/show_bug.cgi?id=186096
3072         <rdar://problem/40651015>
3073
3074         Reviewed by Ryosuke Niwa.
3075
3076         Now that the InputType may be kept alive as part of in-flight form submissions, we
3077         shouldn't assume that the referenced HTMLInputElement is still valid before using it.
3078
3079         The only time we should be lacking a referencing element is in cases where the InputType
3080         is changing, either through a change in the HTMLInputElement's type attribute. In those
3081         cases we should check for a valid HTMLInputElement. In other cases, we should ASSERT.
3082
3083         * html/BaseButtonInputType.cpp:
3084         (WebCore::BaseButtonInputType::createInputRenderer):
3085         (WebCore::BaseButtonInputType::setValue):
3086         * html/BaseCheckableInputType.cpp:
3087         (WebCore::BaseCheckableInputType::saveFormControlState const):
3088         (WebCore::BaseCheckableInputType::restoreFormControlState):
3089         (WebCore::BaseCheckableInputType::appendFormData const):
3090         (WebCore::BaseCheckableInputType::handleKeydownEvent):
3091         (WebCore::BaseCheckableInputType::accessKeyAction):
3092         (WebCore::BaseCheckableInputType::setValue):
3093         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
3094         (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Add a nullptr check
3095         here, since this is called directly by code that causes the old InputType to be removed,
3096         which could leave us with a nullptr element().
3097         * html/BaseClickableWithKeyInputType.cpp:
3098         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent):
3099         (WebCore::BaseClickableWithKeyInputType::handleKeypressEvent):
3100         (WebCore::BaseClickableWithKeyInputType::accessKeyAction):
3101         * html/BaseDateAndTimeInputType.cpp:
3102         (WebCore::BaseDateAndTimeInputType::attributeChanged): Add a nullptr check
3103         here, since this is called directly by code that causes the old InputType to be removed,
3104         which could leave us with a nullptr element().
3105         * html/BaseTextInputType.cpp:
3106         (WebCore::BaseTextInputType::patternMismatch const):
3107         * html/CheckboxInputType.cpp:
3108         (WebCore::CheckboxInputType::valueMissing const):
3109         (WebCore::CheckboxInputType::willDispatchClick):
3110         (WebCore::CheckboxInputType::didDispatchClick):
3111         (WebCore::CheckboxInputType::shouldAppearIndeterminate const):
3112         * html/ColorInputType.cpp:
3113         (WebCore::ColorInputType::valueAsColor const):
3114         (WebCore::ColorInputType::createShadowSubtree):
3115         (WebCore::ColorInputType::handleDOMActivateEvent):
3116         (WebCore::ColorInputType::didChooseColor):
3117         (WebCore::ColorInputType::updateColorSwatch):
3118         (WebCore::ColorInputType::shadowColorSwatch const):
3119         (WebCore::ColorInputType::elementRectRelativeToRootView const):
3120         (WebCore::ColorInputType::shouldShowSuggestions const):
3121         (WebCore::ColorInputType::suggestions const):
3122         * html/EmailInputType.cpp:
3123         (WebCore::EmailInputType::typeMismatchFor const):
3124         (WebCore::EmailInputType::typeMismatch const):
3125         (WebCore::EmailInputType::typeMismatchText const):
3126         (WebCore::EmailInputType::sanitizeValue const):
3127         * html/FileInputType.cpp:
3128         (WebCore::FileInputType::appendFormData const):
3129         (WebCore::FileInputType::attributeChanged): Add a nullptr check here, since
3130         this is called directly by code that causes the old InputType to be removed,
3131         which could leave us with a nullptr element().
3132         (WebCore::FileInputType::valueMissing const):
3133         (WebCore::FileInputType::valueMissingText const):
3134         (WebCore::FileInputType::handleDOMActivateEvent):
3135         (WebCore::FileInputType::createInputRenderer):
3136         (WebCore::FileInputType::setValue):
3137         (WebCore::FileInputType::createShadowSubtree):
3138         (WebCore::FileInputType::disabledAttributeChanged):
3139         (WebCore::FileInputType::multipleAttributeChanged):
3140         (WebCore::FileInputType::allowsDirectories const):
3141         (WebCore::FileInputType::setFiles):
3142         (WebCore::FileInputType::iconLoaded):
3143         (WebCore::FileInputType::receiveDroppedFiles):
3144         (WebCore::FileInputType::defaultToolTip const):
3145         * html/HTMLInputElement.h:
3146         (WebCore::HTMLInputElement::weakPtrFactory const):
3147         * html/HiddenInputType.cpp:
3148         (WebCore::HiddenInputType::saveFormControlState const):
3149         (WebCore::HiddenInputType::restoreFormControlState):
3150         (WebCore::HiddenInputType::setValue):
3151         (WebCore::HiddenInputType::appendFormData const):
3152         * html/ImageInputType.cpp:
3153         (WebCore::ImageInputType::appendFormData const):
3154         (WebCore::ImageInputType::handleDOMActivateEvent):
3155         (WebCore::ImageInputType::createInputRenderer):
3156         (WebCore::ImageInputType::altAttributeChanged):
3157         (WebCore::ImageInputType::srcAttributeChanged):
3158         (WebCore::ImageInputType::attach):
3159         (WebCore::ImageInputType::height const):
3160         (WebCore::ImageInputType::width const):
3161         * html/InputType.cpp:
3162         (WebCore::InputType::saveFormControlState const):
3163         (WebCore::InputType::restoreFormControlState):
3164         (WebCore::InputType::isFormDataAppendable const):
3165         (WebCore::InputType::appendFormData const):
3166         (WebCore::InputType::sizeShouldIncludeDecoration const):
3167         (WebCore::InputType::validationMessage const):
3168         (WebCore::InputType::createInputRenderer):
3169         (WebCore::InputType::blur):
3170         (WebCore::InputType::destroyShadowSubtree):
3171         (WebCore::InputType::dispatchSimulatedClickIfActive const):
3172         (WebCore::InputType::chrome const):
3173         (WebCore::InputType::isKeyboardFocusable const):
3174         (WebCore::InputType::isMouseFocusable const):
3175         (WebCore::InputType::accessKeyAction):
3176         (WebCore::InputType::setValue):
3177         (WebCore::InputType::visibleValue const):
3178         (WebCore::InputType::applyStep):
3179         (WebCore::InputType::stepUpFromRenderer):
3180         * html/InputType.h:
3181         (WebCore::InputType::InputType):
3182         (WebCore::InputType::element const):
3183         * html/NumberInputType.cpp:
3184         (WebCore::NumberInputType::attributeChanged): Add a nullptr check here, since
3185         this is called directly by code that causes the old InputType to be removed,
3186         which could leave us with a nullptr element().
3187         (WebCore::NumberInputType::setValue):
3188         (WebCore::NumberInputType::valueAsDouble const):
3189         (WebCore::NumberInputType::setValueAsDouble const):
3190         (WebCore::NumberInputType::setValueAsDecimal const):
3191         (WebCore::NumberInputType::typeMismatch const):
3192         (WebCore::NumberInputType::createStepRange const):
3193         (WebCore::NumberInputType::sizeShouldIncludeDecoration const):
3194         (WebCore::NumberInputType::decorationWidth const):
3195         (WebCore::NumberInputType::localizeValue const):
3196         (WebCore::NumberInputType::visibleValue const):
3197         (WebCore::NumberInputType::convertFromVisibleValue const):
3198         (WebCore::NumberInputType::hasBadInput const):
3199         (WebCore::NumberInputType::minOrMaxAttributeChanged):
3200         (WebCore::NumberInputType::stepAttributeChanged):
3201         * html/RadioInputType.cpp:
3202         (WebCore::RadioInputType::valueMissing const):
3203         (WebCore::RadioInputType::handleKeydownEvent):
3204         (WebCore::RadioInputType::handleKeyupEvent):
3205         (WebCore::RadioInputType::isKeyboardFocusable const):
3206         (WebCore::RadioInputType::shouldSendChangeEventAfterCheckedChanged):
3207         (WebCore::RadioInputType::willDispatchClick):
3208         (WebCore::RadioInputType::didDispatchClick):
3209         (WebCore::RadioInputType::matchesIndeterminatePseudoClass const):
3210         * html/RangeInputType.cpp:
3211         (WebCore::RangeInputType::attributeChanged): Add a nullptr check here, since
3212         this is called directly by code that causes the old InputType to be removed,
3213         which could leave us with a nullptr element().
3214         (WebCore::RangeInputType::valueAsDouble const):
3215         (WebCore::RangeInputType::setValueAsDecimal const):
3216         (WebCore::RangeInputType::createStepRange const):
3217         (WebCore::RangeInputType::handleMouseDownEvent):
3218         (WebCore::RangeInputType::handleTouchEvent):
3219         (WebCore::RangeInputType::handleKeydownEvent):
3220         (WebCore::RangeInputType::createShadowSubtree):
3221         (WebCore::RangeInputType::sliderTrackElement const):
3222         (WebCore::RangeInputType::createInputRenderer):
3223         (WebCore::RangeInputType::accessKeyAction):
3224         (WebCore::RangeInputType::minOrMaxAttributeChanged):
3225         (WebCore::RangeInputType::setValue):
3226         (WebCore::RangeInputType::updateTickMarkValues):
3227         * html/ResetInputType.cpp:
3228         (WebCore::ResetInputType::handleDOMActivateEvent):
3229         * html/SearchInputType.cpp:
3230         (WebCore::SearchInputType::addSearchResult):
3231         (WebCore::SearchInputType::maxResultsAttributeChanged):
3232         (WebCore::SearchInputType::createInputRenderer):
3233         (WebCore::SearchInputType::createShadowSubtree):
3234         (WebCore::SearchInputType::handleKeydownEvent):
3235         (WebCore::SearchInputType::startSearchEventTimer):
3236         (WebCore::SearchInputType::searchEventTimerFired):
3237         (WebCore::SearchInputType::searchEventsShouldBeDispatched const):
3238         (WebCore::SearchInputType::didSetValueByUserEdit):
3239         (WebCore::SearchInputType::sizeShouldIncludeDecoration const):
3240         * html/SubmitInputType.cpp:
3241         (WebCore::SubmitInputType::appendFormData const):
3242         (WebCore::SubmitInputType::handleDOMActivateEvent):
3243         * html/TextFieldInputType.cpp:
3244         (WebCore::TextFieldInputType::attributeChanged): Add a nullptr check here, since
3245         this is called directly by code that causes the old InputType to be removed,
3246         which could leave us with a nullptr element().
3247         (WebCore::TextFieldInputType::isKeyboardFocusable const):
3248         (WebCore::TextFieldInputType::isMouseFocusable const):
3249         (WebCore::TextFieldInputType::valueMissing const):
3250         (WebCore::TextFieldInputType::setValue):
3251         (WebCore::TextFieldInputType::handleKeydownEvent):
3252         (WebCore::TextFieldInputType::handleKeydownEventForSpinButton):
3253         (WebCore::TextFieldInputType::forwardEvent):
3254         (WebCore::TextFieldInputType::elementDidBlur):
3255         (WebCore::TextFieldInputType::handleFocusEvent):
3256         (WebCore::TextFieldInputType::handleBlurEvent):
3257         (WebCore::TextFieldInputType::createInputRenderer):
3258         (WebCore::TextFieldInputType::shouldHaveSpinButton const):
3259         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator const):
3260         (WebCore::TextFieldInputType::createShadowSubtree):
3261         (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent):
3262         (WebCore::TextFieldInputType::updatePlaceholderText):
3263         (WebCore::TextFieldInputType::appendFormData const):
3264         (WebCore::TextFieldInputType::subtreeHasChanged):
3265         (WebCore::TextFieldInputType::didSetValueByUserEdit):
3266         (WebCore::TextFieldInputType::updateInnerTextValue):
3267         (WebCore::TextFieldInputType::focusAndSelectSpinButtonOwner):
3268         (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents):
3269         (WebCore::TextFieldInputType::shouldSpinButtonRespondToWheelEvents):
3270         (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const):
3271         (WebCore::TextFieldInputType::shouldDrawAutoFillButton const):
3272         (WebCore::TextFieldInputType::autoFillButtonElementWasClicked):
3273         (WebCore::TextFieldInputType::createContainer):
3274         (WebCore::TextFieldInputType::createAutoFillButton):
3275         (WebCore::TextFieldInputType::updateAutoFillButton):
3276         * html/URLInputType.cpp:
3277         (WebCore::URLInputType::typeMismatch const):
3278
3279 2018-06-04  Chris Dumez  <cdumez@apple.com>
3280
3281         Unreviewed iOS build fix with recent SDKs.
3282
3283         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3284         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3285
3286 2018-06-04  Dean Jackson  <dino@apple.com>
3287
3288         AR Badging on transparent thumbnail images makes the glyph look really dark
3289         https://bugs.webkit.org/show_bug.cgi?id=186289
3290         <rdar://problem/40627111>
3291
3292         Reviewed by Anders Carlsson.
3293
3294         Clip out the shape for the drop shadow, so that it isn't visible if
3295         there is transparent pixel data on top of it.
3296
3297         * rendering/RenderThemeIOS.mm:
3298         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
3299
3300 2018-06-04  Timothy Hatcher  <timothy@apple.com>
3301
3302         Selection color is dark when using Safari in dark mode.
3303
3304         https://bugs.webkit.org/show_bug.cgi?id=186288
3305         rdar://problem/38438625
3306
3307         Reviewed by Simon Fraser.
3308
3309         Pass StyleColor::Options to all of the selection color functions.
3310         Removed supportsSelectionForegroundColors() from RenderThemeMac,
3311         to get the default of true, since the forground colors in dark mode
3312         can be different now. Use new semantic color methods on NSColor.
3313
3314         * rendering/RenderElement.cpp:
3315         (WebCore::RenderElement::selectionColor const):
3316         (WebCore::RenderElement::selectionBackgroundColor const):
3317         * rendering/RenderListBox.cpp:
3318         (WebCore::RenderListBox::paintItemForeground):
3319         (WebCore::RenderListBox::paintItemBackground):
3320         * rendering/RenderTheme.cpp:
3321         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
3322         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
3323         (WebCore::RenderTheme::activeSelectionForegroundColor const):
3324         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
3325         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
3326         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
3327         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
3328         (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
3329         (WebCore::RenderTheme::platformActiveSelectionForegroundColor const):
3330         (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
3331         (WebCore::RenderTheme::platformInactiveSelectionForegroundColor const):
3332         (WebCore::RenderTheme::platformActiveListBoxSelectionBackgroundColor const):
3333         (WebCore::RenderTheme::platformActiveListBoxSelectionForegroundColor const):
3334         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
3335         (WebCore::RenderTheme::platformInactiveListBoxSelectionForegroundColor const):
3336         * rendering/RenderTheme.h:
3337         * rendering/RenderThemeGtk.cpp:
3338         (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor const):
3339         (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor const):
3340         (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor const):
3341         (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor const):
3342         (WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor const):
3343         (WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor const):
3344         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor const):
3345         * rendering/RenderThemeGtk.h:
3346         * rendering/RenderThemeIOS.h:
3347         * rendering/RenderThemeIOS.mm:
3348         (WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const):
3349         (WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const):
3350         * rendering/RenderThemeMac.h:
3351         * rendering/RenderThemeMac.mm:
3352         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
3353         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
3354         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
3355         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
3356         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
3357         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
3358         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
3359         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
3360         * rendering/RenderThemeWin.cpp:
3361         (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
3362         (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
3363         (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
3364         (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
3365         * rendering/RenderThemeWin.h:
3366
3367 2018-06-04  Chris Dumez  <cdumez@apple.com>
3368