REGRESSION (r230843): Flash doesn't work; Produces blue box on page
[WebKit.git] / Source / WebCore / ChangeLog
1 2018-07-05  Youenn Fablet  <youenn@apple.com>
2
3         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
4         https://bugs.webkit.org/show_bug.cgi?id=187346
5         <rdar://problem/41773974>
6
7         Reviewed by Ryosuke Niwa.
8
9         Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
10         Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
11
12         Test: http/tests/plugins/plugin-allow-then-reload.html
13
14         * plugins/PluginData.h:
15         * plugins/PluginInfoProvider.cpp:
16         (WebCore::PluginInfoProvider::clearPagesPluginData):
17         * plugins/PluginInfoProvider.h:
18         * testing/Internals.cpp:
19         (WebCore::Internals::pluginCount):
20         * testing/Internals.h:
21         * testing/Internals.idl:
22
23 2018-07-05  Brady Eidson  <beidson@apple.com>
24
25         IndexedDB operations in a Page fail after a StorageProcess crash.
26         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
27
28         Reviewed by Alex Christensen.
29
30         Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html
31
32         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
33         in the WebProcess about it.
34         
35         This puts Documents/Workers in an error mode where requests fail instead of timeout.
36         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
37         new connection that works.
38         
39         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
40         (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
41         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
42         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
43         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
44         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
45         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
46         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
47         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
48         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
49         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
50         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
51         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
52         (WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
53         (WebCore::IDBClient::IDBConnectionToServer::getCount):
54         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
55         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
56         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
57         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
58         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
59         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
60         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
61         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
62         (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
63         (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
64         (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
65         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
66         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
67         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
68         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
69         * Modules/indexeddb/client/IDBConnectionToServer.h:
70
71         * Modules/indexeddb/shared/IDBError.h:
72         (WebCore::IDBError::serverConnectionLostError):
73
74         * page/Page.cpp:
75         (WebCore::Page::setSessionID):
76         (WebCore::Page::idbConnection):
77         (WebCore::Page::optionalIDBConnection):
78         (WebCore::Page::clearIDBConnection):
79         * page/Page.h:
80
81 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
82
83         Youtube video pages crash after a couple of minutes
84         https://bugs.webkit.org/show_bug.cgi?id=187316
85
86         Reviewed by Antti Koivisto.
87
88         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
89         which traverses all media players across different documents including the one in the main frame while its iframe
90         is getting removed (to update the Touch Bar's media control).
91
92         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
93         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
94         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
95
96         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
97         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
98         a timer via scheduleUpdateNowPlayingInfo instead.
99
100         Test: media/remove-video-best-media-element-in-main-frame-crash.html
101
102         * html/HTMLMediaElement.cpp:
103         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
104         moved to Page.
105         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
106         a raw pointer while we're at it.
107         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
108         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
109         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
110         (WebCore::HTMLMediaElement::contextDestroyed):
111         (WebCore::HTMLMediaElement::stop):
112         (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager.
113         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired.
114         * html/HTMLMediaElement.h:
115         * page/Page.cpp:
116         (WebCore::Page::Page):
117         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
118         (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager.
119         * page/Page.h:
120         * testing/Internals.cpp:
121         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
122         * testing/Internals.h:
123
124 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
125
126         REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient()
127         https://bugs.webkit.org/show_bug.cgi?id=187377
128
129         Reviewed by Simon Fraser.
130
131         Clear m_client of an audio track or a video track before removing it from the list
132         since TrackListBase::m_inbandTracks may hold the last ref to the track.
133
134         * html/HTMLMediaElement.cpp:
135         (WebCore::HTMLMediaElement::removeAudioTrack):
136         (WebCore::HTMLMediaElement::removeVideoTrack):
137
138 2018-07-05  Fujii Hironori  <Hironori.Fujii@sony.com>
139
140         REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius
141         https://bugs.webkit.org/show_bug.cgi?id=187336
142
143         Reviewed by Carlos Garcia Campos.
144
145         drawGlyphsShadow has a fast path to draw a shadow without a shadow
146         layer. Since r233495, it is not used for zero blur-radius shadow.
147
148         In Bug 187244, I changed ShadowState::isRequired not to check
149         blur-radius is zero. This is not a right fix.
150
151         This change reverts r233495.
152
153         No new tests (Covered by existing tests).
154
155         * platform/graphics/cairo/CairoOperations.cpp:
156         (WebCore::Cairo::ShadowState::isRequired const): Return false if
157         'blur' is zero.
158         (WebCore::Cairo::fillRectWithRoundedHole): Use
159         ShadowState::isVisible instead of ShadowState::isRequired to check
160         a shadow should be drawn.
161
162 2018-07-05  Timothy Hatcher  <timothy@apple.com>
163
164         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
165         https://bugs.webkit.org/show_bug.cgi?id=187369
166         rdar://problem/41870420
167
168         Reviewed by Tim Horton.
169
170         * Modules/mediasession/WebMediaSessionManager.cpp:
171         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
172         * css/MediaQueryEvaluator.cpp:
173         (WebCore::prefersDarkInterfaceEvaluate):
174         * css/StyleColor.h:
175         * dom/Document.cpp:
176         (WebCore::Document::useDarkAppearance const):
177         (WebCore::Document::styleColorOptions const):
178         (WebCore::Document::useDefaultAppearance const): Deleted.
179         * dom/Document.h:
180         * inspector/InspectorOverlay.cpp:
181         (WebCore::InspectorOverlay::paint):
182         * page/Page.cpp:
183         (WebCore::Page::useDarkAppearance const):
184         (WebCore::Page::defaultAppearance const): Deleted.
185         * page/Page.h:
186         (WebCore::Page::setUseDarkAppearance):
187         (WebCore::Page::setDefaultAppearance): Deleted.
188         * platform/Theme.h:
189         * platform/graphics/MediaPlaybackTargetPicker.h:
190         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
191         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
192         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
193         * platform/mac/DragImageMac.mm:
194         (WebCore::createDragImageForLink):
195         * platform/mac/LocalDefaultSystemAppearance.h:
196         * platform/mac/LocalDefaultSystemAppearance.mm:
197         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
198         * platform/mac/ThemeMac.h:
199         * platform/mac/ThemeMac.mm:
200         (WebCore::ThemeMac::paint):
201         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
202         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
203         * platform/mock/MediaPlaybackTargetPickerMock.h:
204         * rendering/InlineTextBox.cpp:
205         (WebCore::InlineTextBox::resolveStyleForMarkedText):
206         * rendering/RenderLayerBacking.cpp:
207         (WebCore::RenderLayerBacking::paintContents):
208         * rendering/RenderLayerCompositor.cpp:
209         (WebCore::RenderLayerCompositor::paintContents):
210         * rendering/RenderTheme.cpp:
211         (WebCore::RenderTheme::paint):
212         * rendering/RenderThemeMac.mm:
213         (WebCore::RenderThemeMac::documentViewFor const):
214         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
215         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
216         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
217         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
218         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
219         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
220         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
221         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
222         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
223         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
224         (WebCore::RenderThemeMac::colorCache const):
225         (WebCore::RenderThemeMac::systemColor const):
226         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
227         (WebCore::RenderThemeMac::paintSliderThumb):
228         * svg/graphics/SVGImage.cpp:
229         (WebCore::SVGImage::draw):
230
231 2018-07-05  Commit Queue  <commit-queue@webkit.org>
232
233         Unreviewed, rolling out r233539.
234         https://bugs.webkit.org/show_bug.cgi?id=187368
235
236         Changes made for youtube crashes has caused 15 api failures
237         (Requested by Truitt on #webkit).
238
239         Reverted changeset:
240
241         "Youtube video pages crash after a couple of minutes"
242         https://bugs.webkit.org/show_bug.cgi?id=187316
243         https://trac.webkit.org/changeset/233539
244
245 2018-07-05  Chris Dumez  <cdumez@apple.com>
246
247         Update Element API to use qualifiedName instead of name/localName where applicable
248         https://bugs.webkit.org/show_bug.cgi?id=187347
249
250         Reviewed by Darin Adler.
251
252         Update Element API to use qualifiedName instead of name/localName where applicable. Naming
253         is now consistent with the IDL and the specification:
254         - https://dom.spec.whatwg.org/#element
255
256         Our implementation properly deals with qualified names already, even though the parameters
257         were named localName.
258
259         * dom/Element.cpp:
260         (WebCore::Element::getAttribute const):
261         (WebCore::Element::toggleAttribute):
262         (WebCore::Element::setAttribute):
263         (WebCore::Element::removeAttribute):
264         (WebCore::Element::getAttributeNode):
265         (WebCore::Element::hasAttribute const):
266         * dom/Element.h:
267
268 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
269
270         Youtube video pages crash after a couple of minutes
271         https://bugs.webkit.org/show_bug.cgi?id=187316
272
273         Reviewed by Antti Koivisto.
274
275         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
276         which traverses all media players across different documents including the one in the main frame while its iframe
277         is getting removed (to update the Touch Bar's media control).
278
279         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
280         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
281         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
282
283         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
284         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
285         a timer via scheduleUpdateNowPlayingInfo instead.
286
287         Test: media/remove-video-best-media-element-in-main-frame-crash.html
288
289         * html/HTMLMediaElement.cpp:
290         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
291         moved to Page.
292         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
293         a raw pointer while we're at it.
294         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
295         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
296         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
297         (WebCore::HTMLMediaElement::contextDestroyed):
298         (WebCore::HTMLMediaElement::stop):
299         (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
300         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate.
301         * html/HTMLMediaElement.h:
302         * page/Page.cpp:
303         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
304         * page/Page.h:
305         * testing/Internals.cpp:
306         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
307         * testing/Internals.h:
308
309 2018-07-05  Zalan Bujtas  <zalan@apple.com>
310
311         Do not assume that hypen's width can be computed using the simplified text measure codepath.
312         https://bugs.webkit.org/show_bug.cgi?id=187352
313         <rdar://problem/40821283>
314
315         Reviewed by Simon Fraser.
316
317         Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
318
319         Test: fast/text/hyphen-is-complex-crash.html
320
321         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
322         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
323         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
324         * rendering/SimpleLineLayoutTextFragmentIterator.h:
325
326 2018-07-05  Eric Carlson  <eric.carlson@apple.com>
327
328         Video sometimes flickers when playing to AppleTV
329         https://bugs.webkit.org/show_bug.cgi?id=187193
330         <rdar://problem/40153865>
331
332         Unreviewed, fix a broken API test.
333
334         * platform/audio/ios/AudioSessionIOS.mm:
335         (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, 
336         because it signals that WebKit is not playing audio so we want allow other apps to play.
337
338 2018-07-05  Per Arne Vollan  <pvollan@apple.com>
339
340         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm
341         https://bugs.webkit.org/show_bug.cgi?id=187334
342
343         Reviewed by Alex Christensen.
344
345         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding
346         to use NSTimer or NSAnimation for scrollbar animation.
347
348         No new tests. No change in behavior.
349
350         * platform/mac/ScrollAnimatorMac.mm:
351         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
352         (-[WebScrollbarPartAnimation startAnimation]):
353         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
354
355 2018-07-05  Timothy Hatcher  <timothy@apple.com>
356
357         Don't invert text color for selections in light mode.
358         https://bugs.webkit.org/show_bug.cgi?id=187349
359         rdar://problem/41297946
360
361         Reviewed by Tim Horton.
362
363         Fix color caching in RenderTheme so we don't cache a dark mode color
364         for a light appearance, or vise versa. Use the new color caching
365         in RenderThemeMac, and clear the color caches in purgeCaches.
366
367         Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options.
368         Return true only in dark mode.
369
370         * rendering/RenderTheme.cpp:
371         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
372         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
373         (WebCore::RenderTheme::activeSelectionForegroundColor const):
374         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
375         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
376         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
377         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
378         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
379         (WebCore::RenderTheme::purgeCaches):
380         (WebCore::RenderTheme::platformColorsDidChange):
381         (WebCore::RenderTheme::activeTextSearchHighlightColor const):
382         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const):
383         * rendering/RenderTheme.h:
384         (WebCore::RenderTheme::supportsSelectionForegroundColors const):
385         (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const):
386         (WebCore::RenderTheme::colorCache const):
387         (WebCore::RenderTheme::purgeCaches): Deleted.
388         * rendering/RenderThemeMac.h:
389         * rendering/RenderThemeMac.mm:
390         (WebCore::RenderThemeMac::purgeCaches):
391         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
392         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
393         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
394         (WebCore::RenderThemeMac::platformColorsDidChange):
395         (WebCore::RenderThemeMac::colorCache const):
396         (WebCore::RenderThemeMac::systemColor const):
397
398 2018-07-05  Zalan Bujtas  <zalan@apple.com>
399
400         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
401         https://bugs.webkit.org/show_bug.cgi?id=186709
402         <rdar://problem/41173793>
403
404         Reviewed by Simon Fraser.
405
406         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
407
408         Not testable.
409
410         * rendering/SimpleLineLayoutFlowContents.h:
411
412 2018-07-05  Nan Wang  <n_wang@apple.com>
413
414         AX: setValue on text controls should send out key events
415         https://bugs.webkit.org/show_bug.cgi?id=186690
416         <rdar://problem/41169985>
417
418         Reviewed by Chris Fleizach.
419
420         Use Editor's insertText function when the text control element is being
421         focused, so that the InputEvent will be dispatched properly.
422
423         Test: accessibility/mac/set-value-editable-dispatch-events.html
424
425         * accessibility/AccessibilityRenderObject.cpp:
426         (WebCore::AccessibilityRenderObject::setValue):
427
428 2018-07-05  Chris Dumez  <cdumez@apple.com>
429
430         ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails
431         https://bugs.webkit.org/show_bug.cgi?id=187152
432
433         Reviewed by Brent Fulgham.
434
435         Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it
436         appends an item to m_dictionaryStack which is expected to get popped later on via
437         a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1)
438         assertion in the destructor protects against a begin / end mismatch.
439
440         However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early
441         after a call to beginArrayElement() when the lambda function call returns false, causing us
442         not to call the matching endArrayElement() in this case. This patch addresses the issue by
443         calling endArrayElement() before returning early.
444
445         This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format.
446         Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old
447         data fails and we hit the buggy code path.
448
449         * platform/KeyedCoding.h:
450         (WebCore::KeyedDecoder::decodeObjects):
451
452 2018-07-05  Antti Koivisto  <antti@apple.com>
453
454         Move CSSParserContext to a file of its own
455         https://bugs.webkit.org/show_bug.cgi?id=187342
456
457         Reviewed by Zalan Bujtas.
458
459         Move it out from CSSParserMode.h and CSSParser.cpp.
460
461         * Sources.txt:
462         * WebCore.xcodeproj/project.pbxproj:
463         * contentextensions/ContentExtensionParser.cpp:
464         * css/PropertySetCSSStyleDeclaration.h:
465         * css/StyleProperties.h:
466         * css/StyleSheetContents.h:
467         * css/parser/CSSDeferredParser.h:
468         * css/parser/CSSParser.cpp:
469         (WebCore::strictCSSParserContext): Deleted.
470         (WebCore::CSSParserContext::CSSParserContext): Deleted.
471         (WebCore::operator==): Deleted.
472         * css/parser/CSSParser.h:
473         * css/parser/CSSParserContext.cpp: Added.
474         (WebCore::strictCSSParserContext):
475         (WebCore::CSSParserContext::CSSParserContext):
476         (WebCore::operator==):
477
478         Also add the missing textAutosizingEnabled bit.
479
480         * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h.
481         (WebCore::CSSParserContextHash::hash):
482
483         Also add the missing bits to the hash function.
484         
485         (WebCore::isQuirksModeBehavior): Deleted.
486         (WebCore::isUASheetBehavior): Deleted.
487         (WebCore::isUnitLessValueParsingEnabledForMode): Deleted.
488         (WebCore::isCSSViewportParsingEnabledForMode): Deleted.
489         (WebCore::strictToCSSParserMode): Deleted.
490         (WebCore::isStrictParserMode): Deleted.
491         * css/parser/CSSParserIdioms.h:
492         * css/parser/CSSParserImpl.h:
493         * css/parser/CSSParserMode.h:
494         (WebCore::CSSParserContext::completeURL const): Deleted.
495         (WebCore::operator!=): Deleted.
496         (WebCore::CSSParserContextHash::hash): Deleted.
497         (WebCore::CSSParserContextHash::equal): Deleted.
498         (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted.
499         (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted.
500         (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted.
501         * css/parser/CSSPropertyParserHelpers.h:
502         * css/parser/CSSSelectorParser.cpp:
503         * css/parser/CSSVariableParser.cpp:
504
505 2018-07-05  Antoine Quint  <graouts@apple.com>
506
507         [Web Animations] The ready promise should initially be resolved
508         https://bugs.webkit.org/show_bug.cgi?id=187341
509         <rdar://problem/41844711>
510
511         Reviewed by Dean Jackson.
512
513         The Web Animations spec mandates that the ready promise is initially resolved.
514
515         * animation/WebAnimation.cpp:
516         (WebCore::WebAnimation::WebAnimation):
517
518 2018-07-05  Sergio Villar Senin  <svillar@igalia.com>
519
520         [WebVR] Fix VRDisplayEvent implementation
521         https://bugs.webkit.org/show_bug.cgi?id=187337
522
523         Reviewed by Žan Doberšek.
524
525         VRDisplayEvent implementation had two issues. First there were no attributes storing the
526         VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
527         should be handled via an optional.
528
529         * Modules/webvr/VRDisplayEvent.cpp:
530         (WebCore::VRDisplayEvent::VRDisplayEvent):
531         (WebCore::VRDisplayEvent::display const): Deleted.
532         (WebCore::VRDisplayEvent::reason const): Deleted.
533         * Modules/webvr/VRDisplayEvent.h:
534
535 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
536
537         REGRESSION(r233325): [GTK] Broke 40 animations tests
538         https://bugs.webkit.org/show_bug.cgi?id=187264
539
540         Reviewed by Žan Doberšek.
541
542         This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when
543         accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default.
544
545         * PlatformGTK.cmake: Add new file to compilation.
546         * platform/graphics/DisplayRefreshMonitor.cpp:
547         (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK.
548         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added.
549         (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk):
550         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
551         (WebCore::onFrameClockUpdate):
552         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback):
553         (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
554         * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added.
555         (WebCore::DisplayRefreshMonitorGtk::create):
556
557 2018-07-04  Antti Koivisto  <antti@apple.com>
558
559         Reparse user stylesheets when _useSystemAppearance changes
560         https://bugs.webkit.org/show_bug.cgi?id=187312
561         <rdar://problem/38565834>
562
563         Reviewed by Tim Horton.
564
565         This setting may affect user stylesheet parsing. Reparse if it changes.
566
567         Test: fast/media/use-system-appearance-user-stylesheet-parsing.html
568
569         * page/Page.cpp:
570         (WebCore::Page::setUseSystemAppearance):
571         * page/Page.h:
572         (WebCore::Page::setUseSystemAppearance): Deleted.
573         * testing/Internals.cpp:
574         (WebCore::Internals::setUseSystemAppearance):
575         * testing/Internals.h:
576         * testing/Internals.idl:
577
578 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
579
580         RealtimeIncomingVideoSources: Call stop() directly in the destructor
581         https://bugs.webkit.org/show_bug.cgi?id=187303
582
583         Reviewed by Youenn Fablet.
584
585         Avoiding to call stopProducingData when we are not actually producing data.
586
587         This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged.
588
589         * platform/mediastream/RealtimeIncomingVideoSource.h:
590         (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource):
591
592 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
593
594         [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource
595         https://bugs.webkit.org/show_bug.cgi?id=187304
596
597         Reviewed by Philippe Normand.
598
599         We let parsebin build the StreamCollection for us and pass extra metadata through the
600         `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the
601         MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason.
602
603         MediaStream layout tests already test that code path.
604
605         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
606         (WebCore::webkitMediaStreamSrcPadProbeCb):
607
608 2018-07-04  Frederic Wang  <fwang@igalia.com>
609
610         [WebIDL] Remove custom bindings for HTMLDocument
611         https://bugs.webkit.org/show_bug.cgi?id=173444
612
613         Unreviewed, add missing bugzilla link for FIXME comments.
614
615         * dom/Document.cpp:
616         (WebCore::Document::closeForBindings):
617         (WebCore::Document::write):
618         (WebCore::Document::writeln):
619
620 2018-07-04  Tim Horton  <timothy_horton@apple.com>
621
622         Introduce PLATFORM(IOSMAC)
623         https://bugs.webkit.org/show_bug.cgi?id=187315
624
625         Reviewed by Dan Bernstein.
626
627         * Configurations/Base.xcconfig:
628         * Configurations/FeatureDefines.xcconfig:
629         * Configurations/WebCore.xcconfig:
630         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
631         (WebCore::GeolocationPosition::GeolocationPosition):
632         * page/cocoa/MemoryReleaseCocoa.mm:
633         (WebCore::platformReleaseMemory):
634         * platform/audio/ios/AudioSessionIOS.mm:
635         (WebCore::AudioSession::setCategory):
636         (WebCore::AudioSession::routingContextUID const):
637         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
638         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
639         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
640         * platform/ios/PlatformPasteboardIOS.mm:
641         (WebCore::registerItemToPasteboard):
642         * platform/ios/WebItemProviderPasteboard.mm:
643         (-[WebItemProviderRegistrationInfoList itemProvider]):
644
645 2018-07-03  Antoine Quint  <graouts@apple.com>
646
647         [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably
648         https://bugs.webkit.org/show_bug.cgi?id=186508
649         <rdar://problem/41000260>
650
651         Reviewed by Dean Jackson.
652
653         The remaining failing assertion in this test assumes that the ready promise for an animation is fired
654         prior to requestAnimationFrame callbacks being fired in the current event loop such that registering
655         the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline
656         time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending
657         tasks, which will resolve the ready promise for any play-pending animations.
658
659         * animation/DocumentTimeline.cpp:
660         (WebCore::DocumentTimeline::updateAnimations):
661
662 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
663
664         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
665         https://bugs.webkit.org/show_bug.cgi?id=187284
666
667         Reviewed by Eric Carlson.
668
669         The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document,
670         which does not have a valid script execution context because some uses of GenericEventQueue in media code
671         was not closing the queue upon stopping of all active DOM objects.
672
673         Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects.
674         Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList)
675         inherit from ActiveDOMObject instead of ContextDestructionObserver to do this.
676
677         Also fixed a bug that media elements inside a template element (and other cases where the document doesn't
678         have a browsing context) were scheduling events since this would hit the newly added debug assertion in
679         GenericEventQueue::dispatchOneEvent.
680
681         Test: media/track/video-track-addition-and-frame-removal.html
682
683         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
684         (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has
685         this object alive since canSuspendForDocumentSuspension always returns false.
686         (WebCore::WebKitMediaKeySession::resume): Ditto.
687         (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash.
688         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
689         * Modules/mediasource/MediaSource.cpp:
690         (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM
691         objects are stopped since this MediaSource and the related media objects are about to be destructed.
692         (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension
693         returns false whenever the queue is not empty.
694         (WebCore::MediaSource::resume): Ditto.
695         * Modules/mediasource/MediaSource.h:
696         * Modules/mediasource/SourceBuffer.cpp:
697         (WebCore::SourceBuffer::suspend): Ditto.
698         (WebCore::SourceBuffer::resume): Ditto.
699         (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash.
700         * Modules/mediasource/SourceBuffer.h:
701         * Modules/mediasource/SourceBufferList.cpp:
702         (WebCore::SourceBufferList): Made this an active DOM object.
703         (WebCore::SourceBufferList::SourceBufferList):
704         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are
705         pending events to match other media code.
706         (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here.
707         (WebCore::SourceBufferList::resume): Ditto.
708         (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash.
709         (WebCore::SourceBufferList::activeDOMObjectName const): Added.
710         * Modules/mediasource/SourceBufferList.h:
711         (WebCore::SourceBufferList): Made this an active DOM object.
712         * Modules/mediasource/SourceBufferList.idl:
713         * dom/Document.h:
714         (WebCore::Document::hasBrowsingContext const): Added.
715         * dom/GenericEventQueue.cpp:
716         (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched
717         inside a stopped document, which is never correct and causes this crash down the line.
718         * html/HTMLMediaElement.cpp:
719         (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context;
720         e.g. when the media element is inside a template element.
721         (WebCore::HTMLMediaElement::pauseInternal): Ditto.
722         (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
723         * html/track/AudioTrackList.cpp:
724         (AudioTrackList::activeDOMObjectName const): Added.
725         * html/track/AudioTrackList.h:
726         * html/track/AudioTrackList.idl:
727         * html/track/TextTrackList.cpp::
728         (TextTrackList::activeDOMObjectName const): Added.
729         * html/track/TextTrackList.h:
730         * html/track/TextTrackList.idl:
731         * html/track/TrackListBase.cpp:
732         (WebCore::TrackListBase): Made this an active DOM object.
733         (WebCore::TrackListBase::TrackListBase): 
734         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events
735         to match other media code.
736         (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here.
737         (WebCore::TrackListBase::resume): Ditto.
738         (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash.
739         * html/track/TrackListBase.h:
740         * html/track/VideoTrackList.cpp:
741         (VideoTrackList::activeDOMObjectName const): Added.
742         * html/track/VideoTrackList.h:
743         * html/track/VideoTrackList.idl:
744
745 2018-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
746
747         [cairo] Doesn't paint box-shadow with zero blur-radius
748         https://bugs.webkit.org/show_bug.cgi?id=187244
749
750         Reviewed by Žan Doberšek.
751
752         Cairo::ShadowState::isRequired() returned false if blur-radius is
753         zero.
754
755         No new tests (Covered by existing tests).
756
757         * platform/graphics/cairo/CairoOperations.cpp:
758         (WebCore::Cairo::ShadowState::isRequired const): Do not check blur
759         is zero.
760
761 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
762
763         Add a release assert to diagnose infinite recursions in removeAllEventListeners()
764         https://bugs.webkit.org/show_bug.cgi?id=187287
765
766         Reviewed by Keith Miller.
767
768         Assert that we never re-enter removeAllEventListeners per thread.
769
770         * dom/EventTarget.cpp:
771         (WebCore::EventTarget::removeAllEventListeners):
772         * platform/ThreadGlobalData.h:
773         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
774         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
775
776 2018-07-03  Chris Dumez  <cdumez@apple.com>
777
778         performance-api/performance-observer-no-document-leak.html is flaky
779         https://bugs.webkit.org/show_bug.cgi?id=186938
780         <rdar://problem/41379336>
781
782         Reviewed by Simon Fraser.
783
784         Add internals API to get the identifier of a document and to ask if the document with
785         a given identifier is still alive. This is helpful to write tests for document leaking
786         fixes.
787
788         * testing/Internals.cpp:
789         (WebCore::Internals::documentIdentifier const):
790         (WebCore::Internals::isDocumentAlive const):
791         * testing/Internals.h:
792         * testing/Internals.idl:
793
794 2018-07-03  Chris Dumez  <cdumez@apple.com>
795
796         Improve window.event compliance: Should not be set when target is in shadow tree
797         https://bugs.webkit.org/show_bug.cgi?id=186266
798
799         Reviewed by Ryosuke Niwa.
800
801         Stop exposing window.event to Shadow DOM by not setting window.event if the event's target
802         is a Node inside a shadow tree. This is as per the latest DOM specification:
803         - https://github.com/whatwg/dom/pull/407
804
805         This aligns our behavior with Blink as well:
806         - https://bugs.chromium.org/p/chromium/issues/detail?id=779461
807
808         Tests: imported/w3c/web-platform-tests/dom/events/event-global.html
809                imported/w3c/web-platform-tests/dom/events/event-global.worker.html
810
811         * bindings/js/JSEventListener.cpp:
812         (WebCore::JSEventListener::handleEvent):
813
814 2018-07-03  Chris Dumez  <cdumez@apple.com>
815
816         [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
817         https://bugs.webkit.org/show_bug.cgi?id=187270
818         <rdar://problem/40674034>
819
820         Reviewed by Geoffrey Garen.
821
822         Disable vnode guard related simulated crashes for WebSQL by setting the expected
823         environment variable, if not already set by WKTR / DRT.
824
825         * Modules/webdatabase/DatabaseManager.cpp:
826         (WebCore::DatabaseManager::initialize):
827         (WebCore::DatabaseManager::platformInitialize):
828         * Modules/webdatabase/DatabaseManager.h:
829         * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
830         (WebCore::DatabaseManager::paltformInitialize):
831         * SourcesCocoa.txt:
832         * WebCore.xcodeproj/project.pbxproj:
833         * platform/FileSystem.h:
834         * platform/posix/FileSystemPOSIX.cpp:
835         (WebCore::FileSystem::realPath):
836         * platform/win/FileSystemWin.cpp:
837         (WebCore::FileSystem::realPath):
838
839 2018-07-03  Eric Carlson  <eric.carlson@apple.com>
840
841         Don't allow autoplay when the element is suspended
842         https://bugs.webkit.org/show_bug.cgi?id=187299
843         <rdar://problem/41044691>
844
845         Reviewed by Youenn Fablet.
846         
847         Block autoplay when a media element is suspended. Add more release logging to the methods
848         that handle autoplay attempts to help diagnose future media playback problems.
849
850         * html/HTMLMediaElement.cpp:
851         (WebCore::convertEnumerationToString): Convert PlaybackWithoutUserGesture to a string.
852         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): Add logging.
853         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): Ditto.
854         (WebCore::HTMLMediaElement::handleAutoplayEvent): Ditto.
855         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Ditto.
856         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Ditto.
857         * html/HTMLMediaElement.h:
858         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
859
860         * html/MediaElementSession.cpp:
861         (WebCore::MediaElementSession::playbackPermitted const): Playback is not permitted when the
862         element is suspended.
863         * html/MediaElementSession.h:
864
865 2018-07-03  Zalan Bujtas  <zalan@apple.com>
866
867         [LFC] Generate anonymous inline box for text content.
868         https://bugs.webkit.org/show_bug.cgi?id=187301
869
870         Reviewed by Antti Koivisto.
871
872         Always have a inline container for text content (and no dedicated text renderer).
873
874         * layout/layouttree/LayoutInlineBox.cpp:
875         (WebCore::Layout::InlineBox::InlineBox):
876         * layout/layouttree/LayoutInlineBox.h:
877         (WebCore::Layout::InlineBox::setContent):
878         * layout/layouttree/LayoutTreeBuilder.cpp:
879         (WebCore::Layout::TreeBuilder::createSubTree):
880
881 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
882
883         [Curl] Embed certificate information into ResourceResponse.
884         https://bugs.webkit.org/show_bug.cgi?id=187102
885
886         Reviewed by Youenn Fablet.
887
888         No new tests but tested internally.
889
890         Collect certificate information from the communication and put them into
891         ResourceResponse for the sake of advanced security checking and information
892         providing to the user.
893
894         * platform/Curl.cmake:
895         * platform/network/curl/CertificateInfo.cpp: Copied from Source/WebCore/platform/network/curl/CertificateInfo.h.
896         (WebCore::CertificateInfo::CertificateInfo):
897         (WebCore::CertificateInfo::isolatedCopy const):
898         (WebCore::CertificateInfo::makeCertificate):
899         * platform/network/curl/CertificateInfo.h:
900         (WebCore::CertificateInfo::verificationError const):
901         (WebCore::CertificateInfo::certificateChain const):
902         (WebCore::operator==):
903         (WebCore::CertificateInfo::CertificateInfo): Deleted.
904         * platform/network/curl/CurlRequest.cpp:
905         (WebCore::CurlRequest::didReceiveHeader):
906         (WebCore::CurlRequest::didCompleteTransfer):
907         * platform/network/curl/CurlRequest.h:
908         (WebCore::CurlRequest::getCertificateInfo const):
909         (WebCore::CurlRequest::getNetworkLoadMetrics const):
910         (WebCore::CurlRequest::getNetworkLoadMetrics): Deleted.
911         * platform/network/curl/CurlResourceHandleDelegate.cpp:
912         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
913         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
914         * platform/network/curl/CurlSSLHandle.cpp:
915         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
916         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
917         * platform/network/curl/CurlSSLHandle.h:
918         * platform/network/curl/CurlSSLVerifier.cpp:
919         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
920         (WebCore::CurlSSLVerifier::verifyCallback):
921         (WebCore::StackOfX509::StackOfX509): For RAII. Used in pemDataFromCtx().
922         (WebCore::StackOfX509::~StackOfX509): Ditto.
923         (WebCore::StackOfX509::count): Ditto.
924         (WebCore::StackOfX509::item): Ditto.
925         (WebCore::BIOHolder::BIOHolder): Ditto.
926         (WebCore::BIOHolder::~BIOHolder): Ditto.
927         (WebCore::BIOHolder::write): Ditto.
928         (WebCore::BIOHolder::asCertificate): Ditto.
929         (WebCore::pemDataFromCtx): Become simple static function.
930         (WebCore::convertToSSLCertificateFlags): Ditto.
931         (WebCore::CurlSSLVerifier::certVerifyCallback): Deleted.
932         (WebCore::CurlSSLVerifier::getPemDataFromCtx): Deleted.
933         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags): Deleted.
934         * platform/network/curl/CurlSSLVerifier.h:
935         (WebCore::CurlSSLVerifier::verificationError):
936         (WebCore::CurlSSLVerifier::certificateChain const):
937         * platform/network/curl/ResourceError.h:
938         * platform/network/curl/ResourceErrorCurl.cpp:
939         (WebCore::ResourceError::isSSLConnectError const):
940         (WebCore::ResourceError::isSSLCertVerificationError const):
941         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
942         * platform/network/curl/ResourceResponse.h:
943         * platform/network/curl/ResourceResponseCurl.cpp:
944         (WebCore::ResourceResponse::setCertificateInfo):
945         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
946
947 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
948
949         Clean up the layer volatility code and logging
950         https://bugs.webkit.org/show_bug.cgi?id=187286
951
952         Reviewed by Tim Horton.
953
954         Export a function.
955
956         * platform/graphics/cocoa/IOSurface.h:
957
958 2018-07-03  Commit Queue  <commit-queue@webkit.org>
959
960         Unreviewed, rolling out r233112.
961         https://bugs.webkit.org/show_bug.cgi?id=187300
962
963         this revision is causing crashes on iOS 11 simulator
964         (Requested by Truitt on #webkit).
965
966         Reverted changeset:
967
968         "[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit
969         fullscreen handler after r231924"
970         https://bugs.webkit.org/show_bug.cgi?id=186945
971         https://trac.webkit.org/changeset/233112
972
973 2018-07-03  Chris Dumez  <cdumez@apple.com>
974
975         Implement support for Element.toggleAttribute
976         https://bugs.webkit.org/show_bug.cgi?id=186883
977
978         Reviewed by Sam Weinig.
979
980         Implement support for Element.toggleAttribute as per:
981         - https://github.com/whatwg/dom/issues/461
982         - https://dom.spec.whatwg.org/#dom-element-toggleattribute
983
984         This was already implemented in Blink:
985         - https://bugs.chromium.org/p/chromium/issues/detail?id=854960
986
987         Edge expressed public support:
988         - https://github.com/whatwg/dom/issues/461#issuecomment-398206390
989
990         Gecko is working on it:
991         - https://bugzilla.mozilla.org/show_bug.cgi?id=1469592
992
993         * dom/Element.cpp:
994         (WebCore::Element::toggleAttribute):
995         * dom/Element.h:
996         * dom/Element.idl:
997
998 2018-07-03  Zalan Bujtas  <zalan@apple.com>
999
1000         [LFC] Implement minimum/maximum content width logic.
1001         https://bugs.webkit.org/show_bug.cgi?id=187241
1002
1003         Reviewed by Antti Koivisto.
1004
1005         Compute the minimum/maximum content width if needed and cache the values on the formatting state.
1006
1007         * layout/FormattingContext.cpp:
1008         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
1009         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1010         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1011         * layout/FormattingContext.h:
1012         * layout/FormattingContextGeometry.cpp:
1013         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1014         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1015         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1016         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1017         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1018         (WebCore::Layout::shrinkToFitWidth): Deleted.
1019         * layout/FormattingState.cpp:
1020         (WebCore::Layout::FormattingState::FormattingState):
1021         * layout/FormattingState.h:
1022         (WebCore::Layout::FormattingState::setMinimumMaximumContentWidth):
1023         (WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth):
1024         (WebCore::Layout::FormattingState::minimumMaximumContentWidth const):
1025         * layout/LayoutContext.cpp:
1026         (WebCore::Layout::LayoutContext::establishedFormattingState):
1027         * layout/LayoutContext.h:
1028         * layout/Verification.cpp:
1029         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
1030         * layout/blockformatting/BlockFormattingContext.cpp:
1031         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
1032         (WebCore::Layout::BlockFormattingContext::minimumMaximumContentWidth const):
1033         * layout/blockformatting/BlockFormattingContext.h:
1034         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1035         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidthNeedsChildrenWidth):
1036         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidth):
1037         * layout/blockformatting/BlockFormattingState.cpp:
1038         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
1039         * layout/blockformatting/BlockFormattingState.h:
1040         * layout/inlineformatting/InlineFormattingContext.cpp:
1041         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
1042         (WebCore::Layout::InlineFormattingContext::minimumMaximumContentWidth const):
1043         * layout/inlineformatting/InlineFormattingContext.h:
1044         * layout/inlineformatting/InlineFormattingState.cpp:
1045         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
1046         * layout/inlineformatting/InlineFormattingState.h:
1047         * page/FrameViewLayoutContext.cpp:
1048
1049 2018-07-03  Jonathan Bedard  <jbedard@apple.com>
1050
1051         Unreviewed, rolling out r233461.
1052
1053         Assertions triggered during iOS 11 debug layout and API tests
1054
1055         Reverted changeset:
1056
1057         "[iOS] Add assert to catch improper use of WebCore::Timer in
1058         UI Process"
1059         https://bugs.webkit.org/show_bug.cgi?id=185330
1060         https://trac.webkit.org/changeset/233461
1061
1062 2018-07-03  Jer Noble  <jer.noble@apple.com>
1063
1064         Update Fullscreen anti-phishing alert text
1065         https://bugs.webkit.org/show_bug.cgi?id=187199
1066         <rdar://problem/41162543>
1067
1068         Reviewed by Brent Fulgham.
1069
1070         * English.lproj/Localizable.strings:
1071
1072 2018-07-03  Frederic Wang  <fwang@igalia.com>
1073
1074         REGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing function no longer work
1075         https://bugs.webkit.org/show_bug.cgi?id=186129
1076
1077         Reviewed by Antoine Quint.
1078
1079         When the WebAnimationsCSSIntegration flag is enabled, animating the transform property with
1080         a steps() timing function no longer works. This is because the WebAnimation code wrongly
1081         assumes that the transform property can always be accelerated (for counterexamples, see
1082         GraphicsLayerCA::animationCanBeAccelerated). For consistency with AnimationBase, we make
1083         WebAnimation fallback to non-accelerated mode when RenderBoxModelObject::startAnimation
1084         fails. This addresses the regression previously mentioned.
1085
1086         Test: http/wpt/css/css-animations/start-animation-001.html
1087
1088         * animation/KeyframeEffectReadOnly.cpp:
1089         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Fallback to
1090         non-accelerated mode if startAnimation failed.
1091
1092 2018-07-03  David Kilzer  <ddkilzer@apple.com>
1093
1094         [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
1095         <https://webkit.org/b/185330>
1096         <rdar://problem/32816079>
1097
1098         Reviewed by Darin Adler.
1099
1100         * platform/RuntimeApplicationChecks.cpp:
1101         (WebCore::s_webKitProcessType): Add. Global to track process
1102         type.
1103         (WebCore::setWebKitProcessType): Implement new function that is
1104         called when initializing Web, Network, and Storage processes.
1105         (WebCore::isInNetworkProcess): Add.
1106         (WebCore::isInStorageProcess): Add.
1107         (WebCore::isInWebProcess): Add.
1108         - Check value in s_webKitProcessType to determine which process
1109           is currently running.
1110         * platform/RuntimeApplicationChecks.h:
1111         (WebCore::isInNetworkProcess): Add.
1112         (WebCore::isInStorageProcess): Add.
1113         (WebCore::isInWebProcess):
1114         - Make available for all platforms.
1115
1116         * platform/Timer.cpp:
1117         (WebCore::TimerBase::TimerBase): Add assert and os_log_fault.
1118         This catches the unwanted behavior on iOS using isAllowed().
1119         (WebCore::TimerBase::isAllowed): Add implementation.
1120         * platform/Timer.h:
1121         (WebCore::TimerBase::isAllowed): Add declaration.
1122
1123         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1124         (WebCore::isInWebProcess): Delete.  Replace with method in
1125         RuntimeApplicationChecks.cpp.
1126
1127 2018-07-02  Antti Koivisto  <antti@apple.com>
1128
1129         Tighter limit for canvas memory use on iOS
1130         https://bugs.webkit.org/show_bug.cgi?id=187279
1131         <rdar://problem/38420562>
1132
1133         Reviewed by Simon Fraser.
1134
1135         We allowed 448MB of canvas buffer memory. This is still too much in some cases. Painting a large
1136         canvas may also requires several other temporary canvas sized buffers getting us easily over
1137         the process size limit.
1138
1139         * html/HTMLCanvasElement.cpp:
1140         (WebCore::maxActivePixelMemory):
1141
1142         Drop to (ramSize() / 4) which computes to 224MB on 2GB devices.
1143
1144 2018-07-02  Myles C. Maxfield  <mmaxfield@apple.com>
1145
1146         [Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed
1147         https://bugs.webkit.org/show_bug.cgi?id=187228
1148         <rdar://problem/40967280>
1149
1150         Reviewed by Brent Fulgham.
1151
1152         This is due to the local() items in the src: descriptor in the @font-family blocks.
1153
1154         This is because of a behavior difference between CSSFontFaceSource::load() and CSSFontFaceSource::font().
1155         load() is supposed to set the status() to Success iff the font can be used, and then CSSFontFaceSource::font()
1156         is supposed to return the font itself to use. load() works by constructing a dummy FontDescription and
1157         performing a system lookup (to see if the local font really exists). However, this dummy FontDescription
1158         doesn't set the ShouldAllowUserInstalledFonts flag. Then, in CSSFontFaceSource::font(), a similar lookup is
1159         performed, except this one has the original FontDescription (with the correct value of the
1160         ShouldAllowUserInstalledFonts flag set. Therefore, the two functions disagree about the state of the flag.
1161
1162         When the CSSFontFaceSource's status gets set to Success, that means "this is the font face source that
1163         represents the @font-face block" but when CSSFontFaceSource::font() returns nullptr, that means "The font face
1164         source can't be used for some reason" so we then continue searching down the font-family list (and render the
1165         text in Helvetica or whatever comes next).
1166
1167         The solution is simple - just set the ShouldAllowUserInstalledFonts flag correctly in the dummy
1168         FontDescription.
1169
1170         Test: fast/text/user-installed-fonts/local.html
1171
1172         * css/CSSFontFace.cpp:
1173         (WebCore::CSSFontFace::allowUserInstalledFonts const):
1174         * css/CSSFontFace.h:
1175         * css/CSSFontFaceSet.cpp:
1176         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1177         * css/CSSFontFaceSource.cpp:
1178         (WebCore::CSSFontFaceSource::load):
1179
1180 2018-06-29  Ryosuke Niwa  <rniwa@webkit.org>
1181
1182         Generate event and event target interface types directly instead of via macros
1183         https://bugs.webkit.org/show_bug.cgi?id=187215
1184
1185         Reviewed by Chris Dumez.
1186
1187         Made make_event_factory.pl directly generate EventInterface enum values and toJSNewlyCreated for Event,
1188         and EventTargetInterface enum values and toJS for EventTarget. Removed the code to generate EventFactory::create
1189         since it was never even compiled or used anywhere.
1190
1191         This patch faithfully replicates what the macro used to generate but we should consider always generating either
1192         toJS or toJSNewlyCreated for both interfaces in the future.
1193
1194         No new tests since there should be no observable behavioral changes.
1195
1196         * DerivedSources.make: Generate EventTargetFactory.cpp, which is used to generate toJS function for EventTarget.
1197         * Sources.txt:
1198         * WebCore.xcodeproj/project.pbxproj:
1199         * bindings/js/JSEventCustom.cpp:
1200         (WebCore::toJSNewlyCreated): Deleted. Now generated directly in EventFactory.cpp.
1201         * bindings/js/JSEventTargetCustom.cpp:
1202         (WebCore::JSEventTarget::toWrapped): Removed the use of TRY_TO_UNWRAP_WITH_INTERFACE.
1203         (WebCore::toJS): Deleted. Now generated directly in EventFactory.cpp.
1204         * bindings/scripts/InFilesCompiler.pm:
1205         (generateInterfacesHeader): Use #pragma once. Generate enum values directly. Added the support for suffixing
1206         each type name with namespace for EventTarget.
1207         * dom/Event.h: Removed the declaration of EventInterface enum. It's now directly generated in EventInterfaces.h
1208         * dom/EventNames.in: Generate toJSNewlyCreated.
1209         * dom/EventTarget.h: Removed the declaration of EventTargetInterface as it's now done in EventTargetInterfaces.h.
1210         * dom/EventTargetFactory.in: Generate toJS.
1211         * dom/make_event_factory.pl:
1212         (defaultParameters): Added two new options. factoryFunction specifies whether toJS or toJSNewlyCreated is generated,
1213         and useNamespaceAsSuffix specifies whether each entry should be suffixed by the namespace (used by EventTarget).
1214         (generateCode): Added a missing semicolon.
1215         (generateImplementation): Removed the early exit for EventTarget since we now need to generate its toJS function.
1216         Replaced the code to generate EventFactory::create by the one to generate toJS / toJSNewlyCreated.
1217
1218 2018-07-02  Zalan Bujtas  <zalan@apple.com>
1219
1220         HTML widget displays blank when playing on page
1221         https://bugs.webkit.org/show_bug.cgi?id=187272
1222         <rdar://problem/39317899>
1223
1224         Reviewed by Simon Fraser.
1225
1226         When a composited layer gains content (in this particular case, going from NoContentsLayer to ContentsLayerForMedia),
1227         we need to size the associated graphics layer accordingly (NoContentsLayer means zero sized graphics layer).  
1228
1229         Not testable on iOS.
1230
1231         * rendering/RenderLayerBacking.cpp:
1232         (WebCore::RenderLayerBacking::updateConfiguration):
1233
1234 2018-07-02  David Kilzer  <ddkilzer@apple.com>
1235
1236         Refactor InlineTextBox::emphasisMarkExistsAndIsAbove()
1237         <https://webkit.org/b/187204>
1238
1239         Reviewed by Darin Adler.
1240
1241         No new tests since there is no change in behavior.
1242
1243         Refactor emphasisMarkExistsAndIsAbove() to return a
1244         std::optional<bool> instead of returning a bool and taking a
1245         std::optional<bool> argument.  The state returned is now:
1246         - std::nullopt => emphasis mark doesn't exist or is suppressed.
1247         - false => emphasis mark exists and is not suppressed, but is not above.
1248         - true => emphasis mark exists and is not suppressed, and is above.
1249
1250         * rendering/InlineFlowBox.cpp:
1251         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
1252         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
1253         (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
1254         (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
1255         - Update for refactored method.  Remove some redundant checks
1256           for TextEmphasisMark::None that already happen in
1257           emphasisMarkExistsAndIsAbove().
1258         * rendering/InlineTextBox.cpp:
1259         (WebCore::emphasisPositionHasNeitherLeftNorRight): Delete.
1260         - Replaced by an OptionSet<TextEmphasisPosition>.
1261         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
1262         - Refactor as described above.
1263         (WebCore::InlineTextBox::paintMarkedTextForeground):
1264         - Update for refactored method.
1265         * rendering/InlineTextBox.h:
1266         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
1267         - Update for new method signature.
1268
1269 2018-07-02  Megan Gardner  <megan_gardner@apple.com>
1270
1271         Enable copy paste on iOS apps for Mac
1272         https://bugs.webkit.org/show_bug.cgi?id=187194
1273         <rdar://problem/41451148>
1274
1275         Reviewed by Darin Adler.
1276
1277         Difficult to test this platform.
1278
1279         UIKit doesn't support itemProviders for iOS apps for Mac, so we need to revert to the
1280         older way of setting a dictionary of objects and keys for items. Not everything is
1281         availble in this form, and we haven't cleaned up our itemProvider code yet, so we 
1282         need to case some things out for now. Hopefully in the future, this will be implmented
1283         and can just work as expected, but for now, this is the best workaround.
1284
1285         * platform/ios/PlatformPasteboardIOS.mm:
1286         (WebCore::registerItemToPasteboard):
1287         (WebCore::PlatformPasteboard::write):
1288         (WebCore::PlatformPasteboard::readURL):
1289         * platform/ios/WebItemProviderPasteboard.h:
1290         * platform/ios/WebItemProviderPasteboard.mm:
1291         (-[WebItemProviderRegistrationInfoList itemProvider]):
1292
1293 2018-07-02  Eric Carlson  <eric.carlson@apple.com>
1294
1295         Video sometimes flickers when playing to AppleTV
1296         https://bugs.webkit.org/show_bug.cgi?id=187193
1297         <rdar://problem/40153865>
1298
1299         Reviewed by Jer Noble and Youenn Fablet.
1300         
1301         No new tests, existing test updated.
1302
1303         Delay 100ms before changing the iOS audio session category because it is an expensive and
1304         potentially disruptive operation, and changing an audio or video element configuration
1305         can result in several quick, ultimately unnecessary, category changes.
1306
1307         * platform/audio/PlatformMediaSession.cpp:
1308         (WebCore::PlatformMediaSession::clientWillBeginPlayback): Add logging.
1309
1310         * platform/audio/PlatformMediaSessionManager.cpp:
1311         (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): Initialize timer.
1312         (WebCore::PlatformMediaSessionManager::removeSession): Deactivate audio session when there
1313         are no sessions.
1314         (WebCore::PlatformMediaSessionManager::updateSessionStateTimerFired): New, update session now.
1315         (WebCore::PlatformMediaSessionManager::updateSessionState): Add parameter.
1316         * platform/audio/PlatformMediaSessionManager.h:
1317
1318         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1319         (PlatformMediaSessionManager::updateSessionState): Defer update if it isn't supposed to happen
1320         immediately.
1321
1322         * platform/audio/ios/AudioSessionIOS.mm:
1323         (WebCore::AudioSession::setCategory): Drive-by: setting the audio category to nil is a noop,
1324         so don't waste time doing it.
1325         (WebCore::AudioSession::tryToSetActive): Allow other apps to resume playback when we deactivate
1326         the audio session.
1327
1328         * platform/Timer.h:
1329         (WebCore::DeferrableOneShotTimer): Add WTF_MAKE_FAST_ALLOCATED so it can be used in a unique_ptr.
1330
1331 2018-07-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1332
1333         Clean up some spellchecking code
1334         https://bugs.webkit.org/show_bug.cgi?id=187238
1335
1336         Reviewed by Tim Horton.
1337
1338         A few minor tweaks to modernize some spellchecking code. No change in behavior.
1339
1340         * editing/AlternativeTextController.cpp:
1341         (WebCore::AlternativeTextController::timerFired):
1342         * editing/Editor.cpp:
1343         (WebCore::Editor::markMisspellingsAfterTypingToWord):
1344
1345         Use move semantics when passing Ranges to markAllMisspellingsAndBadGrammarInRanges.
1346
1347         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
1348
1349         Change this to take RefPtr<Range>&& instead of Range*.
1350
1351         (WebCore::Editor::markMisspellingsAndBadGrammar):
1352
1353         Remove an unnecessary call to `RefPtr::get()`.
1354
1355         * editing/Editor.h:
1356         * editing/TextCheckingHelper.cpp:
1357         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
1358         (WebCore::TextCheckingParagraph::checkingStart const):
1359         (WebCore::TextCheckingParagraph::checkingEnd const):
1360         (WebCore::TextCheckingParagraph::checkingLength const):
1361         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
1362         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
1363
1364         Currently, all of these cached range offsets are `int`s, and use a value of -1 to denote that their values are
1365         missing and must be recomputed. Instead, make these `std::optional`s and let `std::nullopt` represent the
1366         missing value.
1367
1368         * editing/TextCheckingHelper.h:
1369
1370 2018-07-02  Antoine Quint  <graouts@apple.com>
1371
1372         Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
1373         https://bugs.webkit.org/show_bug.cgi?id=187145
1374
1375         Reviewed by Dean Jackson.
1376
1377         Ensure we have a resolved time value before trying to use it.
1378
1379         * animation/WebAnimation.cpp:
1380         (WebCore::WebAnimation::timeToNextRequiredTick const):
1381
1382 2018-07-02  Antoine Quint  <graouts@apple.com>
1383
1384         [Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
1385         https://bugs.webkit.org/show_bug.cgi?id=187139
1386
1387         Reviewed by Dean Jackson.
1388
1389         Ensure we have a resolved time value before trying to use it.
1390
1391         * animation/KeyframeEffectReadOnly.cpp:
1392         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
1393
1394 2018-07-02  Youenn Fablet  <youenn@apple.com>
1395
1396         Reject getUserMedia promise if capture fails
1397         https://bugs.webkit.org/show_bug.cgi?id=187190
1398
1399         Reviewed by Eric Carlson.
1400
1401         In case PendingActivationMediaStream is notified of a change,
1402         Check whether any track failed to capture.
1403         If so, reject the promise.
1404         Add more release logging in error case.
1405
1406         Covered by manual testing.
1407
1408         * Modules/mediastream/UserMediaRequest.cpp:
1409         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
1410         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
1411         (WebCore::UserMediaRequest::mediaStreamIsReady):
1412         (WebCore::UserMediaRequest::mediaStreamDidFail):
1413         * Modules/mediastream/UserMediaRequest.h:
1414         * platform/mediastream/MediaStreamPrivate.h:
1415         * platform/mediastream/RealtimeMediaSource.cpp:
1416         (WebCore::RealtimeMediaSource::captureFailed):
1417         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1418         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1419
1420 2018-07-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1421
1422         [WK2] fast/parser/document-open-in-unload.html makes the following test crash
1423         https://bugs.webkit.org/show_bug.cgi?id=98345
1424         <rdar://problem/12474923>
1425
1426         Reviewed by Ryosuke Niwa.
1427
1428         m_documentLoader can become null in the middle of
1429         FrameLoader::commitProvisionalLoad by stopping the loading.
1430
1431         No new tests (Covered by existing tests).
1432
1433         * loader/FrameLoader.cpp:
1434         (WebCore::FrameLoader::commitProvisionalLoad): Do null check of m_documentLoader.
1435
1436 2018-07-01  Myles C. Maxfield  <mmaxfield@apple.com>
1437
1438         [Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters
1439         https://bugs.webkit.org/show_bug.cgi?id=187209
1440         <rdar://problem/40920785>
1441
1442         Reviewed by Darin Adler.
1443
1444         Inside our complex text codepath, we perform our own font fallback, which
1445         includes a function that asks "can this font support this grapheme cluster?"
1446         Because of the mechanics of how fonts work, the implementation of this
1447         function is "Does the font's cmap table support every character of the
1448         cluster?" We were using Font::glyphForCharacter() to determine this; however,
1449         this function maps certain control characters to the zero width space
1450         character (with the intention that these control characters shouldn't be
1451         visible in the fast text codepath). That replacement, however, was causing
1452         us to get false negatives, because Apple Color Emoji doesn't support zero
1453         width space. Therefore, Apple Color Emoji was looking like it didn't support
1454         emoji combining sequences.
1455
1456         The best solution to this would be to get Font::glyphForCharacter() to stop
1457         performing these replacements (see https://bugs.webkit.org/show_bug.cgi?id=187166).
1458         However, that is too risky of a change to be making right now. Instead,
1459         a more localized solution is to implement a version of "Does the font's cmap
1460         table support every character of the cluster" that doesn't perform the
1461         substitutions. This patch does exactly that, and uses a bit vector to cache
1462         the results. In order to not have a giant bit vector, we take the old code
1463         path if we know the substitutions won't affect us (and uses ASSERT()s to 
1464         validate this) so the bit vector only holds at maximum 3 words of storage.
1465
1466         Test: fast/text/emoji-with-joiner.html
1467
1468         * platform/graphics/Font.cpp:
1469         (WebCore::codePointSupportIndex):
1470         (WebCore::createAndFillGlyphPage):
1471         (WebCore::Font::platformSupportsCodePoint const):
1472         (WebCore::Font::supportsCodePoint const):
1473         (WebCore::Font::canRenderCombiningCharacterSequence const):
1474         * platform/graphics/Font.h:
1475         * platform/graphics/cocoa/FontCocoa.mm:
1476         (WebCore::Font::platformSupportsCodePoint const):
1477
1478 2018-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1479
1480         [macOS] Text replacements that end with symbols are expanded immediately
1481         https://bugs.webkit.org/show_bug.cgi?id=187225
1482         <rdar://problem/41112433>
1483
1484         Reviewed by Darin Adler.
1485
1486         In shipping Safari, enabling grammar correction causes text shortcuts that end with symbols or punctuation marks
1487         to immediately trigger when typing; normally, when grammar correction is off, this is only triggered after the
1488         user has additionally inserted a punctuation mark or whitespace character after the replaced text.
1489
1490         This bug happens because enabling grammar checking causes the spell checking range to expand to the range of the
1491         full sentence, so any text checking results that replace an existing range are triggered as long as they end
1492         anywhere in the sentence. In contrast, when grammar checking is disabled, the spell checking range is limited to
1493         the nearest adjacent word, which prevents text replacement from occurring elsewhere in the sentence.
1494
1495         However, after r232530, we now always expand the spell checking range to the extent of the sentence when a word
1496         is typed regardless of whether grammar checking is enabled, which means that the issue described above now
1497         happens everywhere. To fix this recent regression and the existing bug, we:
1498
1499         -   Augment our spellchecking codepaths to include a new automatic text replacement range, alongside
1500             spellchecking and paragraph ranges.
1501         -   Let this automatic text replacement range be the range of the adjacent word in the case where the user has
1502             finished typing a word.
1503         -   When marking and replacing text checking results, consult this new automatic text replacement instead of the
1504             spellchecking range.
1505
1506         This keeps the behavior grammar and sentence retro correction results intact, while limiting the scope in which
1507         text replacement results are applied.
1508
1509         Test: editing/spelling/text-replacement-after-typing-to-word.html
1510
1511         * editing/AlternativeTextController.cpp:
1512         (WebCore::AlternativeTextController::timerFired):
1513         * editing/Editor.cpp:
1514         (WebCore::Editor::replaceSelectionWithFragment):
1515         (WebCore::Editor::markMisspellingsAfterTypingToWord):
1516
1517         Pass in the adjacent word range for the `automaticReplacementRange`, instead of the spell checking range (which
1518         may be extended to the full range of the sentence).
1519
1520         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
1521
1522         Add an `automaticReplacementRange` argument to markAllMisspellingsAndBadGrammarInRanges, and adjust call sites
1523         to pass in a range (generally the same as the spell checking range, but in the case where a word has been typed,
1524         this is a narrower range).
1525
1526         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
1527         (WebCore::Editor::markAndReplaceFor):
1528
1529         When replacing text, only allow text replacement in the automatic replacement range rather than the spell
1530         checking range.
1531
1532         (WebCore::Editor::markMisspellingsAndBadGrammar):
1533         * editing/Editor.h:
1534         * editing/SpellChecker.cpp:
1535         (WebCore::SpellCheckRequest::SpellCheckRequest):
1536
1537         Add a new version of this constructor that takes a single Range representing both the spellchecking range and
1538         the automatic text replacement range, for convenience.
1539
1540         (WebCore::SpellCheckRequest::create):
1541         * editing/SpellChecker.h:
1542
1543         Add plumbing for the automatic replacement range.
1544
1545         (WebCore::SpellCheckRequest::automaticReplacementRange const):
1546         * editing/TextCheckingHelper.cpp:
1547
1548         Add plumbing for the automatic replacement range, and new helpers to locate the range as offsets within the
1549         text checking paragraph range.
1550
1551         (WebCore::TextCheckingParagraph::TextCheckingParagraph):
1552         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
1553         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
1554         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
1555         * editing/TextCheckingHelper.h:
1556
1557 2018-06-30  David Kilzer  <ddkilzer@apple.com>
1558
1559         Follow-up: Fix clang static analyzer warnings: Garbage return value
1560         <https://webkit.org/b/187224>
1561
1562         Address review feedback from Eric Carlson.
1563
1564         * platform/mediastream/MediaConstraints.h:
1565         (WebCore::NumericConstraint::valueForCapabilityRange const):
1566         - Use brace initialization for more local variables.
1567
1568 2018-06-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1569
1570         Asan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageModifier in WebCore::Length::Length(WebCore::Length&&)
1571         https://bugs.webkit.org/show_bug.cgi?id=186980
1572         <rdar://problem/41409838>
1573
1574         Reviewed by Oliver Hunt.
1575
1576         We believe that we have found a bug in GCC's address sanitizer. It is blocking work on other
1577         issues, so work around it by changing a temporary into a local variable.
1578
1579         * css/StyleBuilderCustom.h:
1580         (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue):
1581
1582 2018-06-30  David Kilzer  <ddkilzer@apple.com>
1583
1584         Fix clang static analyzer warnings: Garbage return value
1585         <https://webkit.org/b/187224>
1586
1587         Reviewed by Eric Carlson.
1588
1589         * platform/mediastream/MediaConstraints.h:
1590         (WebCore::NumericConstraint::valueForCapabilityRange const):
1591         - Use brace initialization for local variables.
1592
1593 2018-06-30  Zalan Bujtas  <zalan@apple.com>
1594
1595         [LFC] Do not add the containing block's offset while computing the out-of-flow static position.
1596         https://bugs.webkit.org/show_bug.cgi?id=187202
1597
1598         Reviewed by Antti Koivisto.
1599
1600         The static position for an out-of-flow elements is
1601         1. the distance from the parent's border box.
1602         2. climbing up on the containing block chain and offset the containers until we reach the out-of-flow element's containing block.
1603
1604         * layout/FormattingContextGeometry.cpp:
1605         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
1606         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
1607
1608 2018-06-30  Zalan Bujtas  <zalan@apple.com>
1609
1610         [LFC] If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
1611         https://bugs.webkit.org/show_bug.cgi?id=187220
1612
1613         Reviewed by Antti Koivisto.
1614
1615         * layout/blockformatting/BlockMarginCollapse.cpp:
1616         (WebCore::Layout::isMarginBottomCollapsedThrough):
1617         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
1618         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
1619         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
1620         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
1621         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
1622
1623 2018-06-30  Zalan Bujtas  <zalan@apple.com>
1624
1625         [LFC] Adjust final out-of-flow position with the computed margin value.
1626         https://bugs.webkit.org/show_bug.cgi?id=187219
1627
1628         Reviewed by Antti Koivisto.
1629
1630         * layout/FormattingContext.cpp:
1631         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1632         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1633
1634 2018-06-29  Antoine Quint  <graouts@apple.com>
1635
1636         [Web Animations] Make WPT test at timing-model/timelines/document-timelines.html pass reliably
1637         https://bugs.webkit.org/show_bug.cgi?id=186507
1638         <rdar://problem/41000257>
1639
1640         Reviewed by Dean Jackson.
1641
1642         The Web Animations spec, along with the HTML5 event loop spec, specify some assumptions on the time reported by
1643         document.timeline.currentTime:
1644
1645         - it should only increase once per frame
1646         - it should have the same value as the timestamp passed to requestAnimationFrame() callbacks
1647
1648         The WPT test at web-platform-tests/web-animations/timing-model/timelines/document-timelines.html relies on these
1649         assumptions to be true so that we check that the start time of a new animation is not the same as the timeline time
1650         when it was created, since it will be in the "play-pending" state for a frame.
1651
1652         In order to support this, we add two new methods on DocumentAnimationScheduler. First, when a scheduled display update
1653         fires, we record the timestamp and expose it via lastTimestamp() such that DocumentTimeline and ScriptedAnimationController
1654         can use the same value when updating animations. Then, to know whether code is run as a result of a display update, we
1655         expose isFiring().
1656
1657         Now, within DocumentTimeline::currentTime(), we can cache the current time this way:
1658
1659         - if we're in the middle of a display update, use the value returned by lastTimestamp().
1660         - otherwise, compute what would have been the ideal number of frames (at 60fps or less if throttled) and add those to
1661         the lastTimestamp() value.
1662
1663         Then, we remove this cached current time when both currently-running JavaScript has completed and all animation update
1664         code has completed by waiting on the invalidation task to run.
1665
1666         * animation/DocumentAnimationScheduler.cpp:
1667         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
1668         * animation/DocumentAnimationScheduler.h:
1669         (WebCore::DocumentAnimationScheduler::lastTimestamp):
1670         (WebCore::DocumentAnimationScheduler::isFiring const):
1671         * animation/DocumentTimeline.cpp:
1672         (WebCore::DocumentTimeline::currentTime):
1673         (WebCore::DocumentTimeline::performInvalidationTask):
1674         (WebCore::DocumentTimeline::maybeClearCachedCurrentTime):
1675         * animation/DocumentTimeline.h:
1676         * dom/ScriptedAnimationController.cpp:
1677         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
1678         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
1679
1680 2018-06-29  Nan Wang  <n_wang@apple.com>
1681
1682         Crash under WebCore::AXObjectCache::handleMenuItemSelected
1683         https://bugs.webkit.org/show_bug.cgi?id=186918
1684         <rdar://problem/41365984>
1685
1686         Reviewed by Chris Fleizach.
1687
1688         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
1689         But we did not remove the corresponding entry from the m_deferredFocusedNodeChange list. It would
1690         then lead to a crash if we try to access the deleted node from m_deferredFocusedNodeChange.
1691         Fixed it by removing the entry if the newly focused node is being destroyed.
1692
1693         Test: accessibility/accessibility-crash-focused-element-change.html
1694
1695         * accessibility/AXObjectCache.cpp:
1696         (WebCore::AXObjectCache::remove):
1697
1698 2018-06-29  Antti Koivisto  <antti@apple.com>
1699
1700         REGRESSION (r232806): Facebook login fields have blue fill background instead of white
1701         https://bugs.webkit.org/show_bug.cgi?id=187207
1702         <rdar://problem/41606349>
1703
1704         Reviewed by Tim Horton.
1705
1706         This happens because a 'prefers-dark-interface' media query on UA sheet always evaluates to true in dark mode.
1707
1708         Tests: fast/forms/input-background-ua-media-query.html
1709
1710         * css/MediaQueryEvaluator.cpp:
1711         (WebCore::prefersDarkInterfaceEvaluate):
1712
1713         Make prefers-dark-interface media query match only when using system appearance.
1714
1715 2018-06-29  Daniel Bates  <dabates@apple.com>
1716
1717         REGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account
1718         https://bugs.webkit.org/show_bug.cgi?id=187197
1719         <rdar://problem/40420821>
1720
1721         Reviewed by Brent Fulgham.
1722
1723         Fixes an issue where a Same-Site cookies are not sent with any child window load if the
1724         load is cross-origin with respect to the window's opener. One example where this issue
1725         manifest itself was in the GitHub sign in flow on forums.swift.org.
1726
1727         Currently we always consider the origin of the window's opener (if we have one) when
1728         determining whether a frame load request is same-origin and hence should send Same-Site
1729         cookies when performing the request. So, when page A.com opens a child window to B.com and
1730         then a person clicks a hyperlink or submits a form to B.com/b2 then we do not send Same-
1731         Site cookies with the request to B.com/b2 (because its origin, B.com, is cross-origin
1732         with its opener, A.com). But we should send Same-Site cookies with the request to B.com/b2
1733         because it is same-origin with the page that initiated the request, B.com. Instead of
1734         always considering the origin the window's opener for every frame load we should only
1735         consider it for the first non-empty document load.
1736
1737         Tests: http/tests/cookies/same-site/fetch-in-about-blank-popup.html
1738                http/tests/cookies/same-site/post-from-cross-site-popup.html
1739
1740         * loader/FrameLoader.cpp:
1741         (WebCore::FrameLoader::addExtraFieldsToRequest):
1742
1743 2018-06-29  Nan Wang  <n_wang@apple.com>
1744
1745         AX: [iOS] VoiceOver scroll position is jumpy in frames
1746         https://bugs.webkit.org/show_bug.cgi?id=186956
1747
1748         Reviewed by Simon Fraser.
1749
1750         iOS is using delegate scrolling and we should not take into account
1751         the scroll offset when converting rects.
1752
1753         Also fixed a issue where we want to scroll the element into view even
1754         if it's partially visible.
1755
1756         Test: fast/scrolling/ios/iframe-scroll-into-view.html
1757
1758         * accessibility/AccessibilityObject.cpp:
1759         (WebCore::AccessibilityObject::scrollToMakeVisible const):
1760         * platform/ScrollView.cpp:
1761         (WebCore::ScrollView::contentsToContainingViewContents const):
1762
1763 2018-06-29  Chris Dumez  <cdumez@apple.com>
1764
1765         WebKitLegacy: Can trigger recursive loads triggering debug assertions
1766         https://bugs.webkit.org/show_bug.cgi?id=187121
1767         <rdar://problem/41259430>
1768
1769         Reviewed by Brent Fulgham.
1770
1771         In order to support asynchronous policy delegates, r229722 added a call to
1772         FrameLoader::clearProvisionalLoadForPolicyCheck() when starting a navigation
1773         policy decision in PolicyChecker::checkNavigationPolicy(). This calls
1774         stopLoading() on the current provisional loader if there is one, and potentially
1775         calls the didFailProvisionalLoadWithError cleint delegate. This delegate call
1776         is synchronous on WebKit1, so the client may start a new load from this delegate
1777         and re-enter Webcore. This happens in practive with Quickens 2017 / 2018 on Mac.
1778
1779         Before r229722, this was not an issue because pending loads were canceled after
1780         the (asynchronous) navigation policy decision, via FrameLoader::stopAllLoaders().
1781         FrameLoader::stopAllLoaders() sets a m_inStopAllLoaders flag and we return early
1782         in FrameLoader::loadRequest() when this flag is set to prevent recursive loads.
1783
1784         To maintain shipping behavior as much as possible, this patch introduces a similar
1785         inClearProvisionalLoadForPolicyCheck which gets set during
1786         FrameLoader::clearProvisionalLoadForPolicyCheck() and we prevent new loads while
1787         this flag is set.
1788
1789         I have verified that Quickens 2017 / 2018 works again after this change and I added
1790         API test coverage for this behavior.
1791
1792         * loader/FrameLoader.cpp:
1793         (WebCore::FrameLoader::loadURL):
1794         (WebCore::FrameLoader::load):
1795         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
1796         * loader/FrameLoader.h:
1797
1798 2018-06-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
1799
1800         Infinite loop if a <use> element references its ancestor and the DOMNodeInserted event handler of one its ancestor's descents updates the document style
1801         https://bugs.webkit.org/show_bug.cgi?id=186925
1802
1803         Reviewed by Antti Koivisto.
1804
1805         This patches fixes two issues:
1806         -- SVGTRefTargetEventListener should not assume it has to be attached to
1807         target when its handleEvent() is called.
1808         Because SVGTRefTargetEventListener::handleEvent() references the target
1809         element, we just return if the listener is detached.
1810
1811         -- The <use> element should not clone its shadow tree if it references one
1812         of its ancestors. The DOMNodeInserted of any node in the target element
1813         tree may issue a document command. This document command will cause the 
1814         shadow tree to be re-cloned so this will cause infinite loop to happen.
1815
1816         Test: svg/dom/svg-use-infinite-loop-cloning.html
1817
1818         * svg/SVGTRefElement.cpp:
1819         (WebCore::SVGTRefTargetEventListener::handleEvent):
1820         * svg/SVGUseElement.cpp:
1821         (WebCore::SVGUseElement::updateShadowTree):
1822
1823 2018-06-29  Manuel Rego Casasnovas  <rego@igalia.com>
1824
1825         [WPE] Three CSS Grid Layout tests crash due to valueless std::optional access
1826         https://bugs.webkit.org/show_bug.cgi?id=186752
1827
1828         Reviewed by Frédéric Wang.
1829
1830         This is a simple fix for the crash we're getting on WPE
1831         in IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep().
1832
1833         Covered by existent tests, just remove them from TestExpectations file.
1834
1835         * rendering/GridTrackSizingAlgorithm.cpp:
1836         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
1837         Check if minSize is null before trying to access it's value.
1838
1839 2018-06-29  David Fenton  <david_fenton@apple.com>
1840
1841         Unreviewed, rolling out r233349.
1842
1843         caused 42 crashes on iOS GuardMalloc and iOS ASan tests
1844
1845         Reverted changeset:
1846
1847         "[Web Animations] Using a Web Animation leaks the Document"
1848         https://bugs.webkit.org/show_bug.cgi?id=187088
1849         https://trac.webkit.org/changeset/233349
1850
1851 2018-06-29  Jer Noble  <jer.noble@apple.com>
1852
1853         Returning PiP'd video to fullscreen while playing leaves video muted.
1854         https://bugs.webkit.org/show_bug.cgi?id=187181
1855         <rdar://problem/41408335>
1856
1857         Reviewed by Eric Carlson.
1858
1859         Test: media/picture-in-picture-interruption.html
1860
1861         Don't reset the media session's state at the end of an interruption if it wasn't changed an the beginning of one.
1862
1863         * platform/audio/PlatformMediaSession.cpp:
1864         (WebCore::PlatformMediaSession::endInterruption):
1865         * testing/Internals.cpp:
1866         (WebCore::Internals::mediaSessionState):
1867         * testing/Internals.h:
1868         * testing/Internals.idl:
1869
1870 2018-06-29  Zalan Bujtas  <zalan@apple.com>
1871
1872         [LFC] When the formatting root is also a containing block for out-of-flow elements.
1873         https://bugs.webkit.org/show_bug.cgi?id=187179
1874
1875         Reviewed by Antti Koivisto.
1876
1877         Out-of-flow descendants' layout requires their containing block height to be computed. This patch takes care of the case
1878         when the containing block is also a formatting context root (e.g. relative positioned with overflow other than visible).
1879
1880         * layout/Verification.cpp:
1881         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
1882         * layout/blockformatting/BlockFormattingContext.cpp:
1883         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1884
1885 2018-06-29  Zalan Bujtas  <zalan@apple.com>
1886
1887         [LFC] Do not skip the next inflow sibling after finishing a formatting context root layout.
1888         https://bugs.webkit.org/show_bug.cgi?id=187178
1889
1890         Reviewed by Antti Koivisto.
1891
1892         Since the block formatting layout is based on pre-order traversal, after finishing a formatting
1893         context layout (which takes care of its entire subtre), we need to visit the next (in-flow)sibling. 
1894
1895         * layout/blockformatting/BlockFormattingContext.cpp:
1896         (WebCore::Layout::BlockFormattingContext::layout const):
1897
1898 2018-06-29  Zalan Bujtas  <zalan@apple.com>
1899
1900         [LFC] The static position for an out-of-flow box should include the previous sibling's collapsed margin
1901         https://bugs.webkit.org/show_bug.cgi?id=187169
1902
1903         Reviewed by Antti Koivisto.
1904
1905         When computing the static position of an absolutely positioned box, we need to look at the previous sibling's bottom margin.
1906         If the previous sibling happens to collapse its bottom margin with the parent's bottom margin, we still need to account for it
1907         and compute the static vertical position as if the bottom margin was not collapsed.
1908
1909         * layout/FormattingContext.cpp:
1910         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
1911         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1912         * layout/FormattingContextGeometry.cpp:
1913         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
1914         * layout/LayoutContext.cpp:
1915         (WebCore::Layout::LayoutContext::initializeRoot):
1916         * layout/Verification.cpp:
1917         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
1918         * layout/blockformatting/BlockFormattingContext.cpp:
1919         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
1920         * layout/displaytree/DisplayBox.cpp:
1921         (WebCore::Display::Box::nonCollapsedMarginBox const):
1922         * layout/displaytree/DisplayBox.h:
1923         (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin):
1924         (WebCore::Display::Box::setVerticalMargin):
1925         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
1926         (WebCore::Display::Box::nonCollapsedMarginTop const):
1927         (WebCore::Display::Box::nonCollapsedMarginBottom const):
1928
1929 2018-06-27  Antoine Quint  <graouts@apple.com>
1930
1931         [Web Animations] Using a Web Animation leaks the Document
1932         https://bugs.webkit.org/show_bug.cgi?id=187088
1933         <rdar://problem/41392046>
1934
1935         Reviewed by Dean Jackson.
1936
1937         Test: webanimations/leak-document-with-web-animation.html
1938
1939         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
1940         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
1941         the animation from its timeline.
1942
1943         * animation/AnimationTimeline.cpp:
1944         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
1945         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
1946         removeAnimation() on the disassociated timeline.
1947         * animation/DeclarativeAnimation.cpp:
1948         (WebCore::DeclarativeAnimation::remove):
1949         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
1950         * animation/DeclarativeAnimation.h:
1951         * animation/DocumentTimeline.cpp:
1952         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
1953         * animation/WebAnimation.cpp:
1954         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
1955         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
1956         that we can call this code without any JS-facing implications.
1957         (WebCore::WebAnimation::setTimelineInternal):
1958         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
1959         * animation/WebAnimation.h:
1960
1961 2018-06-28  Zalan Bujtas  <zalan@apple.com>
1962
1963         [LFC] Out-of-flow positioned height does not necessarily equal to "bottom - top".
1964         https://bugs.webkit.org/show_bug.cgi?id=187168
1965
1966         Reviewed by Antti Koivisto.
1967
1968         According to the spec "For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint:
1969         'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block"
1970         With a non-auto "height" value, the bottom - top does not necessarily compute to the height of the element.
1971
1972         * layout/FormattingContext.cpp:
1973         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1974
1975 2018-06-28  Olivia Barnett  <obarnett@apple.com>
1976
1977         Find in page for typographic quotes does not find low (German) quotes
1978         https://bugs.webkit.org/show_bug.cgi?id=187164
1979         <rdar://problem/29612785>
1980
1981         Reviewed by Tim Horton.
1982
1983         Added additional quote test to LayoutTests/fast/text/find-quotes.html.
1984
1985         Added functionality to replace German quotes when matching.
1986
1987         * editing/TextIterator.cpp:
1988         (WebCore::foldQuoteMark):
1989         (WebCore::foldQuoteMarks):
1990
1991 2018-06-28  Antti Koivisto  <antti@apple.com>
1992
1993         REGRESSION (233281): fast/dom/location-new-window-no-crash.html and some other tests are timing out
1994         https://bugs.webkit.org/show_bug.cgi?id=187156
1995
1996         Reviewed by Zalan Bujtas.
1997
1998         We need still need to re-enable memory cache client calls even when not doing other post-resolution callbacks.
1999
2000         * style/StyleTreeResolver.cpp:
2001         (WebCore::Style::memoryCacheClientCallsResumeQueue):
2002
2003         Add a separate queue for this.
2004
2005         (WebCore::Style::suspendMemoryCacheClientCalls):
2006         (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler):
2007
2008 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2009
2010         [iOS] DataTransfer.getData always returns the empty string when dropping text
2011         https://bugs.webkit.org/show_bug.cgi?id=187130
2012         <rdar://problem/41014117>
2013
2014         Reviewed by Ryosuke Niwa.
2015
2016         Currently, DataTransfer.getData() always returns the empty string on drop. This is because all data on drop is
2017         backed by local files in the temporary directory, so the number of files is never 0; this, combined with the
2018         fact that WebKit will suppress access to the DataTransfer object if there is one or more file in the pasteboard,
2019         means that getData() never works for drag and drop on iOS at the moment. To fix this, we need to know whether a
2020         dropped item provider is a file.
2021
2022         Ideally, we'd have a flag to tell us whether or not an NSItemProvider being dropped is a file, or instead just
2023         inline data - in fact, this flag already exists in the form of UIPreferredPresentationStyle. Unfortunately, not
2024         all apps that vend draggable files specify this, so we can't simply ask the item provider whether it's intended
2025         to be a file. As a workaround, we can use several heuristics to determine the "file content state" of the drag
2026         pasteboard on iOS (see below for more details).
2027
2028         This patch adds some plumbing through the client layers to grab a list of item information describing each
2029         dropped item provider on iOS. Using this information, we tweak the logic in Pasteboard::fileContentState to make
2030         an educated guess at whether or not the pasteboard really contains files; if we determine that the pasteboard
2031         probably contains no files, we'll allow DataTransfer.getData() to retrieve information from the pasteboard.
2032         Otherwise, if the pasteboard may contain files, we'll fall back to our current behavior of including the "Files"
2033         type in DataTransfer.types and allowing the page to grab file data using DataTransfer.files or
2034         DataTransfer.items.
2035
2036         Tests:  DataInteractionTests.DataTransferGetDataReadPlainAndRichText
2037                 DataInteractionTests.DataTransferSuppressGetDataDueToPresenceOfTextFile
2038
2039         * dom/DataTransfer.cpp:
2040         (WebCore::DataTransfer::filesFromPasteboardAndItemList const):
2041
2042         Check Pasteboard::fileContentState() to ensure that we don't expose files when DataTransfer.types does not
2043         contain the "Files" type, and vice versa, and DataTranser.files is also empty in this case.
2044
2045         * dom/DataTransferItemList.cpp:
2046         * platform/PasteboardItemInfo.h:
2047
2048         Add a couple of additional members to PasteboardItemInfo: suggestedFileName and hasDeclaredNonTextType, a flag
2049         that indicates whether or not the pasteboard item has a type representation that is a declared type, but is not
2050         a text type (i.e. does not conform to "public.text", "public.url", or rich text format with attachment types).
2051
2052         (WebCore::PasteboardItemInfo::encode const):
2053         (WebCore::PasteboardItemInfo::decode):
2054         * platform/PasteboardStrategy.h:
2055         * platform/PlatformPasteboard.h:
2056         * platform/cocoa/PasteboardCocoa.mm:
2057         (WebCore::Pasteboard::fileContentState):
2058
2059         Instead of always considering a dropped item provider on iOS to represent a file, only do so if at least one of
2060         the following conditions are met:
2061         - The drop session contains multiple item providers (flocking text selections is a very rare use case).
2062         - The item provider was explicitly marked as an attachment.
2063         - The item provider has a suggested file name.
2064         - The item provider has any other content that is not text.
2065
2066         In the case where none of the above conditions are met, the item provider (if it ends up being a file) is
2067         essentially indistinguishable from inline data. An example of this is dropping a plain text file that is
2068         unnamed, with no presentation style, and alongside no other items nor other known type representations. These
2069         are cases in which whether the item is treated as a file or as inline data is (hopefully) irrelevant.
2070
2071         * platform/ios/PlatformPasteboardIOS.mm:
2072         (WebCore::PlatformPasteboard::allPasteboardItemInfo):
2073         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2074
2075 2018-06-28  Timothy Hatcher  <timothy@apple.com>
2076
2077         Don't force black text when TextIndicator draws backgrounds or all content.
2078         https://bugs.webkit.org/show_bug.cgi?id=187161
2079         rdar://problem/40434644
2080
2081         Reviewed by Tim Horton.
2082
2083         * page/TextIndicator.cpp:
2084         (WebCore::snapshotOptionsForTextIndicatorOptions):
2085         Only set SnapshotOptionsForceBlackText when TextIndicatorOptionRespectTextColor and
2086         TextIndicatorOptionPaintBackgrounds are not set.
2087
2088 2018-06-28  Timothy Hatcher  <timothy@apple.com>
2089
2090         Find on page selection color isn't adapted for dark mode.
2091         https://bugs.webkit.org/show_bug.cgi?id=187072
2092
2093         Unreviewed, revert part of r233280.
2094
2095         * rendering/RenderThemeMac.mm:
2096         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Use pure yellow again.
2097
2098 2018-06-28  Antoine Quint  <graouts@apple.com>
2099
2100         [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
2101         https://bugs.webkit.org/show_bug.cgi?id=183834
2102         <rdar://problem/40997932>
2103
2104         Reviewed by Dean Jackson.
2105
2106         We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
2107         to a different time than the timeline time at the time the animation was asked to play(). This ensure the
2108         timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
2109         callback.
2110
2111         When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
2112         so that we wait until we change the pending state to work out which events to enqueue.
2113
2114         * animation/DeclarativeAnimation.cpp:
2115         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
2116         * animation/DocumentTimeline.cpp:
2117         (WebCore::DocumentTimeline::updateAnimations):
2118         * animation/WebAnimation.cpp:
2119         (WebCore::WebAnimation::updatePendingTasks):
2120         (WebCore::WebAnimation::timeToNextRequiredTick const):
2121         (WebCore::WebAnimation::runPendingTasks):
2122         * animation/WebAnimation.h:
2123
2124 2018-06-28  Ryosuke Niwa  <rniwa@webkit.org>
2125
2126         Release assert in ScriptController::canExecuteScripts via WebCore::SVGUseElement::insertedIntoAncestor
2127         https://bugs.webkit.org/show_bug.cgi?id=187137
2128         <rdar://problem/41081885>
2129
2130         Reviewed by Zalan Bujtas.
2131
2132         The bug was caused by SVGUseElement::notifyFinished firing a DOM event via SVGUseElement::updateExternalDocument
2133         inside SVGUseElement::insertedIntoAncestor. Ideally, we make every call to notifyFinished asynchronous
2134         but simply delay the call to updateExternalDocument() until didFinishInsertingNode() for now.
2135
2136         No new tests since the failure is caught with the newly added assertion in notifyFinished by existing SVG tests
2137         such as svg/batik/filters/filterRegions.svg and svg/batik/text/smallFonts.svg. Unfortunately, I could not
2138         construct a test case which hits this release assertion since the real crash happens when the cached resource
2139         had an error but in the all cases I could find, the resource response with an error results in a reload or
2140         an asynchronous failure callback.
2141
2142         * loader/cache/CachedResource.cpp:
2143         (WebCore::CachedResource::didAddClient): Added a FIXME.
2144         * svg/SVGUseElement.cpp:
2145         (WebCore::SVGUseElement::insertedIntoAncestor): Delay the call to updateExternalDocument.
2146         (WebCore::SVGUseElement::didFinishInsertingNode): Invoke updateExternalDocument.
2147         (WebCore::SVGUseElement::notifyFinished): Added an assertion.
2148         * svg/SVGUseElement.h:
2149
2150 2018-06-28  Chris Dumez  <cdumez@apple.com>
2151
2152         Unreviewed, rolling out r233309.
2153
2154         Invalidates previous database model without versioning
2155
2156         Reverted changeset:
2157
2158         "Fix encoding / decoding issues in ResourceLoadStatistics"
2159         https://bugs.webkit.org/show_bug.cgi?id=186890
2160         https://trac.webkit.org/changeset/233309
2161
2162 2018-06-28  Timothy Hatcher  <timothy@apple.com>
2163
2164         Focus ring color does not honor dark mode or system accent color.
2165         https://bugs.webkit.org/show_bug.cgi?id=187144
2166         rdar://problem/41105081
2167
2168         Reviewed by Tim Horton.
2169
2170         Pass the focus ring color through to the GraphicsContext methods that draw it.
2171
2172         * platform/graphics/GraphicsContext.h:
2173         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2174         (WebCore::drawFocusRingAtTime):
2175         (WebCore::drawFocusRing):
2176         (WebCore::drawFocusRingToContext):
2177         (WebCore::drawFocusRingToContextAtTime):
2178         (WebCore::GraphicsContext::drawFocusRing):
2179         (WebCore::GraphicsContext::focusRingColor): Deleted.
2180         * platform/mac/ThemeMac.mm:
2181         (WebCore::drawCellFocusRingWithFrameAtTime):
2182         * rendering/RenderElement.cpp:
2183         (WebCore::RenderElement::paintFocusRing):
2184         * rendering/RenderImage.cpp:
2185         (WebCore::RenderImage::paintAreaElementFocusRing):
2186
2187 2018-06-28  Aditya Keerthi  <akeerthi@apple.com>
2188
2189         REGRESSION (r232040): Cursor jumping in Safari text fields
2190         https://bugs.webkit.org/show_bug.cgi?id=187142
2191         <rdar://problem/41397577>
2192
2193         Reviewed by Tim Horton.
2194
2195         r232040 enabled click events to fire on nodes that are already being edited in
2196         iOS. This resulted FrameSelection::setSelection being called twice. One call
2197         originated from the UIWKTextInteractionAssistant, which snaps the caret to word
2198         boundaries. The other call originates from handleMousePressEvent in EventHandler,
2199         and uses character boundaries. Consequently, we see the caret jumping around.
2200
2201         To fix this issue, an early return was added in the handleMousePressEvent
2202         codepath, which prevents FrameSelection::setSelection from being called when
2203         clicking on a node that is already being edited. This ensures that the
2204         UIWKTextInteractionAssistant codepath is the only influence on the caret position.
2205
2206         Test: fast/events/ios/click-selectionchange-once.html
2207
2208         * page/EventHandler.cpp:
2209         (WebCore::EventHandler::handleMousePressEventSingleClick):
2210
2211 2018-06-28  Chris Dumez  <cdumez@apple.com>
2212
2213         Fix encoding / decoding issues in ResourceLoadStatistics
2214         https://bugs.webkit.org/show_bug.cgi?id=186890
2215
2216         Reviewed by Brent Fulgham.
2217
2218         * loader/ResourceLoadStatistics.cpp:
2219         (WebCore::encodeHashCountedSet):
2220         (WebCore::encodeHashSet):
2221         Do not return early if the container we're trying to encode is empty. Instead,
2222         have the encoder encode an empty array. This is important for encoding / decoding
2223         to be fully symmetric. Otherwise, when trying to decode one of these empty containers,
2224         the decoder would fail (silently since we were ignoring decoding errors). Worse, the
2225         decoder might succeed but actually be decoding the *next* container in the file, since
2226         we have several HashCountedSets / HashSets encoded one after another.
2227
2228         (WebCore::decodeHashCountedSet):
2229         (WebCore::decodeHashSet):
2230         Return a boolean to indicate if the decoding suceeded or not.
2231
2232         (WebCore::ResourceLoadStatistics::decode):
2233         Check for container decoding errors and return false when decoding fails.
2234         Otherwise, we would just silently keep going.
2235
2236 2018-06-28  Sihui Liu  <sihui_liu@apple.com>
2237
2238         Cookie API: cookie creation time is wrong
2239         https://bugs.webkit.org/show_bug.cgi?id=187101
2240
2241         Reviewed by Geoffrey Garen.
2242
2243         Covered by API test: WebKit.WKHTTPCookieStoreCreationTime.
2244
2245         * platform/network/cocoa/CookieCocoa.mm:
2246         (WebCore::Cookie::operator NSHTTPCookie * _Nullable  const):
2247
2248 2018-06-28  Zalan Bujtas  <zalan@apple.com>
2249
2250         [LFC] Add Display::Box::nonCollapsedMarginBox for verification purposes.
2251         https://bugs.webkit.org/show_bug.cgi?id=187140
2252
2253         Reviewed by Antti Koivisto.
2254
2255         * layout/FormattingContext.cpp:
2256         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
2257         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2258         * layout/Verification.cpp:
2259         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
2260         * layout/blockformatting/BlockFormattingContext.cpp:
2261         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
2262         * layout/displaytree/DisplayBox.cpp:
2263         (WebCore::Display::Box::nonCollapsedMarginBox const):
2264         * layout/displaytree/DisplayBox.h:
2265         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
2266
2267 2018-06-28  Zalan Bujtas  <zalan@apple.com>
2268
2269         [LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin.
2270         https://bugs.webkit.org/show_bug.cgi?id=187135
2271
2272         Reviewed by Antti Koivisto.
2273
2274         * layout/blockformatting/BlockFormattingContext.h:
2275         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2276         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2277         * layout/blockformatting/BlockMarginCollapse.cpp:
2278         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
2279         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
2280         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
2281
2282 2018-06-28  Dirk Schulze  <krit@webkit.org>
2283
2284         [css-masking] Update clip-path box mapping to unified box
2285         https://bugs.webkit.org/show_bug.cgi?id=185797
2286
2287         Reviewed by Simon Fraser.
2288
2289         The box mapping for fill-box, stroke-box, view-box on HTML elements
2290         and content-box, padding-box, margin-box, border-box for SVG elements
2291         was aligned with the transform-box CSS property.
2292
2293         Furthermore, the keywords fill changed to fill-box and stroke changed
2294         to stroke-box.
2295
2296         https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
2297
2298         Update the -webkit-clip-path property.
2299
2300         Tests: svg/clip-path/clip-path-shape-border-box-expected.svg
2301                svg/clip-path/clip-path-shape-border-box.svg
2302                svg/clip-path/clip-path-shape-content-box-expected.svg
2303                svg/clip-path/clip-path-shape-content-box.svg
2304                svg/clip-path/clip-path-shape-margin-box-expected.svg
2305                svg/clip-path/clip-path-shape-margin-box.svg
2306                svg/clip-path/clip-path-shape-padding-box-expected.svg
2307                svg/clip-path/clip-path-shape-padding-box.svg
2308
2309         * css/CSSPrimitiveValueMappings.h:
2310         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2311         (WebCore::CSSPrimitiveValue::operator CSSBoxType const):
2312         * css/CSSValueKeywords.in:
2313         * css/StyleBuilderConverter.h:
2314         (WebCore::StyleBuilderConverter::convertClipPath):
2315         * css/parser/CSSPropertyParser.cpp:
2316         (WebCore::consumeBasicShapeOrBox):
2317         * rendering/RenderBlock.cpp:
2318         (WebCore::RenderBlock::nodeAtPoint):
2319         * rendering/RenderLayer.cpp:
2320         (WebCore::computeReferenceBox):
2321         * rendering/shapes/BoxShape.cpp:
2322         (WebCore::computeRoundedRectForBoxShape):
2323         * rendering/shapes/ShapeOutsideInfo.cpp:
2324         (WebCore::ShapeOutsideInfo::setReferenceBoxLogicalSize):
2325         (WebCore::ShapeOutsideInfo::logicalTopOffset const):
2326         (WebCore::ShapeOutsideInfo::logicalLeftOffset const):
2327         * rendering/style/RenderStyleConstants.h:
2328         * rendering/svg/SVGRenderingContext.cpp:
2329         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
2330
2331 2018-06-27  Timothy Hatcher  <timothy@apple.com>
2332
2333         Don't expose new semantic -apple-system color keywords on iOS.
2334         https://bugs.webkit.org/show_bug.cgi?id=187080
2335         rdar://problem/41505699
2336
2337         Reviewed by Tim Horton.
2338
2339         * DerivedSources.make: Use gnu++14, since gnu++17 is giving errors on macOS 10.12.
2340         * css/CSSValueKeywords.in: Define new semantic colors only on macOS.
2341
2342 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2343
2344         [LFC] Compute both the collapsed and the non-collapsed margin values.
2345         https://bugs.webkit.org/show_bug.cgi?id=187129
2346
2347         Reviewed by Antti Koivisto.
2348
2349         For validation purposes only at this point.
2350
2351         * layout/FormattingContext.cpp:
2352         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
2353         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2354         * layout/FormattingContext.h:
2355         * layout/FormattingContextGeometry.cpp:
2356         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2357         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2358         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
2359         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2360         * layout/blockformatting/BlockFormattingContext.cpp:
2361         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
2362         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2363         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2364         * layout/blockformatting/BlockMarginCollapse.cpp:
2365         (WebCore::Layout::isMarginTopCollapsedWithParent):
2366         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
2367         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
2368
2369 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2370
2371         [LFC] Align inFlowNonReplacedHeightAndMargin() style with the rest of the compute functions.
2372         https://bugs.webkit.org/show_bug.cgi?id=187126
2373
2374         Reviewed by Antti Koivisto.
2375
2376         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2377         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2378
2379 2018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
2380
2381         [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
2382         https://bugs.webkit.org/show_bug.cgi?id=187089
2383
2384         Reviewed by Michael Catanzaro.
2385
2386         Do not allow copying since XErrorTrapper's logic relies on the address of XErrorTrapper.
2387
2388         * platform/graphics/x11/XErrorTrapper.h:
2389
2390 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2391
2392         [LFC] Align inFlowNonReplacedWidthAndMargin() style with the rest of the compute functions.
2393         https://bugs.webkit.org/show_bug.cgi?id=187124
2394
2395         Reviewed by Antti Koivisto.
2396
2397         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2398         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2399
2400 2018-06-27  Dirk Schulze  <krit@webkit.org>
2401
2402         -webkit-clip-path wrong offset for clipPath references
2403         https://bugs.webkit.org/show_bug.cgi?id=129246
2404
2405         Reviewed by Simon Fraser.
2406
2407         Compute the correct offset for reference clip-paths by reusing
2408         some of the logic from basic shapes.
2409         Makes reference based clip-path interoperable and follows the
2410         spec.
2411
2412         Test: css3/masking/clip-path-reference-2.html
2413
2414         * rendering/RenderLayer.cpp:
2415         (WebCore::computeReferenceBox):
2416         (WebCore::RenderLayer::computeClipPath const):
2417         (WebCore::RenderLayer::setupClipPath):
2418
2419 2018-06-27  Antti Koivisto  <antti@apple.com>
2420
2421         Don't invoke post resolution callbacks when resolving computed style
2422         https://bugs.webkit.org/show_bug.cgi?id=187113
2423         <rdar://problem/41365766>
2424
2425         Reviewed by Geoff Garen.
2426
2427         Post-resolution callbacks should only be invoked when we resolve the full document style,
2428         not when resolving computed style for a single element.
2429
2430         Tests: fast/dom/object-computed-style-event.html
2431
2432         * dom/Document.cpp:
2433         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
2434         * dom/Element.cpp:
2435         (WebCore::Element::resolveComputedStyle):
2436
2437         Also ref the ancestor stack to be safe.
2438
2439         * style/StyleTreeResolver.cpp:
2440         (WebCore::Style::PostResolutionCallbackDisabler::PostResolutionCallbackDisabler):
2441         (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler):
2442
2443         Add an option to not drain the callback queue on destruction. In this mode we
2444         just block network loads.
2445
2446         * style/StyleTreeResolver.h:
2447
2448 2018-06-27  Timothy Hatcher  <timothy@apple.com>
2449
2450         Find on page selection color isn't adapted for dark mode.
2451         https://bugs.webkit.org/show_bug.cgi?id=187072
2452         rdar://problem/40354841
2453
2454         Reviewed by Tim Horton.
2455
2456         * page/mac/TextIndicatorWindow.mm:
2457         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Use [NSColor findHighlightColor].
2458         * platform/mac/LocalDefaultSystemAppearance.h:
2459         (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const): Added.
2460         * platform/mac/LocalDefaultSystemAppearance.mm:
2461         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Set m_usingDarkAppearance.
2462         * rendering/InlineTextBox.cpp:
2463         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Use TextPaintPhase::Decoration since this
2464         matches step three of InlineTextBox::paint ("Paint fancy decorations"). This allows TextMatch to
2465         paint a forground and not end up painting during this "fancy decorations" phase.
2466         (WebCore::InlineTextBox::resolveStyleForMarkedText): Set the fillColor for TextMarker to force a
2467         dark text color which will draw over the yellow highlight.
2468         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): Added support for TextPaintPhase::Decoration.
2469         Seperate DocumentMarker::TelephoneNumber and DocumentMarker::TextMatch. Have DocumentMarker::TextMatch
2470         support Forground and Background phases.
2471         * rendering/RenderTheme.cpp:
2472         (WebCore::RenderTheme::platformColorsDidChange):
2473         (WebCore::RenderTheme::activeTextSearchHighlightColor const): Added. Call the platfrom version.
2474         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const): Added. Ditto.
2475         (WebCore::RenderTheme::platformActiveTextSearchHighlightColor const): Added StyleColor::Options.
2476         (WebCore::RenderTheme::platformInactiveTextSearchHighlightColor const): Ditto.
2477         * rendering/RenderTheme.h:
2478         * rendering/RenderThemeMac.h:
2479         * rendering/RenderThemeMac.mm:
2480         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Added.
2481         (WebCore::RenderThemeMac::platformInactiveTextSearchHighlightColor const): Added.
2482         (WebCore::RenderThemeMac::platformColorsDidChange): Clear new color caches.
2483         (WebCore::RenderThemeMac::systemColor const): Cache system colors by light and dark mode.
2484
2485 2018-06-27  Chris Dumez  <cdumez@apple.com>
2486
2487         Crash under SWServer::unregisterServiceWorkerClient()
2488         https://bugs.webkit.org/show_bug.cgi?id=187115
2489         <rdar://problem/41539197>
2490
2491         Reviewed by Youenn Fablet.
2492
2493         Connections are usually destroyed before their SWServer. However, as per crash traces, it is possible
2494         for SWServers to get destroyed while they still have connections. When this happens, the connections
2495         (which are owned by the SWServer) get destroyed with other SWServer data members. In turn, the
2496         connection destructor tries to unregister its clients from the server that is currently being destroyed.
2497
2498         To address the issue, the SWServer destructor now destroys remaining connections early, before SWServer's
2499         other data members get destroyed.
2500
2501         * workers/service/server/SWServer.cpp:
2502         (WebCore::SWServer::~SWServer):
2503
2504 2018-06-27  Youenn Fablet  <youenn@apple.com>
2505
2506         NetworkLoadChecker should not need to hard ref NetworkConnectionToWebProcess
2507         https://bugs.webkit.org/show_bug.cgi?id=186551
2508
2509         Reviewed by Daniel Bates.
2510
2511         No change of behavior.
2512         Add a way to set the client receiving any CSP warning/error notification.
2513
2514         * page/csp/ContentSecurityPolicy.h:
2515         (WebCore::ContentSecurityPolicy::setClient):
2516
2517 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2518
2519         [LFC] Do not collapse margin with the parent when element has border/padding.
2520         https://bugs.webkit.org/show_bug.cgi?id=187114
2521
2522         Reviewed by Antti Koivisto.
2523
2524         * layout/blockformatting/BlockFormattingContext.cpp:
2525         (WebCore::Layout::BlockFormattingContext::layout const):
2526         * layout/blockformatting/BlockMarginCollapse.cpp:
2527         (WebCore::Layout::isMarginTopCollapsedWithParent):
2528         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
2529         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
2530
2531 2018-06-27  Simon Fraser  <simon.fraser@apple.com>
2532
2533         Fix Windows build after r233268.
2534
2535         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2536         (PlatformCALayerWin::hasContents const):
2537         * platform/graphics/ca/win/PlatformCALayerWin.h:
2538
2539 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2540
2541         [LFC] Out-of-flow positioned element's height depends on its containing block's height.
2542         https://bugs.webkit.org/show_bug.cgi?id=187082
2543
2544         Reviewed by Antti Koivisto.
2545
2546         We can't really compute the final height of an out-of-flow element until after its containing block's height is computed.
2547
2548         * layout/FormattingContext.cpp:
2549         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2550         * layout/FormattingContext.h:
2551         * layout/LayoutContext.cpp:
2552         (WebCore::Layout::LayoutContext::updateLayout):
2553         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
2554         * layout/LayoutContext.h:
2555         * layout/blockformatting/BlockFormattingContext.cpp:
2556         (WebCore::Layout::BlockFormattingContext::layout const):
2557         * layout/layouttree/LayoutContainer.h:
2558         (WebCore::Layout::Container::outOfFlowDescendants const):
2559         (WebCore::Layout::Container::outOfFlowDescendants): Deleted.
2560
2561 2018-06-27  Youenn Fablet  <youenn@apple.com>
2562
2563         Disable content blockers in NetworkLoadChecker except for ping loads
2564         https://bugs.webkit.org/show_bug.cgi?id=187083
2565         <rdar://problem/41440083>
2566
2567         Reviewed by Chris Dumez.
2568
2569         Add internals API to reload a frame without content extensions.
2570
2571         Test: http/tests/contentextensions/reload-without-contentextensions.html
2572
2573         * testing/Internals.cpp:
2574         (WebCore::Internals::reloadWithoutContentExtensions):
2575         * testing/Internals.h:
2576         * testing/Internals.idl:
2577
2578 2018-06-27  Simon Fraser  <simon.fraser@apple.com>
2579
2580         https://hackernoon.com/ uses lots of layer backing store
2581         https://bugs.webkit.org/show_bug.cgi?id=186909
2582         rdar://problem/40257540
2583
2584         Reviewed by Tim Horton.
2585         
2586         The existing "backing store detached" logic, which was used to eliminate backing store
2587         for compositing layers outside the viewport, had a number of bugs that allowed layers
2588         to have backing store when they should not.
2589         
2590         Specifically, any code path that ended up in setNeedsDisplay{InRect}() in PlatformCALayer
2591         could trigger backing store creation on layers that should have never had any.
2592         
2593         Rather than monkeypatch all the GraphicsLayerCA call sites that call setNeedsDisplay{InRect}(),
2594         just bail early from the PlatformCALayer* methods that trigger repaints.
2595         
2596         Tests didn't catch this because they just dumped the state of the backingStoreAttached flag. To fix this,
2597         create backingStoreAttachedForTesting() which also tests whether the layer has contents.
2598
2599         Test: compositing/backing/backing-store-attachment-outside-viewport.html
2600
2601         * platform/graphics/GraphicsLayer.cpp:
2602         (WebCore::GraphicsLayer::dumpProperties const):
2603         (showGraphicsLayerTree):
2604         * platform/graphics/GraphicsLayer.h:
2605         (WebCore::GraphicsLayer::backingStoreAttachedForTesting const):
2606         * platform/graphics/GraphicsLayerClient.h:
2607         * platform/graphics/ca/GraphicsLayerCA.cpp:
2608         (WebCore::GraphicsLayerCA::backingStoreAttachedForTesting const):
2609         (WebCore::GraphicsLayerCA::setNeedsDisplay):
2610         * platform/graphics/ca/GraphicsLayerCA.h:
2611         * platform/graphics/ca/PlatformCALayer.h:
2612         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
2613         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2614         (PlatformCALayerCocoa::setNeedsDisplay):
2615         (PlatformCALayerCocoa::setNeedsDisplayInRect):
2616         (PlatformCALayerCocoa::hasContents const):
2617
2618 2018-06-27  David Kilzer  <ddkilzer@apple.com>
2619
2620         Fix clang static analyzer warnings: Branch condition evaluates to a garbage value
2621         <https://webkit.org/b/186968>
2622
2623         Reviewed by Zalan Bujtas.
2624
2625         This patch changes two stack-allocated `bool` variables into
2626         `std::optional<bool>` since the functions that set the variable
2627         may return early without setting it.  It also changes one
2628         stack-allocated pointer to be initialized to `nullptr`.
2629
2630         * animation/AnimationTimeline.cpp:
2631         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
2632         Update for change to CSSPropertyAnimation::getPropertyAtIndex()
2633         argument type.
2634
2635         * editing/ios/EditorIOS.mm:
2636         (WebCore::Editor::writeImageToPasteboard): Initialize
2637         `cachedImage` stack pointer to nullptr since getImage() has an
2638         early return that doesn't set `cachedImage`.
2639         * editing/mac/EditorMac.mm:
2640         (WebCore::Editor::writeImageToPasteboard): Ditto.
2641
2642         * page/animation/CSSPropertyAnimation.cpp:
2643         (WebCore::CSSPropertyAnimation::getPropertyAtIndex):
2644         * page/animation/CSSPropertyAnimation.h:
2645         (WebCore::CSSPropertyAnimation::getPropertyAtIndex):
2646         - Change method to take `std::optional<bool>` instead of `bool`
2647           as second argument since the method may return early without
2648           setting `isShorthand`.
2649
2650         * page/animation/CompositeAnimation.cpp:
2651         (WebCore::CompositeAnimation::updateTransitions): Update for
2652         change to CSSPropertyAnimation::getPropertyAtIndex() argument
2653         type.
2654
2655         * rendering/InlineFlowBox.cpp:
2656         (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Also
2657         rename local `emphasisMarkIsOver` to `emphasisMarkIsAbove` to
2658         match other call sites.
2659         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
2660         (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
2661         (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
2662         - Update for change to InlineTextBox::emphasisMarkExistsAndIsAbove()
2663           argument type.
2664         * rendering/InlineTextBox.cpp:
2665         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2666         - Change method to take `std::optional<bool>` instead of `bool`
2667           as second argument since the method may return early without
2668           setting `above`.
2669         (WebCore::InlineTextBox::paintMarkedTextForeground):
2670         - Update for change to InlineTextBox::emphasisMarkExistsAndIsAbove()
2671           argument type.
2672         * rendering/InlineTextBox.h:
2673         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2674         - Change method to take `std::optional<bool>` instead of `bool`.
2675
2676 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2677
2678         [LFC] Move formatting context root layout logic to a dedicated function.
2679         https://bugs.webkit.org/show_bug.cgi?id=187097
2680
2681         Reviewed by Antti Koivisto.
2682
2683         * layout/blockformatting/BlockFormattingContext.cpp:
2684         (WebCore::Layout::BlockFormattingContext::layout const):
2685         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2686         * layout/blockformatting/BlockFormattingContext.h:
2687
2688 2018-06-27  Zalan Bujtas  <zalan@apple.com>
2689
2690         [LFC] Compute static position for out-of-flow elements only when required.
2691         https://bugs.webkit.org/show_bug.cgi?id=187096
2692
2693         Reviewed by Antti Koivisto.
2694
2695         Computing static position for out-of-flow elements could be somewhat expensive, so let's not do it unless we actually need it.
2696
2697         * layout/FormattingContextGeometry.cpp:
2698         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
2699         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
2700         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2701         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2702         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2703         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2704         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2705         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
2706         (WebCore::Layout::BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned): Deleted.
2707
2708 2018-06-27  Nan Wang  <n_wang@apple.com>
2709
2710         AX: [iOS] Remove the ability to set keyboard focus when VoiceOver takes focus
2711         https://bugs.webkit.org/show_bug.cgi?id=187076
2712
2713         Reviewed by Chris Fleizach.
2714
2715         We shouldn't set keyboard focus when assistive technology takes focus since
2716         this is causing website incompatibility issues by causing focus to be lost.
2717
2718         Test: accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html
2719
2720         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2721         (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
2722
2723 2018-06-21  Emilio Cobos Álvarez  <emilio@crisal.io>
2724
2725         Move clearChildNeedsStyleRecalc into resetStyleForNonRenderedDescendants.
2726         https://bugs.webkit.org/show_bug.cgi?id=186881
2727
2728         Reviewed by Antti Koivisto.
2729
2730         Every caller does this already.
2731
2732         No new tests, no change in behavior.
2733
2734         * style/StyleTreeResolver.cpp:
2735         (WebCore::Style::resetStyleForNonRenderedDescendants):
2736         (WebCore::Style::TreeResolver::resolveComposedTree):
2737
2738 2018-06-27  Tomas Popela  <tpopela@redhat.com>
2739
2740         [GStreamer] Coverity scan issues
2741         https://bugs.webkit.org/show_bug.cgi?id=187087
2742
2743         Reviewed by Xabier Rodriguez-Calvar.
2744
2745         Fix uninitialized members.
2746
2747         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2748         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2749         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
2750
2751 2018-06-27  Zan Dobersek  <zdobersek@igalia.com>
2752
2753         [GCrypt] Move definitions of GCryptUtilities helpers into a separate source file
2754         https://bugs.webkit.org/show_bug.cgi?id=187033
2755
2756         Reviewed by Michael Catanzaro.
2757
2758         Move the GCryptUtilities helpers that operate on libgcrypt values and
2759         constants into a separate source file. This limits a bit the amount of
2760         inlining the compiler might feel compelled to do, and the resulting
2761         shared library is 8kB smaller in size.
2762
2763         * crypto/gcrypt/GCryptUtilities.cpp: Copied from Source/WebCore/crypto/gcrypt/GCryptUtilities.h.
2764         (WebCore::hmacAlgorithm):
2765         (WebCore::digestAlgorithm):
2766         (WebCore::hashCryptoDigestAlgorithm):
2767         (WebCore::mpiLength):
2768         (WebCore::mpiData):
2769         (WebCore::mpiZeroPrefixedData):
2770         (WebCore::mpiSignedData):
2771         * crypto/gcrypt/GCryptUtilities.h:
2772         (WebCore::hmacAlgorithm): Deleted.
2773         (WebCore::digestAlgorithm): Deleted.
2774         (WebCore::hashCryptoDigestAlgorithm): Deleted.
2775         (WebCore::mpiLength): Deleted.
2776         (WebCore::mpiData): Deleted.
2777         (WebCore::mpiZeroPrefixedData): Deleted.
2778         (WebCore::mpiSignedData): Deleted.
2779         * platform/SourcesGCrypt.txt:
2780
2781 2018-06-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2782
2783         [JSC] Pass VM& to functions more
2784         https://bugs.webkit.org/show_bug.cgi?id=186241
2785
2786         Reviewed by Mark Lam.
2787
2788         * bindings/js/JSCustomElementRegistryCustom.cpp:
2789         (WebCore::JSCustomElementRegistry::define):
2790
2791 2018-06-26  Simon Fraser  <simon.fraser@apple.com>
2792
2793         CSSGradientValue's color stops vector wastes 12KB on theverge.com
2794         https://bugs.webkit.org/show_bug.cgi?id=186988
2795
2796         Reviewed by Sam Weinig.
2797
2798         Shrink the color stops vector when we're done parsing the stops.
2799
2800         * css/CSSGradientValue.h:
2801         (WebCore::CSSGradientValue::doneAddingStops):
2802         * css/parser/CSSPropertyParserHelpers.cpp:
2803         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
2804         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
2805         (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops):
2806
2807 2018-06-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2808
2809         Remove static initializers more
2810         https://bugs.webkit.org/show_bug.cgi?id=186969
2811
2812         Reviewed by Michael Catanzaro.
2813
2814         This patch removes static initializers more. They typically exists in GTK port.
2815
2816         No behavior change.
2817
2818         * Sources.txt:
2819         * WebCore.xcodeproj/project.pbxproj:
2820         * page/ResourceUsageData.cpp: Removed.
2821         * page/ResourceUsageData.h:
2822         Remove ResourceUsageData constructors since default constructors are enough.
2823
2824         (WebCore::MemoryCategoryInfo::MemoryCategoryInfo):
2825         * platform/gtk/PasteboardHelper.cpp:
2826         (WebCore::markupPrefix):
2827         (WebCore::removeMarkupPrefix):
2828         (WebCore::PasteboardHelper::fillSelectionData):
2829         Use NeverDestroyed<> and static functions.
2830
2831         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
2832         (WebCore::defaultVolumeCapability):
2833         (WebCore::GStreamerAudioCaptureSource::capabilities const):
2834         CapabilityValueOrRange's constructor is not constexpr.
2835
2836         * platform/network/soup/SoupNetworkSession.cpp:
2837         (WebCore::initialAcceptLanguages):
2838         (WebCore::proxySettings):
2839         (WebCore::SoupNetworkSession::SoupNetworkSession):
2840         (WebCore::SoupNetworkSession::setupProxy):
2841         (WebCore::SoupNetworkSession::setProxySettings):
2842         (WebCore::SoupNetworkSession::setInitialAcceptLanguages):
2843         Use NeverDestroyed<> and static functions.
2844
2845 2018-06-26  Daniel Bates  <dabates@apple.com>
2846
2847         REGRESSION (r231479): Unable to buy Odeon cinema tickets in STP (bogus 'X-Frame-Options' to 'SAMEORIGIN')
2848         https://bugs.webkit.org/show_bug.cgi?id=186090
2849         <rdar://problem/40692595>
2850
2851         Reviewed by Andy Estes.
2852
2853         Fix up Content Security Policy logic for checking the frame ancestors now that we
2854         exclude the frame that initiated the load request.
2855
2856         Test: http/tests/security/XFrameOptions/cross-origin-iframe-post-form-to-parent-same-origin-x-frame-options-page-allow.html
2857
2858         * page/csp/ContentSecurityPolicy.cpp:
2859         (WebCore::ContentSecurityPolicy::allowFrameAncestors const): 
2860         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2861         (WebCore::checkFrameAncestors):
2862
2863 2018-06-26  Chris Dumez  <cdumez@apple.com>
2864
2865         Simplify NetworkStorageSession::getAllStorageAccessEntries()
2866         https://bugs.webkit.org/show_bug.cgi?id=187016
2867
2868         Reviewed by Youenn Fablet.
2869
2870         Iterate over the HashMaps' values instead of iterating over their keys and then looking them
2871         up in the HashMap.
2872
2873         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2874         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
2875
2876 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
2877
2878         [Mac] AirPlay picker uses incorrect theme in Dark mode
2879         https://bugs.webkit.org/show_bug.cgi?id=187054
2880         <rdar://problem/41291093>
2881
2882         Reviewed by Timothy Hatcher.
2883
2884         * Modules/mediasession/WebMediaSessionManager.cpp:
2885         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): Add useDefaultAppearance parameter.
2886         * Modules/mediasession/WebMediaSessionManager.h:
2887
2888         * platform/graphics/MediaPlaybackTargetPicker.cpp:
2889         (WebCore::MediaPlaybackTargetPicker::showPlaybackTargetPicker): Ditto.
2890         * platform/graphics/MediaPlaybackTargetPicker.h:
2891
2892         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
2893         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2894         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Choose theme based on
2895         useDefaultAppearance parameter.
2896
2897         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
2898         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker): Log parameter.
2899         * platform/mock/MediaPlaybackTargetPickerMock.h:
2900
2901 2018-06-26  Thibault Saunier  <tsaunier@igalia.com>
2902
2903         [GStreamer] Do not forget to set stream on track switching
2904         https://bugs.webkit.org/show_bug.cgi?id=187049
2905
2906         Reviewed by Philippe Normand.
2907
2908         This was an overlooked issue introduced in Bug #186678
2909
2910         This is already tested, but we currently run only tests against playbin2
2911
2912         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2913         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
2914
2915 2018-06-26  Zalan Bujtas  <zalan@apple.com>
2916
2917         [LFC] Fixed positioning is a subcategory of absolute positioning.
2918         https://bugs.webkit.org/show_bug.cgi?id=187043
2919
2920         Reviewed by Antti Koivisto.
2921
2922         https://www.w3.org/TR/CSS22/visuren.html#absolute-positioning
2923         References in this specification to an absolutely positioned element (or its box) imply that the element's 'position'
2924         property has the value 'absolute' or 'fixed'.
2925
2926         * layout/layouttree/LayoutBox.cpp:
2927         (WebCore::Layout::Box::isAbsolutelyPositioned const):
2928         * layout/layouttree/LayoutBox.h:
2929         (WebCore::Layout::Box::isOutOfFlowPositioned const):
2930
2931 2018-06-26  Commit Queue  <commit-queue@webkit.org>
2932
2933         Unreviewed, rolling out r233143.
2934         https://bugs.webkit.org/show_bug.cgi?id=187046
2935
2936         broke media/video-ended-event-negative-playback.html
2937         (Requested by philn on #webkit).
2938
2939         Reverted changeset:
2940
2941         "[GStreamer] Remove useless workaround"
2942         https://bugs.webkit.org/show_bug.cgi?id=186921
2943         https://trac.webkit.org/changeset/233143
2944
2945 2018-06-25  Zalan Bujtas  <zalan@apple.com>
2946
2947         [LFC] Computed height for in-flow non-replaced should not include padding and border.
2948         https://bugs.webkit.org/show_bug.cgi?id=187031
2949
2950         Reviewed by Antti Koivisto.
2951
2952         In certain cases the height of a non-replaced in-flow box is computed using the bottom position of its last in-flow child.
2953         The in-flow child's bottom position is in the coordinate system of the containing block's border box (border box's top left is 0, 0) ->
2954         it includes both the (top) border and the padding of the containing block.
2955
2956         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2957         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2958
2959 2018-06-26  Zan Dobersek  <zdobersek@igalia.com>
2960
2961         Crash in WebAnimation::runPendingPlayTask
2962         https://bugs.webkit.org/show_bug.cgi?id=186189
2963
2964         Reviewed by Carlos Garcia Campos.
2965
2966         Avoid crashes on nullopt std::optional dereference in the
2967         runPendingPlayTask() and runPendingPauseTask() methods of the
2968         WebAnimation class by defaulting to a Seconds(0) value.
2969
2970         In both cases the std::optional value is the current time retrieved from
2971         the associated DocumentTimeline object. But there's no guarantee that
2972         the timeline is active and the resulting time value is resolved (i.e.
2973         not nullopt). Dereferencing the nullopt Seconds value doesn't cause a
2974         problem on configurations still building as C++14 and the fallback
2975         std::optional implementation provided by WTF -- no signal is raised, and
2976         a 0 value is returned. Configurations building as C++17 on the other
2977         hand use the stdlib-provided std::optional that does raise a signal on
2978         invalid access, leading to crashes.
2979
2980         The default-to-Seconds(0) solution avoids crashes on configurations
2981         that build with C++17 support enabled, and thus match configurations
2982         that are still using WTF's std::optional. This still doesn't address the
2983         underlying problem of retrieving current time from an inactive document
2984         timeline and using it as ready time for the pending play/pause task
2985         execution.
2986
2987         runPendingPlayTask() change addresses crashes in the following tests:
2988         - fast/animation/css-animation-resuming-when-visible.html
2989         - fast/animation/css-animation-resuming-when-visible-with-style-change.html
2990         - imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
2991         - imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/getAnimations.html
2992
2993         runPendingPauseTask() change addresses crashes in the following tests:
2994         - animations/multiple-animations-timing-function.html
2995
2996         * animation/WebAnimation.cpp:
2997         (WebCore::WebAnimation::runPendingPlayTask):
2998         (WebCore::WebAnimation::runPendingPauseTask):
2999
3000 2018-06-26  Antoine Quint  <graouts@apple.com>
3001
3002         [Web Animations] Show the feature as "Supported in Preview"
3003         https://bugs.webkit.org/show_bug.cgi?id=187037
3004
3005         Reviewed by Dean Jackson.
3006
3007         Web Animations are enabled by default in STP.
3008
3009         * features.json:
3010
3011 2018-06-26  Miguel Gomez  <magomez@igalia.com>
3012
3013         [GTK] Many webpages can crash the browser in WebCore::CoordinatedGraphicsLayer::transformedVisibleRect
3014         https://bugs.webkit.org/show_bug.cgi?id=179304
3015
3016         Reviewed by Michael Catanzaro.
3017
3018         When adding new CoordinatedGraphicsLayers to the tree, check that they have the appropriate
3019         CompositingCoordinator. If that's not the case, set the appropriate one to the layer and its
3020         children and set the state of those layers so they are rendered properly.
3021
3022         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3023         (WebCore::CoordinatedGraphicsLayer::addChild):
3024         (WebCore::CoordinatedGraphicsLayer::addChildAtIndex):
3025         (WebCore::CoordinatedGraphicsLayer::addChildAbove):
3026         (WebCore::CoordinatedGraphicsLayer::addChildBelow):
3027         (WebCore::CoordinatedGraphicsLayer::replaceChild):
3028         (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
3029         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3030
3031 2018-06-25  Keith Rollin  <krollin@apple.com>
3032
3033         Adjust WEBCORE_EXPORT annotations for LTO
3034         https://bugs.webkit.org/show_bug.cgi?id=186944
3035         <rdar://problem/41384880>
3036
3037         Reviewed by David Kilzer.
3038
3039         Adjust a number of places that result in WebKit's
3040         'check-for-weak-vtables-and-externals' script reporting weak external
3041         symbols:
3042
3043             ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore)
3044             ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
3045             ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
3046             ...
3047
3048         These cases are caused by inline methods being marked with WTF_EXPORT
3049         (or related macro) or with an inline function being in a class marked
3050         as such, and when enabling LTO builds.
3051
3052         For the most part, address these by removing the WEBCORE_EXPORT
3053         annotation from inline methods. In some cases, move the implementation
3054         out-of-line because it's the class that has the WEBCORE_EXPORT on it
3055         and removing the annotation from the class would be too disruptive.
3056         Finally, in other cases, move the implementation out-of-line because
3057         check-for-weak-vtables-and-externals still complains when keeping the
3058         implementation inline and removing the annotation; this seems to
3059         typically (but not always) happen with destructors.
3060
3061         No new tests. There is no changed functionality. Only the annotation
3062         and treatment of inline methods are altered.
3063
3064         * animation/AnimationTimeline.h:
3065         (WebCore::AnimationTimeline::pause):
3066         * page/CacheStorageProvider.h:
3067         (): Deleted.
3068         * page/scrolling/ScrollingTree.h:
3069         (WebCore::ScrollingTree::reportSynchronousScrollingReasonsChanged):
3070         (WebCore::ScrollingTree::reportExposedUnfilledArea):
3071         * platform/audio/PlatformMediaSessionManager.h:
3072         (WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession const):
3073         (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingTitle const):
3074         (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingDuration const):
3075         (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingElapsedTime const):
3076         (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingInfoUniqueIdentifier const):
3077         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
3078         * platform/audio/mac/CARingBuffer.cpp:
3079         (WebCore::CARingBuffer::~CARingBuffer):
3080         * platform/audio/mac/CARingBuffer.h:
3081         (WebCore::CARingBuffer::~CARingBuffer): Deleted.
3082         * platform/cocoa/VideoFullscreenModelVideoElement.h:
3083         * platform/gamepad/GamepadProvider.h:
3084         * platform/graphics/GraphicsLayer.h:
3085         (WebCore::GraphicsLayer::displayListAsText const):
3086         (WebCore::GraphicsLayer::setIsTrackingDisplayListReplay):
3087         (WebCore::GraphicsLayer::isTrackingDisplayListReplay const):
3088         (WebCore::GraphicsLayer::replayDisplayListAsText const):
3089         * platform/mac/PlaybackSessionInterfaceMac.h:
3090         * platform/mediastream/RealtimeMediaSourceCenter.h:
3091         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
3092         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
3093         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3094         (WebCore::LibWebRTCProvider::setActive):
3095         (WebCore::LibWebRTCProvider::createDecoderFactory):
3096         (WebCore::LibWebRTCProvider::createEncoderFactory):
3097         (WebCore::LibWebRTCProvider::disableEnumeratingAllNetworkInterfaces):
3098         (WebCore::LibWebRTCProvider::enableEnumeratingAllNetworkInterfaces):
3099         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3100         * platform/network/ResourceHandleClient.h:
3101         (WebCore::ResourceHandleClient::willCacheResponseAsync):
3102         * testing/MockGamepadProvider.h:
3103         * workers/service/server/SWServer.h:
3104         (WebCore::SWServer::Connection::~Connection):
3105
3106 2018-06-25  Zalan Bujtas  <zalan@apple.com>
3107
3108         [LFC] Adjust static position for out-of-flow positioned boxes.
3109         https://bugs.webkit.org/show_bug.cgi?id=187000
3110
3111         Reviewed by Antti Koivisto.
3112
3113         The static position of an out-of-flow positioned box is the the position where box would go
3114         if it was in-flow positioned. This position needs to the resolved in the containing block's coordinate system.
3115
3116         * layout/blockformatting/BlockFormattingContext.h:
3117         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3118         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3119         (WebCore::Layout::BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned):
3120         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
3121
3122 2018-06-25  Brady Eidson  <beidson@apple.com>
3123
3124         Remove RELEASE_ASSERT added in r230875.
3125         <rdar://problem/40860061> and https://bugs.webkit.org/show_bug.cgi?id=187022
3126
3127         Reviewed by Brent Fulgham.
3128
3129         There's actually more than one way for a network session to be destroyed, and that can happen
3130         asynchronously and unpredictably.
3131
3132         And the request to start up a WebSocket and do its handshake is also asynchronous and unpredictable
3133  
3134         It's an expected race.
3135
3136         If the NetworkStorageSession cannot be found then the WebSocket handshake should just fail.
3137
3138         * platform/network/SocketStreamHandleImpl.cpp:
3139         (WebCore::cookieDataForHandshake): If the NetworkStorageSession cannot be found, return std::nullopt.
3140         (WebCore::SocketStreamHandleImpl::platformSendHandshake): If the cookieData is null, fail the handshake.
3141
3142 2018-06-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3143
3144         [iPad apps on macOS] Web process crashes when attempting to play embedded YouTube video in News
3145         https://bugs.webkit.org/show_bug.cgi?id=187011
3146         <rdar://problem/40906808>
3147
3148         Reviewed by Tim Horton.
3149
3150         Disable remote media commands when running iOS WebKit on macOS. The iOS flavor of RemoteCommandListener
3151         currently throws an exception when attempting to soft-link the MediaPlayer framework, which prevents video from
3152         being played altogether. For a followup tracking touch bar integration in iOS WebKit on macOS, see:
3153         <rdar://problem/39164732>.
3154
3155         Manually tested by playing a YouTube video in News.
3156
3157         * platform/RemoteCommandListener.cpp:
3158         * platform/ios/RemoteCommandListenerIOS.h:
3159         * platform/ios/RemoteCommandListenerIOS.mm:
3160
3161 2018-06-25  Keith Rollin  <krollin@apple.com>
3162         Unreviewed, rolling out r233087.
3163
3164         Causes 5% Mac PLT regression.
3165
3166         Reverted changeset:
3167
3168         "Recalc styles every time defaultAppearance changes."
3169         https://bugs.webkit.org/show_bug.cgi?id=186866
3170         https://trac.webkit.org/changeset/233087
3171
3172 2018-06-25  Brent Fulgham  <bfulgham@apple.com>
3173
3174         REGRESSION(r229722): WebKitLegacy clients can crash when loading alternate page
3175         https://bugs.webkit.org/show_bug.cgi?id=187008
3176         
3177         Reviewed by Chris Dumez.
3178
3179         The new call to 'clearProvisionalLoadForPolicyCheck' added in r229722 broke loading
3180         behavior in WebKitLegacy.
3181
3182         1. We can now enter 'cancelPolicyCheckIfNeeded' without a Frame loader, in what appears
3183            to be a recursive call during the load cancellation (the 'm_waitingForContentPolicy'
3184            and 'm_waitingForNavigationPolicy' have already been nulled). It seems like we should
3185            return early here, or perhaps just move the RELEASE_ASSERT inside the case where we
3186            have an active policy check happening.
3187
3188         2. We also enter FrameLoader::checkContentPolicy without an active document loader. We
3189            should recognize this case and handle it, rather than trying to dereference a nullptr
3190            document loader.
3191
3192         * loader/DocumentLoader.cpp:
3193         (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded): Move the RELEASE_ASSERT inside the
3194         conditional where the frameLoader is actually used.
3195         * loader/FrameLoader.cpp:
3196         (WebCore::FrameLoader::checkContentPolicy): Recognize that the activeDocumentLoader may
3197         be nullptr at this point, and take appropriate action (rather than crashing).
3198
3199 2018-06-25  Simon Fraser  <simon.fraser@apple.com>
3200
3201         MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com
3202         https://bugs.webkit.org/show_bug.cgi?id=186990
3203
3204         Reviewed by Antti Koivisto.
3205
3206         MatchedPropertiesCacheItem.matchedProperties was appended to, so it allocated capacity
3207         in 16-size chunks. Instead, assign to it so it only allocates as much capacity as is needed.
3208         Copy-constructing is more wasteful, since it copies the 64-chunk size from the right-hand side.
3209
3210         * css/StyleResolver.cpp:
3211         (WebCore::StyleResolver::addToMatchedPropertiesCache):
3212         * css/StyleResolver.h:
3213         (WebCore::StyleResolver::MatchedPropertiesCacheItem::MatchedPropertiesCacheItem):
3214
3215 2018-06-25  Chris Dumez  <cdumez@apple.com>
3216
3217         Null dereference crash un ApplicationCacheGroup::startLoadingEntry()
3218         https://bugs.webkit.org/show_bug.cgi?id=187012
3219         <rdar://problem/40793716>
3220
3221         Reviewed by Youenn Fablet.
3222
3223         m_entryLoader can be null because ApplicationCacheResourceLoader::create() return null when
3224         CachedResourceLoader::requestRawResource() fails synchronously. In such case, the completion
3225         handler gets called with a ApplicationCacheResourceLoader::Error::CannotRequestResource error.
3226
3227         To address the issue, we capture the request's URL in the lambda and use it instead of trying
3228         to get the URL from the loader's resource.
3229
3230         * loader/appcache/ApplicationCacheGroup.cpp:
3231         (WebCore::ApplicationCacheGroup::startLoadingEntry):
3232
3233 2018-06-25  Ross Kirsling  <ross.kirsling@sony.com>
3234
3235         REGRESSION (r233140): Windows build failure due to incomplete FrameView and RenderBox types
3236         https://bugs.webkit.org/show_bug.cgi?id=186997
3237
3238         * animation/KeyframeEffectReadOnly.cpp:
3239
3240 2018-06-25  Antoine Quint  <graouts@apple.com>
3241
3242         REGRESSION: hardware-accelerated animation fails on inline element
3243         https://bugs.webkit.org/show_bug.cgi?id=186981
3244         <rdar://problem/41418697>
3245
3246         Reviewed by Dean Jackson.
3247
3248         Ensure we only queue accelerated actions when we have a renderer so we don't attempt
3249         to start an accelerated animation too soon.
3250
3251         Test: webanimations/opacity-animation-yields-compositing-span.html
3252
3253         * animation/KeyframeEffectReadOnly.cpp:
3254         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState):
3255
3256 2018-06-25  David Kilzer  <ddkilzer@apple.com>
3257
3258         REGRESSION (r233140): v2: Windows build failure due to incomplete DocumentAnimationScheduler type
3259         <https://webkit.org/b/186997>
3260
3261         * dom/Document.cpp:
3262         (WebCore::Document::prepareForDestruction):
3263         (WebCore::Document::windowScreenDidChange):
3264         * dom/Document.h:
3265         - DocumentAnimationScheduler is behind the
3266           USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) macro, which
3267           is disabled on Windows.
3268         - This also reverts my fix in r233144 since it didn't work.
3269
3270 2018-06-25  Youenn Fablet  <youenn@apple.com>
3271
3272         Add API to control mock media devices
3273         https://bugs.webkit.org/show_bug.cgi?id=186958
3274
3275         Reviewed by Eric Carlson.
3276
3277         Refactor code to introduce a MockDevice structure that can be used in multiple processes.
3278         Update mock sources and center to use MockDevice.
3279         Add API to update mock media devices.
3280
3281         Make MediaDevices an ActiveDOMObject so that it does not get collected when ondevicechange is set.
3282
3283          Test: fast/mediastream/device-change-event-2.html
3284
3285         * Modules/mediastream/MediaDevices.cpp:
3286         (WebCore::MediaDevices::MediaDevices):
3287         (WebCore::MediaDevices::stop):
3288         (WebCore::MediaDevices::scheduledEventTimerFired):
3289         (WebCore::MediaDevices::hasPendingActivity const):
3290         (WebCore::MediaDevices::activeDOMObjectName const):
3291         (WebCore::MediaDevices::canSuspendForDocumentSuspension const):
3292         * Modules/mediastream/MediaDevices.h:
3293         * Modules/mediastream/MediaDevices.idl:
3294         * WebCore.xcodeproj/project.pbxproj:
3295         * platform/mediastream/RealtimeMediaSourceCenter.h:
3296         * platform/mock/MockMediaDevice.h: Added.
3297         (WebCore::MockMicrophoneProperties::encode const):
3298         (WebCore::MockMicrophoneProperties::decode):
3299         (WebCore::MockCameraProperties::encode const):
3300         (WebCore::MockCameraProperties::decode):
3301         (WebCore::MockDisplayProperties::encode const):
3302         (WebCore::MockDisplayProperties::decode):
3303         (WebCore::MockMediaDevice::isMicrophone const):
3304         (WebCore::MockMediaDevice::isCamera const):
3305         (WebCore::MockMediaDevice::isDisplay const):
3306         (WebCore::MockMediaDevice::type const):
3307         (WebCore::MockMediaDevice::encode const):
3308         (WebCore::MockMediaDevice::decodeMockMediaDevice):
3309         (WebCore::MockMediaDevice::decode):
3310         * platform/mock/MockRealtimeAudioSource.cpp:
3311         (WebCore::MockRealtimeAudioSource::startProducingData):
3312         * platform/mock/MockRealtimeMediaSource.cpp:
3313         (WebCore::defaultDevices):
3314         (WebCore::devices):
3315         (WebCore::deviceMap):
3316         (WebCore::deviceListForDevice):
3317         (WebCore::MockRealtimeMediaSource::createCaptureDevice):
3318         (WebCore::MockRealtimeMediaSource::resetDevices):
3319         (WebCore::MockRealtimeMediaSource::setDevices):
3320         (WebCore::MockRealtimeMediaSource::addDevice):
3321         (WebCore::MockRealtimeMediaSource::removeDevice):
3322         (WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID):
3323         (WebCore::MockRealtimeMediaSource::audioDevices):
3324         (WebCore::MockRealtimeMediaSource::videoDevices):
3325         (WebCore::MockRealtimeMediaSource::displayDevices):
3326         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
3327         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
3328         (WebCore::MockRealtimeMediaSource::initializeSettings):
3329         (WebCore::MockRealtimeMediaSource::settings const):
3330         (WebCore::MockRealtimeMediaSource::supportedConstraints):
3331         * platform/mock/MockRealtimeMediaSource.h:
3332         (WebCore::MockRealtimeMediaSource::device const):
3333         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3334         (WebCore::MockRealtimeMediaSourceCenter::singleton):
3335         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
3336         (WebCore::MockRealtimeMediaSourceCenter::setDevices):
3337         (WebCore::MockRealtimeMediaSourceCenter::addDevice):
3338         (WebCore::MockRealtimeMediaSourceCenter::removeDevice):
3339         * platform/mock/MockRealtimeMediaSourceCenter.h:
3340         * platform/mock/MockRealtimeVideoSource.cpp:
3341         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
3342         (WebCore::MockRealtimeVideoSource::initializeCapabilities):
3343         (WebCore::MockRealtimeVideoSource::drawText):
3344         (WebCore::MockRealtimeVideoSource::generateFrame):
3345         * platform/mock/MockRealtimeVideoSource.h:
3346         (WebCore::MockRealtimeVideoSource::mockCamera const):
3347         (WebCore::MockRealtimeVideoSource::mockScreen const):
3348
3349 2018-06-25  Simon Fraser  <simon.fraser@apple.com>
3350
3351         AutoTableLayout wastes 52KB of Vector capacity on nytimes.com
3352         https://bugs.webkit.org/show_bug.cgi?id=186710
3353
3354         Reviewed by Zalan Bujtas.
3355         
3356         Call resizeToFit() to only allocate enough capacity for the number of columns.
3357
3358         * rendering/AutoTableLayout.cpp:
3359         (WebCore::AutoTableLayout::fullRecalc):
3360         (WebCore::AutoTableLayout::insertSpanCell): Whitespace fix.
3361         * rendering/AutoTableLayout.h:
3362
3363 2018-06-25  Zalan Bujtas  <zalan@apple.com>
3364
3365         [LFC] Adjust static position with containing block's content box top/left
3366         https://bugs.webkit.org/show_bug.cgi?id=186999
3367
3368         Reviewed by Antti Koivisto.
3369
3370         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3371         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
3372         * layout/displaytree/DisplayBox.cpp:
3373         (WebCore::Display::Box::contentBox const):
3374         * layout/displaytree/DisplayBox.h:
3375         (WebCore::Display::Box::contentBoxTop const):
3376         (WebCore::Display::Box::contentBoxLeft const):
3377
3378 2018-06-25  David Kilzer  <ddkilzer@apple.com>
3379
3380         REGRESSION (r233140): Windows build failure due to incomplete DocumentAnimationScheduler type
3381         <https://webkit.org/b/186997>
3382
3383         * dom/Document.cpp:
3384         * dom/Document.h:
3385         - Attempt to fix Windows build failure by moving include of
3386           DocumentAnimationScheduler.h from Document.cpp to Document.h.
3387
3388 2018-06-25  Philippe Normand  <pnormand@igalia.com>
3389
3390         [GStreamer] Remove useless workaround
3391         https://bugs.webkit.org/show_bug.cgi?id=186921
3392
3393         Reviewed by Xabier Rodriguez-Calvar.
3394
3395         In bug 67407 a workaround was added for GStreamer 0.10. With 1.x
3396         the media/video-reverse-play-duration.html test passes without any
3397         workaround needed. The other test mentioned in that bug was
3398         removed, it seems.
3399
3400         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3401         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
3402
3403 2018-06-24  Tomas Popela  <tpopela@redhat.com>
3404
3405         Unreviewed, address Darin's comment
3406         https://bugs.webkit.org/show_bug.cgi?id=186757
3407
3408         * page/linux/ResourceUsageThreadLinux.cpp:
3409         (WebCore::cpuPeriod):
3410
3411 2018-06-25  Antoine Quint  <graouts@apple.com>
3412
3413         [Web Animations] Make imported/mozilla/css-animations/test_animation-pausing.html pass reliably
3414         https://bugs.webkit.org/show_bug.cgi?id=183826
3415         <rdar://problem/40997412>
3416
3417         Reviewed by Dean Jackson.
3418
3419         The CSS Animations Level 2 specification defines that calling pause() on a CSSAnimation object is "sticky"
3420         until a call to play() is made, meaning that any changes to the running state via the CSS animation-play-state
3421         property is overridden by the stickiness of the pause() call. In this patch we add an m_stickyPaused flag which
3422         is set in API calls to pause() and play(). While this flag is true, changes to the animation-play-state property
3423         to the "running" value are ignored.
3424
3425         * animation/CSSAnimation.cpp:
3426         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
3427         (WebCore::CSSAnimation::bindingsPlay):
3428         (WebCore::CSSAnimation::bindingsPause):
3429         * animation/CSSAnimation.h:
3430
3431 2018-06-25  Antoine Quint  <graouts@apple.com>
3432
3433         [Web Animations] Ensure animations are updated prior to requestAnimationFrame callbacks
3434         https://bugs.webkit.org/show_bug.cgi?id=186997
3435         <rdar://problem/41419414>
3436
3437         Reviewed by Dean Jackson.
3438
3439         Some sub-tests of imported/mozilla/css-animations/test_animation-pausing.html clearly expect that animations
3440         would be resolved prior to firing a requestAnimationFrame() callback, as the HTML5 event loop mandates. But until
3441         now, both DocumentTimeline and ScriptedAnimationController would make calls to DisplayRefreshMonitorManager::scheduleAnimation()
3442         that were not coordinated and so the order in which the DocumentTimeline and ScriptedAnimationController callbacks
3443         were performed was not guaranteed.
3444
3445         In this patch we add a new DocumentAnimationScheduler class which is created by a Document to manage this specific
3446         situation. Now DocumentTimeline and ScriptedAnimationController use this supporting object instead of being their
3447         own DisplayRefreshMonitorClient and call scheduleWebAnimationsResolution() and scheduleScriptedAnimationResolution()
3448         respectively to indicate the need to schedule an animation through the DisplayRefreshMonitorManager to serve the specific
3449         needs of either, or both, classes. Then DocumentAnimationScheduler ensures that Web Animations resolution happens
3450         prior to requestAnimationFrame callbacks when both are scheduled.
3451
3452         In the future we should be able to move more code from DocumentTimeline and ScriptedAnimationController over to
3453         DocumentAnimationScheduler, such as support for throttling and using a timer-based fallback, but this patch provides
3454         the minimal functionality required to provide a sounder foundation.
3455
3456         * Modules/webvr/VRDisplay.cpp:
3457         (WebCore::VRDisplay::requestAnimationFrame):
3458         * Sources.txt:
3459         * WebCore.xcodeproj/project.pbxproj:
3460         * animation/DocumentAnimationScheduler.cpp: Added.
3461         (WebCore::DocumentAnimationScheduler::create):
3462         (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
3463         (WebCore::DocumentAnimationScheduler::detachFromDocument):
3464         (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
3465         (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
3466         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
3467         (WebCore::DocumentAnimationScheduler::windowScreenDidChange):
3468         (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):
3469         * animation/DocumentAnimationScheduler.h: Copied from Source/WebCore/animation/CSSAnimation.h.
3470         * animation/DocumentTimeline.cpp:
3471         (WebCore::DocumentTimeline::create):
3472         (WebCore::DocumentTimeline::DocumentTimeline):
3473         (WebCore::DocumentTimeline::scheduleAnimationResolution):
3474         (WebCore::DocumentTimeline::windowScreenDidChange): Deleted.
3475         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Deleted.