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