aa2f11dcd57355b4188b752ac9eb7ae2895e28ea
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-06-05  Per Arne Vollan  <pvollan@apple.com>
2
3         Move OpenGL display mask to screen data struct.
4         https://bugs.webkit.org/show_bug.cgi?id=186198
5         <rdar://problem/40724854>
6
7         Reviewed by Brent Fulgham.
8
9         Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since
10         it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be
11         resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each
12         display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes
13         the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host
14         window is available, the OpenGL display mask of the main display is used.
15
16         No new tests, since testing this requires two Web views in the same WebContent process, displayed on
17         two different monitors.
18
19         * html/HTMLCanvasElement.cpp:
20         (WebCore::HTMLCanvasElement::createImageBuffer const):
21         * platform/PlatformScreen.h:
22         * platform/ScreenProperties.h:
23         (WebCore::ScreenProperties::encode const):
24         (WebCore::ScreenProperties::decode):
25         (WebCore::ScreenData::encode const):
26         (WebCore::ScreenData::decode):
27         * platform/graphics/GraphicsContext3D.h:
28         * platform/graphics/ImageBuffer.cpp:
29         (WebCore::ImageBuffer::create):
30         * platform/graphics/ImageBuffer.h:
31         * platform/graphics/cg/ImageBufferCG.cpp:
32         (WebCore::ImageBuffer::createCompatibleBuffer):
33         (WebCore::ImageBuffer::ImageBuffer):
34         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
35         (WebCore::GraphicsContext3D::GraphicsContext3D):
36         (WebCore::GraphicsContext3D::allowOfflineRenderers const):
37         (WebCore::GraphicsContext3D::setOpenGLDisplayMask): Deleted.
38         (WebCore::GraphicsContext3D::getOpenGLDisplayMask): Deleted.
39         * platform/graphics/cocoa/IOSurface.h:
40         * platform/graphics/cocoa/IOSurface.mm:
41         (WebCore::IOSurface::ensurePlatformContext):
42         * platform/mac/PlatformScreenMac.mm:
43         (WebCore::screenProperties):
44         (WebCore::collectScreenProperties):
45         (WebCore::setScreenProperties):
46         (WebCore::screenData):
47         (WebCore::primaryOpenGLDisplayMask):
48         (WebCore::displayMaskForDisplay):
49         (WebCore::getScreenProperties):
50         (WebCore::screenIsMonochrome):
51         (WebCore::screenHasInvertedColors):
52         (WebCore::screenDepth):
53         (WebCore::screenDepthPerComponent):
54         (WebCore::screenRectForDisplay):
55         (WebCore::screenRect):
56         (WebCore::screenAvailableRect):
57         (WebCore::screenColorSpace):
58         (WebCore::screenSupportsExtendedColor):
59
60 2018-06-05  Jer Noble  <jer.noble@apple.com>
61
62         REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in
63         https://bugs.webkit.org/show_bug.cgi?id=186326
64         <rdar://problem/40778157>
65
66         Reviewed by Eric Carlson.
67
68         Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag.
69
70         * html/MediaElementSession.cpp:
71         (WebCore::MediaElementSession::visibilityChanged):
72         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
73
74 2018-06-05  Zalan Bujtas  <zalan@apple.com>
75
76         [LFC] Move inflow, replaced width and margin computation to a dedicated function.
77         https://bugs.webkit.org/show_bug.cgi?id=186327
78
79         Reviewed by Sam Weinig.
80
81         I was searching for the function inFlowReplacedWidthAndMargin() and there was none.
82
83         * layout/blockformatting/BlockFormattingContext.h:
84         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
85         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
86         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
87
88 2018-06-05  Zalan Bujtas  <zalan@apple.com>
89
90         [LFC] Add missing margins for inflow, non replaced block and replaced inline elements
91         https://bugs.webkit.org/show_bug.cgi?id=186332
92
93         Reviewed by Darin Adler.
94
95         * layout/FormattingContextGeometry.cpp:
96         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
97         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
98         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
99
100 2018-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
101
102         [macOS] Spelling errors in the middle of an inserted paragraph are not displayed
103         https://bugs.webkit.org/show_bug.cgi?id=185584
104         <rdar://problem/38676081>
105
106         Reviewed by Ryosuke Niwa.
107
108         Currently when typing, we only consider the range of adjacent words when determining where to place spelling
109         correction markers, even though we provide NSSpellChecker with the full context of the sentence (and get back
110         results encompassing the full range). In macOS Mojave, NSSpellChecker may now return spell checking results that
111         include correctly spelled words that are misused in the context of the sentence. This means that while typing a
112         sentence, a different part of the sentence may gain or lose spelling markers as a result.
113
114         To support this, WebKit needs to mark or unmark spelling corrections in the full range of the sentence whenever
115         a full word is typed (since the context of other words within the sentence may have changed, resulting in
116         different platform spellchecking results). In markMisspellingsAfterTypingToWord, we expand the spell checking
117         range past the adjacent words so that it encompasses the largest subrange of the full sentence that includes the
118         start of the typed word, and does not include any position that is under an element with `spellcheck=false`.
119
120         This guarantees that we don't erroneously place spelling document markers under elements where spellchecking is
121         disabled, while allowing for sentence retro corrections when spellchecking is enabled. However, this doesn't
122         handle the case where an element with spellchecking disabled lies between a sentence retro correction range and
123         the currently typed word. In the future, we could fix this by refactoring SpellCheckRequest to track a list of
124         non-contiguous spelling correction ranges — see the FIXME in markMisspellingsAfterTypingToWord for more detail.
125
126         Covered by 2 new layout tests, as well as an existing spell-checking test that should now be passing.
127
128         Tests: editing/spelling/retro-correction-spelling-markers.html
129                editing/spelling/spelling-markers-after-pasting-sentence.html
130
131         * editing/Editor.cpp:
132         (WebCore::Editor::markMisspellingsAfterTypingToWord):
133         * testing/Internals.h:
134         * testing/Internals.idl:
135
136         Add an internal testing helper to determine whether retro sentence corrections are enabled.
137
138 2018-06-05  Darin Adler  <darin@apple.com>
139
140         [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
141         https://bugs.webkit.org/show_bug.cgi?id=186324
142
143         Reviewed by Anders Carlsson.
144
145         * platform/FileMonitor.h: Use OSObjectPtr instead of DispatchPtr.
146         * platform/cocoa/FileMonitorCocoa.mm:
147         (WebCore::FileMonitor::FileMonitor): Ditto.
148
149 2018-06-05  Ryan Haddad  <ryanhaddad@apple.com>
150
151         Unreviewed, fix the macOS build with recent SDKs.
152
153         * page/mac/ServicesOverlayController.mm:
154         (WebCore::ServicesOverlayController::Highlight::paintContents):
155
156 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
157
158         Adjust compile and runtime flags to match shippable state of features
159         https://bugs.webkit.org/show_bug.cgi?id=186319
160         <rdar://problem/40352045>
161
162         Reviewed by Maciej Stachowiak, Jon Lee, and others.
163
164         * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR
165         or ENABLE_INPUT_TYPE_COLOR_POPOVER.
166
167 2018-06-05  Timothy Hatcher  <timothy@apple.com>
168
169         Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query
170
171         https://bugs.webkit.org/show_bug.cgi?id=186323
172         rdar://problem/38382252
173
174         Reviewed by Tim Horton.
175
176         * css/MediaFeatureNames.h:
177         * css/MediaQueryEvaluator.cpp:
178         (WebCore::prefersDarkInterfaceEvaluate):
179         (WebCore::defaultAppearanceEvaluate): Deleted.
180         * css/MediaQueryExpression.cpp:
181         (WebCore::featureWithValidIdent):
182         (WebCore::isFeatureValidWithoutValue):
183         * platform/mac/LocalDefaultSystemAppearance.mm:
184         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
185
186 2018-06-05  Darin Adler  <darin@apple.com>
187
188         [Cocoa] Improve some soft linking compatibility with ARC
189         https://bugs.webkit.org/show_bug.cgi?id=186309
190
191         Reviewed by Anders Carlsson.
192
193         * platform/audio/ios/AudioSessionIOS.mm: Use SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER
194         for NSString constants.
195         * platform/audio/ios/MediaSessionManagerIOS.mm: Ditto.
196         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: Ditto.
197         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Ditto.
198         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm: Ditto.
199         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
200         (WebCore::MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState): Use __bridge for
201         some bridging casts.
202         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto.
203         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto.
204         (WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Ditto.
205         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: Use
206         SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER for NSString constants.
207         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Ditto.
208         * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto.
209         * platform/mediastream/mac/AVMediaCaptureSource.mm: Ditto.
210         * platform/mediastream/mac/AVVideoCaptureSource.mm: Ditto.
211
212 2018-06-05  Youenn Fablet  <youenn@apple.com>
213
214         ServiceWorker registration should store any script fetched through importScripts
215         https://bugs.webkit.org/show_bug.cgi?id=182444
216         <rdar://problem/37164835>
217
218         Reviewed by Chris Dumez.
219
220         Covered by added test http/wpt/service-workers/persistent-importScripts.html.
221
222         Update importScripts implementation to look for/update the resource map in case of service worker scope.
223         This resource map is stored persistently and sent when running the service worker.
224
225         Add support to persistent storage of this resource map.
226         This requires updating the schema database.
227         The schema version is bumped to 2 and we delete any data related to old registrations.
228
229         When updating the service worker, the resource map is currently flushed so that all scripts will be retrieved from the network.
230
231         Did some limited refactoring to put more loading handling in WorkerScriptLoader.
232
233         * workers/WorkerGlobalScope.cpp:
234         (WebCore::WorkerGlobalScope::importScripts):
235         * workers/WorkerScriptLoader.cpp:
236         (WebCore::WorkerScriptLoader::loadSynchronously):
237         (WebCore::WorkerScriptLoader::script):
238         * workers/WorkerScriptLoader.h:
239         * workers/service/ServiceWorkerContextData.cpp:
240         (WebCore::ServiceWorkerContextData::isolatedCopy const):
241         * workers/service/ServiceWorkerContextData.h:
242         (WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
243         (WebCore::ServiceWorkerContextData::ImportedScript::encode const):
244         (WebCore::ServiceWorkerContextData::ImportedScript::decode):
245         (WebCore::ServiceWorkerContextData::encode const):
246         (WebCore::ServiceWorkerContextData::decode):
247         * workers/service/ServiceWorkerGlobalScope.cpp:
248         (WebCore::ServiceWorkerGlobalScope::scriptResource const):
249         (WebCore::ServiceWorkerGlobalScope::setScriptResource):
250         * workers/service/ServiceWorkerGlobalScope.h:
251         * workers/service/context/SWContextManager.h:
252         * workers/service/server/RegistrationDatabase.cpp:
253         (WebCore::v1RecordsTableSchema):
254         (WebCore::RegistrationDatabase::doPushChanges):
255         (WebCore::RegistrationDatabase::importRecords):
256         * workers/service/server/SWServer.cpp:
257         (WebCore::SWServer::addRegistrationFromStore):
258         (WebCore::SWServer::updateWorker):
259         (WebCore::SWServer::installContextData):
260         * workers/service/server/SWServer.h:
261         * workers/service/server/SWServerJobQueue.cpp:
262         (WebCore::SWServerJobQueue::scriptFetchFinished):
263         * workers/service/server/SWServerToContextConnection.cpp:
264         (WebCore::SWServerToContextConnection::setScriptResource):
265         * workers/service/server/SWServerToContextConnection.h:
266         * workers/service/server/SWServerWorker.cpp:
267         (WebCore::SWServerWorker::SWServerWorker):
268         (WebCore::m_scriptResourceMap):
269         (WebCore::SWServerWorker::contextData const):
270         (WebCore::SWServerWorker::setScriptResource):
271         * workers/service/server/SWServerWorker.h:
272
273 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
274
275         Revise DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to work properly on Apple builds
276         https://bugs.webkit.org/show_bug.cgi?id=186286
277         <rdar://problem/40782992>
278
279         Reviewed by Dan Bernstein.
280
281         Use the WK_RELOCATABLE_FRAMEWORKS flag (which is always defined for non-production builds)
282         to define ENABLE(EXPERIMENTAL_FEATURES) so that we do not need to manually
283         change this flag when preparing for a production release.
284
285         * Configurations/FeatureDefines.xcconfig: Use WK_RELOCATABLE_FRAMEWORKS to determine
286         whether experimental features should be enabled, and use it to properly define the
287         feature flag.
288
289 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
290
291         Unreviewed build fix after r232511.
292         https://bugs.webkit.org/show_bug.cgi?id=186304
293
294         * platform/ios/WebItemProviderPasteboard.mm: Add missing include.
295
296 2018-06-05  Antoine Quint  <graouts@apple.com>
297
298         Fix the iOS build after r232496
299         https://bugs.webkit.org/show_bug.cgi?id=186304
300
301         Reviewed by Brent Fulgham.
302
303         The changes in r232496 changed the InputType::element() signature from HTMLInputElement&
304         to HTMLInputElement* and some call sites did not expect that.
305
306         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
307         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
308         (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree):
309         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue):
310         (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
311         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent):
312         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent):
313         (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction):
314         (WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const):
315         * html/BaseDateAndTimeInputType.cpp:
316         (WebCore::BaseDateAndTimeInputType::setValueAsDate const):
317         (WebCore::BaseDateAndTimeInputType::valueAsDouble const):
318         (WebCore::BaseDateAndTimeInputType::setValueAsDecimal const):
319         (WebCore::BaseDateAndTimeInputType::typeMismatch const):
320         (WebCore::BaseDateAndTimeInputType::serializeWithComponents const):
321         (WebCore::BaseDateAndTimeInputType::localizeValue const):
322         (WebCore::BaseDateAndTimeInputType::visibleValue const):
323         (WebCore::BaseDateAndTimeInputType::valueMissing const):
324         (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
325         * html/DateInputType.cpp:
326         (WebCore::DateInputType::createStepRange const):
327         * html/DateTimeLocalInputType.cpp:
328         (WebCore::DateTimeLocalInputType::createStepRange const):
329         * html/MonthInputType.cpp:
330         (WebCore::MonthInputType::valueAsDate const):
331         (WebCore::MonthInputType::createStepRange const):
332         * html/TimeInputType.cpp:
333         (WebCore::TimeInputType::createStepRange const):
334         * html/WeekInputType.cpp:
335         (WebCore::WeekInputType::createStepRange const):
336
337 2018-06-03  Darin Adler  <darin@apple.com>
338
339         Simplify and remove some unused video element code (helpful for ARC-compatibility)
340         https://bugs.webkit.org/show_bug.cgi?id=186258
341
342         Reviewed by Daniel Bates.
343
344         My main mission was to remove the PlatformMedia struct, which had a union
345         of Objective-C object pointers in it, which doesn't work in ARC. However, I
346         found some other unused code to remove and simple mistakes to fix.
347
348         * Modules/mediasource/VideoPlaybackQuality.cpp:
349         (WebCore::VideoPlaybackQuality::create): Use unsigned instead of unsigned long,
350         since IDL "unsigned long" really means unsigned.
351         (WebCore::VideoPlaybackQuality::VideoPlaybackQuality): Ditto.
352         * Modules/mediasource/VideoPlaybackQuality.h: Updated for the above.
353
354         * html/HTMLMediaElement.cpp:
355         (WebCore::HTMLMediaElement::platformMedia const): Deleted.
356         * html/HTMLMediaElement.h: Updated for the above.
357
358         * platform/graphics/MediaPlayer.cpp:
359         (WebCore::MediaPlayer::MediaPlayer): Moved initialization of many data members
360         to the class definition.
361         (WebCore::MediaPlayer::load): Use nullptr instead of 0.
362         (WebCore::MediaPlayer::platformMedia const): Deleted.
363         (WebCore::MediaPlayer::videoPlaybackQualityMetrics): Updated name of return type.
364         (WebCore::MediaPlayer::objCAVFoundationAVPlayer const): Added. Replaces
365         platformMedia for the one case where it was being used.
366         * platform/graphics/MediaPlayer.h: Removed unneeded includes. Re-sorted things.
367         Updated for the above. Removed PlatformMedia struct and NoPlatformMedia constant.
368         Removed explicit constructor in MediaEngineSupportParameters. Renamed
369         PlatformVideoPlaybackQualityMetrics struct to VideoPlaybackQualityMetrics,
370         removed its constructor, and changed types from unsigned long to unsigned.
371         Un-nested #if statements. Removed some Chromium-specific comments.
372
373         * platform/graphics/MediaPlayerPrivate.h: Removed unneeded includes and
374         forward declarations. Removed platformMedia. Updated return type for
375         videoPlaybackQualityMetrics. Added objCAVFoundationAVPlayer.
376
377         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
378         Removed platformMedia.
379
380         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
381         (WebCore::MediaPlayerPrivateAVFoundation::platformMedia const): Deleted.
382         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
383         Updated for the above.
384
385         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
386         Added override of objCAVFoundationAVPlayer. Removed platformMedia.
387         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
388         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const): Deleted.
389
390         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
391         Removed platformMedia. Updated return type for videoPlaybackQualityMetrics.
392         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
393         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformMedia const): Deleted.
394         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
395         Updated return type, changed to use aggregate initialization instead of
396         calling a constructor, and added casts to unsigned.
397
398         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Switched from
399         unsigned long to unsigned for frame counts and from long to int for
400         quality of service tier.
401
402         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
403         (WebCore::MediaPlayerPrivateGStreamerBase::platformMedia): Deleted.
404         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
405         Updated for the above.
406
407         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
408         Removed videoPlaybackQualityMetrics since it was overriding a derived function
409         without changing its behavior, and the type has changed.
410
411         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
412         (WebCore::MockMediaPlayerMediaSource::load): Pass two references.
413         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
414         Updated return type.
415         * platform/mock/mediasource/MockMediaPlayerMediaSource.h: Updated for the above.
416
417         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
418         (WebCore::MockMediaSourcePrivate::create): Return a Ref, take references.
419         (WebCore::MockMediaSourcePrivate::MockMediaSourcePrivate): Moved most data
420         member initialization into the class definition. Take references.
421         (WebCore::MockMediaSourcePrivate::~MockMediaSourcePrivate): Use a modern for loop.
422         (WebCore::MockMediaSourcePrivate::durationChanged): Update since m_player is a
423         reference.
424         (WebCore::MockMediaSourcePrivate::markEndOfStream): Ditto.
425         (WebCore::MockMediaSourcePrivate::readyState): Ditto.
426         (WebCore::MockMediaSourcePrivate::setReadyState): Ditto.
427         (WebCore::MockMediaSourcePrivate::waitForSeekCompleted): Ditto.
428         (WebCore::MockMediaSourcePrivate::seekCompleted): Ditto.
429         (WebCore::MockMediaSourcePrivate::removeSourceBuffer): Use Vector::removeFirst
430         instead of find/remove pairs.
431         (WebCore::MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState): Ditto.
432         (WebCore::MockMediaSourcePrivate::seekToTime): Use modern for loop.
433         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics): Updated return
434         type, changed to use aggregate initialization instead of calling a constructor.
435         * platform/mock/mediasource/MockMediaSourcePrivate.h: Updated for the above.
436
437         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
438         (WebCore::MockSourceBufferPrivate::readyState): Updated since player is now
439         a reference.
440         (WebCore::MockSourceBufferPrivate::setReadyState): Ditto.
441
442 2018-06-04  Darin Adler  <darin@apple.com>
443
444         [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr)
445         https://bugs.webkit.org/show_bug.cgi?id=186300
446
447         Reviewed by Daniel Bates.
448
449         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: Removed unnecessary
450         include of OSObjectPtr.h.
451         * platform/ios/WebItemProviderPasteboard.mm: Ditto.
452
453 2018-06-05  Joanmarie Diggs  <jdiggs@igalia.com>
454
455         AX: Implement support for new blockquote, caption, and paragraph ARIA roles
456         https://bugs.webkit.org/show_bug.cgi?id=186274
457
458         Reviewed by Chris Fleizach.
459
460         Add the three new ARIA roles to the internal rolemap so that they are treated in
461         the same fashion as their HTML element counterparts. Also ensure that an element
462         with an explicit caption role does not get pruned from the macOS accessibility tree.
463
464         No new tests. Instead add the roles to the existing role-exposure tests.
465
466         * accessibility/AccessibilityObject.cpp:
467         (WebCore::initializeRoleMap):
468         * accessibility/mac/AccessibilityObjectMac.mm:
469         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
470         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
471         (createAccessibilityRoleMap):
472
473 2018-06-05  Zalan Bujtas  <zalan@apple.com>
474
475         [LFC] Merge width and margin computation for block-level, replaced elements in normal flow
476         https://bugs.webkit.org/show_bug.cgi?id=186270
477
478         Reviewed by Sam Weinig.
479
480         https://www.w3.org/TR/CSS22/visudet.html#block-replaced-width
481         10.3.4 Block-level, replaced elements in normal flow
482
483         The used value of 'width' is determined as for inline replaced elements.
484         Then the rules for non-replaced block-level elements are applied to determine the margins.
485
486         * layout/blockformatting/BlockFormattingContext.h:
487         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
488         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
489         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
490
491 2018-06-04  Enrique Ocaña González  <eocanha@igalia.com>
492
493         [GStreamer][MSE] MediaPlayerPrivateGStreamerMSE.h includes and forward declares PlaybackPipeline
494         https://bugs.webkit.org/show_bug.cgi?id=186190
495
496         Reviewed by Xabier Rodriguez-Calvar.
497
498         This is just a compilation improvement.
499
500         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
501         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
502         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
503
504 2018-06-03  Darin Adler  <darin@apple.com>
505
506         [Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption
507         https://bugs.webkit.org/show_bug.cgi?id=186245
508
509         Reviewed by Daniel Bates.
510
511         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
512         (convertToNSArray): Explicitly cast to WebAccessibilityObjectWrapperBase so we don't
513         make method calls on WebAccessibilityObjectWrapper, a forward-declared class.
514         (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Use CFAutorelease
515         for the CGPathRef return value instead of Objective-C autorelease. Another option
516         would be to use RetainPtr for the return type instead.
517
518         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
519         (AXObjectIsTextMarker): Use __bridge for bridging typecast.
520         (AXObjectIsTextMarkerRange): Ditto.
521         (AXTextMarkerRange): Ditto.
522         (AXTextMarkerRangeStart): Ditto.
523         (AXTextMarkerRangeEnd): Ditto.
524         (isTextMarkerIgnored): Ditto.
525         (accessibilityObjectForTextMarker): Ditto.
526         (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): Ditto.
527         (-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]): Ditto.
528         (visiblePositionForStartOfTextMarkerRange): Ditto.
529         (visiblePositionForEndOfTextMarkerRange): Ditto.
530         (AXAttributeStringSetFont): Ditto. Also use @{} syntax to make NSDictionary
531         and @() to make NSNumber.
532         (AXAttributeStringSetColor): Use __bridge for bridging typecast, rearranging
533         code so that the typecasts are on function arguments, not local variables,
534         which makes lifetimes clearer.
535         (AXAttributeStringSetElement): Use __bridge for bridging typecast.
536         (WebTransformCGPathToNSBezierPath):
537         (-[WebAccessibilityObjectWrapper bezierPathFromPath:]): Added a bridging
538         typecast when passing an NSBezierPath through as a void* context argument;
539         silent conversion to void* is not compatible with ARC.
540         (createAccessibilityRoleMap): Use __unsafe_unretained for a table of
541         NSString constants.
542
543         * bindings/js/ScriptControllerMac.mm:
544         (WebCore::ScriptController::createScriptInstanceForWidget): Use __bridge
545         for bridging typecast.
546
547         * bridge/objc/objc_class.mm:
548         (JSC::Bindings::ObjcClass::classForIsA): Added bridging typecasts
549         to convert a Class into a CFTypeRef.
550         (JSC::Bindings::ObjcClass::methodNamed const): Use __bridge for bridging
551         typecast.
552         (JSC::Bindings::ObjcClass::fieldNamed const): Ditto.
553         * bridge/objc/objc_instance.mm:
554         (ObjcInstance::invokeObjcMethod): Ditto.
555         * bridge/objc/objc_runtime.mm:
556         (JSC::Bindings::ObjcField::valueFromInstance const): Ditto.
557         (JSC::Bindings::ObjcField::setValueToInstance const): Ditto.
558         * bridge/objc/objc_utility.mm:
559         (JSC::Bindings::convertObjcValueToValue): Ditto. Also add a missing const
560         to make it clearer to the compiler that the code is correct.
561         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
562         (WebCore::createAndStoreMasterKey): Ditto.
563         (WebCore::findMasterKey): Ditto.
564         * editing/cocoa/DataDetection.mm:
565         (WebCore::detectItemAtPositionWithRange): Ditto.
566         * editing/cocoa/EditorCocoa.mm:
567         (WebCore::Editor::fontAttributesForSelectionStart const): Ditto.
568         * editing/cocoa/HTMLConverter.mm:
569         (_font): Ditto.
570         (fileWrapperForElement): Ditto.
571         * fileapi/FileCocoa.mm:
572         (WebCore::File::shouldReplaceFile): Ditto.
573         * loader/archive/cf/LegacyWebArchiveMac.mm:
574         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Ditto.
575         * page/mac/TextIndicatorWindow.mm:
576         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Ditto.
577         (createContentCrossfadeAnimation): Ditto.
578         * platform/cocoa/LocalizedStringsCocoa.mm:
579         (WebCore::localizedString): Ditto.
580         * platform/cocoa/SharedBufferCocoa.mm:
581         (WebCore::SharedBuffer::create): Ditto.
582         (WebCore::SharedBuffer::append): Ditto.
583         * platform/graphics/FontPlatformData.h:
584         (WebCore::toCTFont): Ditto.
585         (WebCore::toNSFont): Ditto.
586         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
587         (WebCore::assetTrackMeetsHardwareDecodeRequirements): Ditto.
588         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
589         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Ditto.
590         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
591         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Ditto.
592         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
593         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Ditto.
594         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
595         (WebCore::MediaDescriptionAVFObjC::MediaDescriptionAVFObjC): Ditto.
596         (WebCore::bufferWasConsumedCallback): Ditto.
597         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
598         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
599         (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): Ditto.
600         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): Ditto.
601         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
602         (PlatformCALayerCocoa::create): Ditto.
603         (PlatformCALayer::platformCALayer): Ditto.
604         (PlatformCALayerCocoa::superlayer const): Ditto.
605         (PlatformCALayerCocoa::contents const): Ditto.
606         (PlatformCALayerCocoa::setContents): Ditto.
607         * platform/graphics/cocoa/IOSurface.h: Ditto.
608         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
609         (TextTrackRepresentationCocoa::update): Ditto.
610         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
611         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): Ditto.
612         (WebCore::WebCoreDecompressionSession::resetQosTier): Ditto.
613         * platform/graphics/cocoa/WebGLLayer.mm:
614         (-[WebGLLayer display]): Ditto.
615         * platform/graphics/mac/ImageMac.mm:
616         (WebCore::BitmapImage::nsImage): Ditto.
617         (WebCore::BitmapImage::snapshotNSImage): Ditto.
618         * platform/graphics/mac/WebLayer.mm:
619         (-[WebLayer drawInContext:]): Ditto.
620         (-[WebSimpleLayer setNeedsDisplay]): Ditto.
621         (-[WebSimpleLayer setNeedsDisplayInRect:]): Ditto.
622         (-[WebSimpleLayer display]): Ditto.
623         (-[WebSimpleLayer drawInContext:]): Ditto.
624
625         * platform/mac/CursorMac.mm:
626         (WebCore::cursor): Mark pointer __strong to match the globals it points to.
627
628         * platform/mac/FileSystemMac.mm:
629         (WebCore::FileSystem::setMetadataURL): Use RetainPtr instead of autorelease.
630
631         * platform/mac/PlatformPasteboardMac.mm:
632         (WebCore::PlatformPasteboard::bufferForType): Use __bridge for bridging
633         typecast.
634         * platform/mac/PlatformSpeechSynthesizerMac.mm:
635         (WebCore::speechSynthesisGetVoiceIdentifiers): Ditto.
636         (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale): Ditto.
637
638         * platform/mac/PluginBlacklist.h: Use RetainPtr instead of explicit retain
639         and release for NSDictionary and NSSet.
640         * platform/mac/PluginBlacklist.mm:
641         (WebCore::PluginBlacklist::create): Use __bridge for bridging typecast.
642         (WebCore::PluginBlacklist::~PluginBlacklist): Remove explicit CFRelease calls.
643         (WebCore::PluginBlacklist::PluginBlacklist): Add adoptNS calls and remove
644         explciit CFRetain/release pairs.
645
646         * platform/mac/PublicSuffixMac.mm:
647         (WebCore::isPublicSuffix): Use __bridge for bridging typecast.
648         * platform/mac/RemoteCommandListenerMac.mm:
649         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto.
650         * platform/mac/SerializedPlatformRepresentationMac.mm:
651         (WebCore::jsValueWithDictionaryInContext): Ditto.
652         * platform/mac/URLMac.mm:
653         (WebCore::URL::URL): Ditto.
654         (WebCore::URL::createCFURL const): Ditto.
655
656         * platform/mac/WebCoreNSURLExtras.mm:
657         (WebCore::collectRangesThatNeedMapping): Mark pointer __strong to match the
658         local variable it eventually points to.
659         (WebCore::stringByTrimmingWhitespace): Use __bridge for bridging typecast.
660         (WebCore::URLByTruncatingOneCharacterBeforeComponent): Use
661         CFBridgingRelease instead of autorelease, reducing typecasts.
662         (WebCore::URLByRemovingComponentAndSubsequentCharacter): Ditto.
663         (WebCore::userVisibleString): Use __bridge for bridging typecast.
664         (WebCore::isUserVisibleURL): Ditto.
665
666         * platform/mac/WebGLBlacklist.mm:
667         (WebCore::WebGLBlacklist::create): Use __bridge for bridging typecast.
668         * platform/mediastream/mac/AVVideoCaptureSource.mm:
669         (WebCore::AVVideoCaptureSource::setPreset): Ditto.
670         (WebCore::AVVideoCaptureSource::setupCaptureSession): Ditto. Also use @()
671         instead of NSNumber.
672         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
673         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Ditto.
674         * platform/network/cocoa/ResourceRequestCocoa.mm:
675         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): Ditto.
676
677         * platform/network/cocoa/ResourceResponseCocoa.mm: Use CFStringRef and
678         CFSTR for constant string array commonHeaderFields rather than using
679         NSString * and then relying on implicit bridging conversion.
680
681         * platform/network/mac/CertificateInfoMac.mm:
682         (WebCore::CertificateInfo::dump const): Use __bridge for bridging typecast.
683         * platform/network/mac/FormDataStreamMac.mm:
684         (WebCore::createHTTPBodyNSInputStream): Ditto.
685         (WebCore::httpBodyFromStream): Ditto.
686         * platform/network/mac/ResourceErrorMac.mm:
687         (WebCore::ResourceError::ResourceError): Ditto.
688         (WebCore::ResourceError::cfError const): Ditto.
689
690         * rendering/RenderThemeMac.mm:
691         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
692         Use CFSTR("") instead of @"" for a string that is passed to CFDIctionaryRef.
693         (WebCore::AttachmentLayout::layOutTitle): Use __bridge for bridging typecast.
694         (WebCore::AttachmentLayout::layOutSubtitle): Ditto.
695
696         * testing/cocoa/WebArchiveDumpSupport.mm:
697         (WebCoreTestSupport::createCFURLResponseFromResponseData): Use __bridge for
698         bridging typecast.
699         (WebCoreTestSupport::supportedNonImageMIMETypes): Deleted.
700         (WebCoreTestSupport::convertWebResourceDataToString): Use the
701         MIMETypeRegistry::isSupportedNonImageMIMEType function directly instead of
702         building a CFArray out of MIMETypeRegistry::getSupportedNonImageMIMETypes
703         and using CFArrayContainsValue. This is both much more direct and much more
704         efficient as well.
705
706 2018-06-04  Timothy Hatcher  <timothy@apple.com>
707
708         [Win] REGRESSION(r232486) 'WebCore::RenderTheme::activeListBoxSelectionBackgroundColor': function does not take 0 arguments
709         https://bugs.webkit.org/show_bug.cgi?id=186296
710
711         Unreviewed build fix.
712
713         * platform/win/PopupMenuWin.cpp:
714         (WebCore::PopupMenuWin::paint):
715         * rendering/RenderThemeWin.cpp:
716         (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
717
718 2018-06-04  Chris Dumez  <cdumez@apple.com>
719
720         Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy"
721         https://bugs.webkit.org/show_bug.cgi?id=186287
722         <rdar://problem/40783352>
723
724         Reviewed by Youenn Fablet.
725
726         Tests: http/wpt/cross-origin-window-policy/allow-postmessage-from-deny.html
727                http/wpt/cross-origin-window-policy/allow-postmessage.html
728                http/wpt/cross-origin-window-policy/cross-origin-window-policy-header.html
729                http/wpt/cross-origin-window-policy/navigation-from-opener-via-open-target.html
730                http/wpt/cross-origin-window-policy/navigation-from-subframe-via-anchor-target.html
731
732         * bindings/js/JSDOMBindingSecurity.cpp:
733         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginWindowPolicy):
734         * bindings/js/JSDOMBindingSecurity.h:
735         * bindings/js/JSDOMWindowCustom.cpp:
736         (WebCore::effectiveCrossOriginWindowPolicyForAccess):
737         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
738         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
739         (WebCore::addCrossOriginWindowPropertyNames):
740         (WebCore::addScopedChildrenIndexes):
741         * bindings/scripts/CodeGeneratorJS.pm:
742         (GenerateAttributeGetterBodyDefinition):
743         (GetCrossOriginsOptionsFromExtendedAttributeValue):
744         (GenerateAttributeSetterBodyDefinition):
745         (GenerateOperationBodyDefinition):
746         * bindings/scripts/IDLAttributes.json:
747         * dom/Document.cpp:
748         (WebCore::Document::canNavigate):
749         * loader/FrameLoader.cpp:
750         (WebCore::FrameLoader::didBeginDocument):
751         * page/AbstractDOMWindow.cpp:
752         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
753         * page/AbstractDOMWindow.h:
754         (WebCore::AbstractDOMWindow::crossOriginWindowPolicy):
755         (WebCore::AbstractDOMWindow::setCrossOriginWindowPolicy):
756         * page/DOMWindow.idl:
757         * page/Settings.yaml:
758         * platform/network/HTTPHeaderNames.in:
759         * platform/network/HTTPParsers.cpp:
760         (WebCore::parseCrossOriginWindowPolicyHeader):
761         * platform/network/HTTPParsers.h:
762
763 2018-06-04  Brent Fulgham  <bfulgham@apple.com>
764
765         REGRESSION(r231291): InputType should hold a WeakPtr to its HTMLInputElement
766         https://bugs.webkit.org/show_bug.cgi?id=186096
767         <rdar://problem/40651015>
768
769         Reviewed by Ryosuke Niwa.
770
771         Now that the InputType may be kept alive as part of in-flight form submissions, we
772         shouldn't assume that the referenced HTMLInputElement is still valid before using it.
773
774         The only time we should be lacking a referencing element is in cases where the InputType
775         is changing, either through a change in the HTMLInputElement's type attribute. In those
776         cases we should check for a valid HTMLInputElement. In other cases, we should ASSERT.
777
778         * html/BaseButtonInputType.cpp:
779         (WebCore::BaseButtonInputType::createInputRenderer):
780         (WebCore::BaseButtonInputType::setValue):
781         * html/BaseCheckableInputType.cpp:
782         (WebCore::BaseCheckableInputType::saveFormControlState const):
783         (WebCore::BaseCheckableInputType::restoreFormControlState):
784         (WebCore::BaseCheckableInputType::appendFormData const):
785         (WebCore::BaseCheckableInputType::handleKeydownEvent):
786         (WebCore::BaseCheckableInputType::accessKeyAction):
787         (WebCore::BaseCheckableInputType::setValue):
788         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
789         (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Add a nullptr check
790         here, since this is called directly by code that causes the old InputType to be removed,
791         which could leave us with a nullptr element().
792         * html/BaseClickableWithKeyInputType.cpp:
793         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent):
794         (WebCore::BaseClickableWithKeyInputType::handleKeypressEvent):
795         (WebCore::BaseClickableWithKeyInputType::accessKeyAction):
796         * html/BaseDateAndTimeInputType.cpp:
797         (WebCore::BaseDateAndTimeInputType::attributeChanged): Add a nullptr check
798         here, since this is called directly by code that causes the old InputType to be removed,
799         which could leave us with a nullptr element().
800         * html/BaseTextInputType.cpp:
801         (WebCore::BaseTextInputType::patternMismatch const):
802         * html/CheckboxInputType.cpp:
803         (WebCore::CheckboxInputType::valueMissing const):
804         (WebCore::CheckboxInputType::willDispatchClick):
805         (WebCore::CheckboxInputType::didDispatchClick):
806         (WebCore::CheckboxInputType::shouldAppearIndeterminate const):
807         * html/ColorInputType.cpp:
808         (WebCore::ColorInputType::valueAsColor const):
809         (WebCore::ColorInputType::createShadowSubtree):
810         (WebCore::ColorInputType::handleDOMActivateEvent):
811         (WebCore::ColorInputType::didChooseColor):
812         (WebCore::ColorInputType::updateColorSwatch):
813         (WebCore::ColorInputType::shadowColorSwatch const):
814         (WebCore::ColorInputType::elementRectRelativeToRootView const):
815         (WebCore::ColorInputType::shouldShowSuggestions const):
816         (WebCore::ColorInputType::suggestions const):
817         * html/EmailInputType.cpp:
818         (WebCore::EmailInputType::typeMismatchFor const):
819         (WebCore::EmailInputType::typeMismatch const):
820         (WebCore::EmailInputType::typeMismatchText const):
821         (WebCore::EmailInputType::sanitizeValue const):
822         * html/FileInputType.cpp:
823         (WebCore::FileInputType::appendFormData const):
824         (WebCore::FileInputType::attributeChanged): Add a nullptr check here, since
825         this is called directly by code that causes the old InputType to be removed,
826         which could leave us with a nullptr element().
827         (WebCore::FileInputType::valueMissing const):
828         (WebCore::FileInputType::valueMissingText const):
829         (WebCore::FileInputType::handleDOMActivateEvent):
830         (WebCore::FileInputType::createInputRenderer):
831         (WebCore::FileInputType::setValue):
832         (WebCore::FileInputType::createShadowSubtree):
833         (WebCore::FileInputType::disabledAttributeChanged):
834         (WebCore::FileInputType::multipleAttributeChanged):
835         (WebCore::FileInputType::allowsDirectories const):
836         (WebCore::FileInputType::setFiles):
837         (WebCore::FileInputType::iconLoaded):
838         (WebCore::FileInputType::receiveDroppedFiles):
839         (WebCore::FileInputType::defaultToolTip const):
840         * html/HTMLInputElement.h:
841         (WebCore::HTMLInputElement::weakPtrFactory const):
842         * html/HiddenInputType.cpp:
843         (WebCore::HiddenInputType::saveFormControlState const):
844         (WebCore::HiddenInputType::restoreFormControlState):
845         (WebCore::HiddenInputType::setValue):
846         (WebCore::HiddenInputType::appendFormData const):
847         * html/ImageInputType.cpp:
848         (WebCore::ImageInputType::appendFormData const):
849         (WebCore::ImageInputType::handleDOMActivateEvent):
850         (WebCore::ImageInputType::createInputRenderer):
851         (WebCore::ImageInputType::altAttributeChanged):
852         (WebCore::ImageInputType::srcAttributeChanged):
853         (WebCore::ImageInputType::attach):
854         (WebCore::ImageInputType::height const):
855         (WebCore::ImageInputType::width const):
856         * html/InputType.cpp:
857         (WebCore::InputType::saveFormControlState const):
858         (WebCore::InputType::restoreFormControlState):
859         (WebCore::InputType::isFormDataAppendable const):
860         (WebCore::InputType::appendFormData const):
861         (WebCore::InputType::sizeShouldIncludeDecoration const):
862         (WebCore::InputType::validationMessage const):
863         (WebCore::InputType::createInputRenderer):
864         (WebCore::InputType::blur):
865         (WebCore::InputType::destroyShadowSubtree):
866         (WebCore::InputType::dispatchSimulatedClickIfActive const):
867         (WebCore::InputType::chrome const):
868         (WebCore::InputType::isKeyboardFocusable const):
869         (WebCore::InputType::isMouseFocusable const):
870         (WebCore::InputType::accessKeyAction):
871         (WebCore::InputType::setValue):
872         (WebCore::InputType::visibleValue const):
873         (WebCore::InputType::applyStep):
874         (WebCore::InputType::stepUpFromRenderer):
875         * html/InputType.h:
876         (WebCore::InputType::InputType):
877         (WebCore::InputType::element const):
878         * html/NumberInputType.cpp:
879         (WebCore::NumberInputType::attributeChanged): Add a nullptr check here, since
880         this is called directly by code that causes the old InputType to be removed,
881         which could leave us with a nullptr element().
882         (WebCore::NumberInputType::setValue):
883         (WebCore::NumberInputType::valueAsDouble const):
884         (WebCore::NumberInputType::setValueAsDouble const):
885         (WebCore::NumberInputType::setValueAsDecimal const):
886         (WebCore::NumberInputType::typeMismatch const):
887         (WebCore::NumberInputType::createStepRange const):
888         (WebCore::NumberInputType::sizeShouldIncludeDecoration const):
889         (WebCore::NumberInputType::decorationWidth const):
890         (WebCore::NumberInputType::localizeValue const):
891         (WebCore::NumberInputType::visibleValue const):
892         (WebCore::NumberInputType::convertFromVisibleValue const):
893         (WebCore::NumberInputType::hasBadInput const):
894         (WebCore::NumberInputType::minOrMaxAttributeChanged):
895         (WebCore::NumberInputType::stepAttributeChanged):
896         * html/RadioInputType.cpp:
897         (WebCore::RadioInputType::valueMissing const):
898         (WebCore::RadioInputType::handleKeydownEvent):
899         (WebCore::RadioInputType::handleKeyupEvent):
900         (WebCore::RadioInputType::isKeyboardFocusable const):
901         (WebCore::RadioInputType::shouldSendChangeEventAfterCheckedChanged):
902         (WebCore::RadioInputType::willDispatchClick):
903         (WebCore::RadioInputType::didDispatchClick):
904         (WebCore::RadioInputType::matchesIndeterminatePseudoClass const):
905         * html/RangeInputType.cpp:
906         (WebCore::RangeInputType::attributeChanged): Add a nullptr check here, since
907         this is called directly by code that causes the old InputType to be removed,
908         which could leave us with a nullptr element().
909         (WebCore::RangeInputType::valueAsDouble const):
910         (WebCore::RangeInputType::setValueAsDecimal const):
911         (WebCore::RangeInputType::createStepRange const):
912         (WebCore::RangeInputType::handleMouseDownEvent):
913         (WebCore::RangeInputType::handleTouchEvent):
914         (WebCore::RangeInputType::handleKeydownEvent):
915         (WebCore::RangeInputType::createShadowSubtree):
916         (WebCore::RangeInputType::sliderTrackElement const):
917         (WebCore::RangeInputType::createInputRenderer):
918         (WebCore::RangeInputType::accessKeyAction):
919         (WebCore::RangeInputType::minOrMaxAttributeChanged):
920         (WebCore::RangeInputType::setValue):
921         (WebCore::RangeInputType::updateTickMarkValues):
922         * html/ResetInputType.cpp:
923         (WebCore::ResetInputType::handleDOMActivateEvent):
924         * html/SearchInputType.cpp:
925         (WebCore::SearchInputType::addSearchResult):
926         (WebCore::SearchInputType::maxResultsAttributeChanged):
927         (WebCore::SearchInputType::createInputRenderer):
928         (WebCore::SearchInputType::createShadowSubtree):
929         (WebCore::SearchInputType::handleKeydownEvent):
930         (WebCore::SearchInputType::startSearchEventTimer):
931         (WebCore::SearchInputType::searchEventTimerFired):
932         (WebCore::SearchInputType::searchEventsShouldBeDispatched const):
933         (WebCore::SearchInputType::didSetValueByUserEdit):
934         (WebCore::SearchInputType::sizeShouldIncludeDecoration const):
935         * html/SubmitInputType.cpp:
936         (WebCore::SubmitInputType::appendFormData const):
937         (WebCore::SubmitInputType::handleDOMActivateEvent):
938         * html/TextFieldInputType.cpp:
939         (WebCore::TextFieldInputType::attributeChanged): Add a nullptr check here, since
940         this is called directly by code that causes the old InputType to be removed,
941         which could leave us with a nullptr element().
942         (WebCore::TextFieldInputType::isKeyboardFocusable const):
943         (WebCore::TextFieldInputType::isMouseFocusable const):
944         (WebCore::TextFieldInputType::valueMissing const):
945         (WebCore::TextFieldInputType::setValue):
946         (WebCore::TextFieldInputType::handleKeydownEvent):
947         (WebCore::TextFieldInputType::handleKeydownEventForSpinButton):
948         (WebCore::TextFieldInputType::forwardEvent):
949         (WebCore::TextFieldInputType::elementDidBlur):
950         (WebCore::TextFieldInputType::handleFocusEvent):
951         (WebCore::TextFieldInputType::handleBlurEvent):
952         (WebCore::TextFieldInputType::createInputRenderer):
953         (WebCore::TextFieldInputType::shouldHaveSpinButton const):
954         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator const):
955         (WebCore::TextFieldInputType::createShadowSubtree):
956         (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent):
957         (WebCore::TextFieldInputType::updatePlaceholderText):
958         (WebCore::TextFieldInputType::appendFormData const):
959         (WebCore::TextFieldInputType::subtreeHasChanged):
960         (WebCore::TextFieldInputType::didSetValueByUserEdit):
961         (WebCore::TextFieldInputType::updateInnerTextValue):
962         (WebCore::TextFieldInputType::focusAndSelectSpinButtonOwner):
963         (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents):
964         (WebCore::TextFieldInputType::shouldSpinButtonRespondToWheelEvents):
965         (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const):
966         (WebCore::TextFieldInputType::shouldDrawAutoFillButton const):
967         (WebCore::TextFieldInputType::autoFillButtonElementWasClicked):
968         (WebCore::TextFieldInputType::createContainer):
969         (WebCore::TextFieldInputType::createAutoFillButton):
970         (WebCore::TextFieldInputType::updateAutoFillButton):
971         * html/URLInputType.cpp:
972         (WebCore::URLInputType::typeMismatch const):
973
974 2018-06-04  Chris Dumez  <cdumez@apple.com>
975
976         Unreviewed iOS build fix with recent SDKs.
977
978         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
979         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
980
981 2018-06-04  Dean Jackson  <dino@apple.com>
982
983         AR Badging on transparent thumbnail images makes the glyph look really dark
984         https://bugs.webkit.org/show_bug.cgi?id=186289
985         <rdar://problem/40627111>
986
987         Reviewed by Anders Carlsson.
988
989         Clip out the shape for the drop shadow, so that it isn't visible if
990         there is transparent pixel data on top of it.
991
992         * rendering/RenderThemeIOS.mm:
993         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
994
995 2018-06-04  Timothy Hatcher  <timothy@apple.com>
996
997         Selection color is dark when using Safari in dark mode.
998
999         https://bugs.webkit.org/show_bug.cgi?id=186288
1000         rdar://problem/38438625
1001
1002         Reviewed by Simon Fraser.
1003
1004         Pass StyleColor::Options to all of the selection color functions.
1005         Removed supportsSelectionForegroundColors() from RenderThemeMac,
1006         to get the default of true, since the forground colors in dark mode
1007         can be different now. Use new semantic color methods on NSColor.
1008
1009         * rendering/RenderElement.cpp:
1010         (WebCore::RenderElement::selectionColor const):
1011         (WebCore::RenderElement::selectionBackgroundColor const):
1012         * rendering/RenderListBox.cpp:
1013         (WebCore::RenderListBox::paintItemForeground):
1014         (WebCore::RenderListBox::paintItemBackground):
1015         * rendering/RenderTheme.cpp:
1016         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
1017         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
1018         (WebCore::RenderTheme::activeSelectionForegroundColor const):
1019         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
1020         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
1021         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
1022         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
1023         (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
1024         (WebCore::RenderTheme::platformActiveSelectionForegroundColor const):
1025         (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
1026         (WebCore::RenderTheme::platformInactiveSelectionForegroundColor const):
1027         (WebCore::RenderTheme::platformActiveListBoxSelectionBackgroundColor const):
1028         (WebCore::RenderTheme::platformActiveListBoxSelectionForegroundColor const):
1029         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
1030         (WebCore::RenderTheme::platformInactiveListBoxSelectionForegroundColor const):
1031         * rendering/RenderTheme.h:
1032         * rendering/RenderThemeGtk.cpp:
1033         (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor const):
1034         (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor const):
1035         (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor const):
1036         (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor const):
1037         (WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor const):
1038         (WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor const):
1039         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor const):
1040         * rendering/RenderThemeGtk.h:
1041         * rendering/RenderThemeIOS.h:
1042         * rendering/RenderThemeIOS.mm:
1043         (WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const):
1044         (WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const):
1045         * rendering/RenderThemeMac.h:
1046         * rendering/RenderThemeMac.mm:
1047         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
1048         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
1049         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
1050         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1051         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
1052         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1053         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
1054         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
1055         * rendering/RenderThemeWin.cpp:
1056         (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
1057         (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
1058         (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
1059         (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const):
1060         * rendering/RenderThemeWin.h:
1061
1062 2018-06-04  Chris Dumez  <cdumez@apple.com>
1063
1064         Update Fetch code to provide more useful exception messages
1065         https://bugs.webkit.org/show_bug.cgi?id=186156
1066
1067         Reviewed by Youenn Fablet.
1068
1069         Provide more useful error messages in our Loading / Fetch code.
1070
1071         * Modules/fetch/FetchBodyOwner.cpp:
1072         (WebCore::FetchBodyOwner::arrayBuffer):
1073         (WebCore::FetchBodyOwner::blob):
1074         (WebCore::FetchBodyOwner::consumeOnceLoadingFinished):
1075         (WebCore::FetchBodyOwner::formData):
1076         (WebCore::FetchBodyOwner::json):
1077         (WebCore::FetchBodyOwner::text):
1078         * Modules/fetch/FetchHeaders.cpp:
1079         (WebCore::canWriteHeader):
1080         (WebCore::FetchHeaders::get const):
1081         (WebCore::FetchHeaders::has const):
1082         * Modules/fetch/FetchRequest.cpp:
1083         (WebCore::FetchRequest::setBody):
1084         (WebCore::FetchRequest::clone):
1085         * Modules/fetch/FetchResponse.cpp:
1086         (WebCore::FetchResponse::redirect):
1087         (WebCore::FetchResponse::clone):
1088         * workers/service/context/ServiceWorkerFetch.cpp:
1089         (WebCore::ServiceWorkerFetch::processResponse):
1090         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1091         * workers/service/context/ServiceWorkerFetch.h:
1092
1093 2018-06-04  Daniel Bates  <dabates@apple.com>
1094
1095         Update Strong Password appearance
1096         https://bugs.webkit.org/show_bug.cgi?id=186239
1097         <rdar://problem/38183795>
1098
1099         Reviewed by Brent Fulgham.
1100
1101         Fix up the gradient mask to start half-way through the visible text and size it to the
1102         width of the visible text. Also change the color of the Strong Password label to 80% black.
1103
1104         We achieve sizing of the gradient to the width of the visible text by changing the CSS display
1105         of the inner text element to be an inline-block and specifying "max-width: 100%" so that
1106         its maximum width is less than or equal to the width of its containing block. Additionally,
1107         only apply strong password-specific inner text element styles when the field is not disabled
1108         or read-only and has a strong password appearance. Otherwise these styles, specifically the
1109         display type, will adversely effect rendering of the text when the field is disabled or readonly.
1110
1111         * css/html.css:
1112         (input::-webkit-strong-password-auto-fill-button):
1113         * html/HTMLInputElement.cpp:
1114         (WebCore::autoFillStrongPasswordMaskImage):
1115         (WebCore::HTMLInputElement::createInnerTextStyle):
1116
1117 2018-06-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1118
1119         [WebKit on watchOS] Remove all uses of the EXTRA_ZOOM_MODE compiler flag
1120         https://bugs.webkit.org/show_bug.cgi?id=186279
1121
1122         Reviewed by Tim Horton.
1123
1124         Replaces uses of ENABLE(EXTRA_ZOOM_MODE) with PLATFORM(WATCHOS). No change in behavior.
1125
1126         * Modules/mediacontrols/MediaControlsHost.cpp:
1127         (WebCore::MediaControlsHost::compactMode const):
1128         * html/HTMLMediaElement.cpp:
1129         (WebCore::HTMLMediaElement::updatePlayState):
1130         * page/Page.cpp:
1131         (WebCore::relevantViewRect):
1132         * page/SettingsBase.cpp:
1133         (WebCore::SettingsBase::defaultMinimumZoomFontSize):
1134         (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled):
1135         * page/ViewportConfiguration.cpp:
1136         (WebCore::platformDeviceWidthOverride):
1137         (WebCore::shouldOverrideShrinkToFitArgument):
1138         (WebCore::needsUpdateAfterChangingDisabledAdaptations):
1139         * platform/LocalizedStrings.cpp:
1140         * platform/LocalizedStrings.h:
1141         * platform/audio/ios/MediaSessionManagerIOS.mm:
1142         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
1143         (-[WebMediaSessionHelper dealloc]):
1144         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
1145         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1146         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1147         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
1148         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
1149         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1150         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
1151         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1152         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
1153         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
1154         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
1155         (-[WebAVPlayerViewController MY_NO_RETURN]):
1156         (-[WebAVPlayerViewController isPictureInPicturePossible]):
1157         (-[WebAVPlayerViewController isPictureInPictureActive]):
1158         (-[WebAVPlayerViewController pictureInPictureActive]):
1159         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
1160         (-[WebAVPlayerViewController showsPlaybackControls]):
1161         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
1162         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
1163         (-[WebAVPlayerViewController setDelegate:]):
1164         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1165         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1166         (VideoFullscreenInterfaceAVKit::doSetup):
1167         (WebCore::supportsPictureInPicture):
1168         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1169         (VideoFullscreenControllerContext::willExitFullscreen):
1170         * rendering/RenderThemeIOS.h:
1171         * rendering/RenderThemeIOS.mm:
1172
1173 2018-06-04  Youenn Fablet  <youenn@apple.com>
1174
1175         [WK1] Add an option to restrict communication to localhost sockets
1176         https://bugs.webkit.org/show_bug.cgi?id=186249
1177
1178         Reviewed by Eric Carlson.
1179
1180         Covered by existing tests.
1181         Set explicitly webrtc socket IP address to 127.0.0.1 in testing mode.
1182         For that purpose, we need WK1 to create a wrapper around a socket factory,
1183         this wrapper being responsible of setting or not the IP address to 127.0.0.1.
1184
1185         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1186         (WebCore::prepareSocketAddress):
1187         (WebCore::BasicPacketSocketFactory::BasicPacketSocketFactory):
1188         (WebCore::BasicPacketSocketFactory::setDisableNonLocalhostConnections):
1189         (WebCore::BasicPacketSocketFactory::CreateClientTcpSocket):
1190         (WebCore::LibWebRTCProvider::createPeerConnection):
1191         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1192
1193 2018-06-04  Zalan Bujtas  <zalan@apple.com>
1194
1195         [LFC] Merge width and margin computation for block-level, non-replaced and inline,replaced element in normal flow
1196         https://bugs.webkit.org/show_bug.cgi?id=186225
1197
1198         Reviewed by Antti Koivisto.
1199
1200         This patch merges the width and horizontal margin computation for
1201         https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width and https://www.w3.org/TR/CSS22/visudet.html#blockwidth
1202
1203         * layout/FormattingContextGeometry.cpp:
1204         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1205         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1206         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1207
1208 2018-06-01  Zalan Bujtas  <zalan@apple.com>
1209
1210         [LFC] Merge width and horizontal margin computation
1211         https://bugs.webkit.org/show_bug.cgi?id=186217
1212
1213         Reviewed by Antti Koivisto.
1214
1215         We could certainly compute width and maring separately, but to match each steps defined
1216         at https://www.w3.org/TR/CSS22/visudet.html, we should just merge width and horizontal margin computations
1217         (followed by height and vertical margins).
1218         Use 0 computed marings for now.
1219
1220         * layout/FormattingContext.cpp:
1221         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
1222         (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const):
1223         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
1224         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1225         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): Deleted.
1226         (WebCore::Layout::FormattingContext::computeFloatingWidth const): Deleted.
1227         * layout/FormattingContext.h:
1228         * layout/FormattingContextGeometry.cpp:
1229         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin):
1230         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin):
1231         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1232         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1233         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin):
1234         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1235         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1236         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1237         (WebCore::Layout::outOfFlowNonReplacedWidth): Deleted.
1238         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth): Deleted.
1239         (WebCore::Layout::floatingNonReplacedWidth): Deleted.
1240         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth): Deleted.
1241         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidth): Deleted.
1242         (WebCore::Layout::FormattingContext::Geometry::floatingWidth): Deleted.
1243         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth): Deleted.
1244         * layout/LayoutContext.cpp:
1245         (WebCore::Layout::LayoutContext::initializeRoot):
1246         * layout/blockformatting/BlockFormattingContext.cpp:
1247         (WebCore::Layout::BlockFormattingContext::layout const):
1248         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1249         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const):
1250         (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
1251         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): Deleted.
1252         (WebCore::Layout::BlockFormattingContext::computeMargin const): Deleted.
1253         * layout/blockformatting/BlockFormattingContext.h:
1254         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1255         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1256         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1257         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth): Deleted.
1258         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidth): Deleted.
1259         (WebCore::Layout::BlockFormattingContext::Geometry::computedMargin): Deleted.
1260         * layout/displaytree/DisplayBox.cpp:
1261         (WebCore::Display::Box::marginBox const):
1262         * layout/displaytree/DisplayBox.h:
1263         (WebCore::Display::Box::setHasValidVerticalMargin):
1264         (WebCore::Display::Box::setHasValidHorizontalMargin):
1265         (WebCore::Display::Box::invalidateMargin):
1266         (WebCore::Display::Box::setHorizontalMargin):
1267         (WebCore::Display::Box::setVerticalMargin):
1268         (WebCore::Display::Box::marginTop const):
1269         (WebCore::Display::Box::marginLeft const):
1270         (WebCore::Display::Box::marginBottom const):
1271         (WebCore::Display::Box::marginRight const):
1272         (WebCore::Display::Box::Edges::Edges): Deleted.
1273         (WebCore::Display::Box::setHasValidMargin): Deleted.
1274         (WebCore::Display::Box::setMargin): Deleted.
1275
1276 2018-06-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1277
1278         REGRESSION(r232338): [GTK] Broke a few layout tests
1279         https://bugs.webkit.org/show_bug.cgi?id=186244
1280
1281         Unreviewed, also rollout r232392.
1282
1283         * rendering/RenderTheme.cpp:
1284         (WebCore::RenderTheme::adjustStyle):
1285         * rendering/RenderTheme.h:
1286         (WebCore::RenderTheme::adjustListboxStyle const): Deleted.
1287         * rendering/RenderThemeGtk.cpp:
1288         (WebCore::RenderThemeGtk::adjustListboxStyle const): Deleted.
1289         * rendering/RenderThemeGtk.h:
1290
1291 2018-06-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1292
1293         REGRESSION(r232338): [GTK] Broke a few layout tests
1294         https://bugs.webkit.org/show_bug.cgi?id=186244
1295
1296         Unreviewed, rollout r232338.
1297
1298         * platform/gtk/RenderThemeGadget.cpp:
1299         (WebCore::RenderThemeGadget::RenderThemeGadget):
1300         (WebCore::baseStyleContext): Deleted.
1301         * rendering/RenderThemeGtk.cpp:
1302         (WebCore::RenderThemeGtk::adjustButtonStyle const):
1303         (WebCore::RenderThemeGtk::adjustTextFieldStyle const):
1304         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
1305         (WebCore::styleColor):
1306         (WebCore::RenderThemeGtk::adjustTextAreaStyle const): Deleted.
1307         * rendering/RenderThemeGtk.h:
1308
1309 2018-06-03  Eric Carlson  <eric.carlson@apple.com>
1310
1311         [iOS] MediaPlayer.framework is not always available
1312         https://bugs.webkit.org/show_bug.cgi?id=186220
1313         <rdar://problem/40571286>
1314
1315         Reviewed by Tim Horton.
1316
1317         * platform/ios/RemoteCommandListenerIOS.mm:
1318         (WebCore::RemoteCommandListener::create):
1319
1320 2018-06-02  Darin Adler  <darin@apple.com>
1321
1322         [Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption
1323         https://bugs.webkit.org/show_bug.cgi?id=186227
1324
1325         Reviewed by Dan Bernstein.
1326
1327         * bridge/objc/objc_instance.mm:
1328         (ObjcInstance::~ObjcInstance): Use @autoreleasepool instead of NSAutoreleasePool.
1329         * platform/ios/wak/WAKView.mm:
1330         (-[WAKView _appendDescriptionToString:atLevel:]): Ditto.
1331
1332 2018-06-03  Zan Dobersek  <zdobersek@igalia.com>
1333
1334         [WebGL] GL_EXT_robustness utilization should depend on CONTEXT_ROBUST_ACCESS value
1335         https://bugs.webkit.org/show_bug.cgi?id=186187
1336
1337         Reviewed by Carlos Garcia Campos.
1338
1339         Don't utilize the GL_EXT_robustness extension for reading pixels from
1340         the GPU if the underlying OpenGL context did not enable robust access
1341         support upon creation. For EGL contexts, this would be done by passing
1342         EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT and EGL_TRUE key-value pair in the
1343         attribute list passed to eglCreateContext() (as specified in the
1344         EGL_EXT_create_context_robustness extension), but at the moment this
1345         capability is not utilized.
1346
1347         As such, on drivers that implement GL_EXT_robustness support, pixel
1348         reads done in WebGLRenderingContextBase end up using glReadnPixels(),
1349         but that fails to successfully read anything due to the context
1350         rejecting such calls.
1351
1352         GL_EXT_robustness is specific to OpenGL ES versions, so to fix this,
1353         Extensions3DOpenGLES overrides the isEnabled() method. That override
1354         returns false immediately if the inherited isEnabled() implementation
1355         returns false. Otherwise it returns true, unless the tested extension
1356         is GL_EXT_robustness, in which case we now check that the context's
1357         CONTEXT_ROBUST_ACCESS state value is true, meaning the context was
1358         created with robust access support enabled.
1359
1360         No new tests are possible because this is optional driver-provided
1361         functionality that Web content cannot have effect on.
1362
1363         * platform/graphics/Extensions3D.h:
1364         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
1365         (WebCore::Extensions3DOpenGLES::isEnabled):
1366         * platform/graphics/opengl/Extensions3DOpenGLES.h:
1367
1368 2018-06-01  Ryosuke Niwa  <rniwa@webkit.org>
1369
1370         Editor can hold references to Documents after you navigate away
1371         https://bugs.webkit.org/show_bug.cgi?id=186215
1372
1373         Reviewed by Simon Fraser.
1374
1375         Clear the various member variables that can hold onto a document in Editor::clear and FrameSelection::prepareForDestruction.
1376
1377         Test: editing/selection/navigation-clears-editor-state.html
1378
1379         * editing/Editor.cpp:
1380         (WebCore::Editor::clear):
1381         * editing/Editor.h:
1382         * editing/FrameSelection.cpp:
1383         (WebCore::FrameSelection::FrameSelection):
1384         (WebCore::FrameSelection::prepareForDestruction):
1385         * editing/FrameSelection.h:
1386
1387 2018-06-01  Ryosuke Niwa  <rniwa@webkit.org>
1388
1389         ResourceLoader::cancel() shouldn't synchronously fire load event on document
1390         https://bugs.webkit.org/show_bug.cgi?id=185284
1391
1392         Revert the erroneous change to SSFontSelector::beginLoadTimerFired(), which broke CancelLoading.CancelFontSubresource.
1393         FrameLoader::loadDone calls checkCompleted, not checkLoadComplete so we still need to call checkLoadComplete here.
1394
1395         * css/CSSFontSelector.cpp:
1396         (WebCore::CSSFontSelector::beginLoadTimerFired): 
1397
1398 2018-06-01  Jeremy Jones  <jeremyj@apple.com>
1399
1400         Keyboard focus should exit fullscreen.
1401         https://bugs.webkit.org/show_bug.cgi?id=185617
1402         rdar://problem/34697938
1403
1404         Reviewed by Ryosuke Niwa.
1405
1406         No opensource test because feature is not enabled.
1407
1408         While in element fullscreen, initiating keyboard focus should exit fullscreen in iOS.
1409
1410         Improve fullscreen testability by exposing isAnimatingFullScreen.
1411
1412         * dom/Document.h:
1413         * testing/Internals.cpp:
1414         (WebCore::Internals::isAnimatingFullScreen const):
1415         * testing/Internals.h:
1416         * testing/Internals.idl:
1417
1418 2018-06-01  Jeremy Jones  <jeremyj@apple.com>
1419
1420         Don't continue playing in background when auto-picture-in-picture is disabled.
1421         https://bugs.webkit.org/show_bug.cgi?id=186089
1422         rdar://problem/40314314
1423
1424         Reviewed by Eric Carlson.
1425
1426         No new tests because we don't have a way to test auto-pip.
1427
1428         With the refactoring work done in VideoFullscreenInterfaceAVKit, HTMLMediaElement no longer has to anticipate 
1429         auto-pip when if it should pause on suspend. Instead VideoFullscreenInterfaceAVKit proactively updates 
1430         videoFullscreenMode, so checking for PIP is sufficient.
1431
1432         * html/HTMLMediaElement.cpp:
1433         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
1434
1435 2018-06-01  Chris Dumez  <cdumez@apple.com>
1436
1437         REGRESSION (r231456): Colloquy is broken
1438         https://bugs.webkit.org/show_bug.cgi?id=186197
1439         <rdar://problem/40722960>
1440
1441         Reviewed by Timothy Hatcher.
1442
1443         Restore pre-r231456 behavior for Colloquy app so that it works again.
1444
1445         * html/HTMLFrameElementBase.cpp:
1446         (WebCore::HTMLFrameElementBase::openURL):
1447         * page/Settings.yaml:
1448
1449 2018-06-01  Chris Dumez  <cdumez@apple.com>
1450
1451         Regression(r230567): Unable to log into twitter.com in private sessions
1452         https://bugs.webkit.org/show_bug.cgi?id=186205
1453         <rdar://problem/40670799>
1454
1455         Reviewed by Youenn Fablet.
1456
1457         We were using the same SWServer for all private sessions and the SWServer's sessionID would
1458         be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID()
1459         as well and would not match the sessionID of its client pages. This sessionID mismatch was
1460         causing the breakage.
1461
1462         Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
1463         per private session. However, we now make sure that the SWServer gets destroyed whenever its
1464         corresponding session gets destroyed.
1465
1466         * workers/service/server/SWServer.cpp:
1467         (WebCore::SWServer::~SWServer):
1468
1469 2018-06-01  Youenn Fablet  <youenn@apple.com>
1470
1471         Add an option to restrict communication to localhost sockets
1472         https://bugs.webkit.org/show_bug.cgi?id=186208
1473
1474         Reviewed by Eric Carlson.
1475
1476         Covered by existing tests.
1477         Add an option in LibWebRTCProvider to restrict to localhost sockets.
1478         Use that option when Internals is used.
1479
1480         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1481         * testing/Internals.cpp:
1482         (WebCore::Internals::resetToConsistentState):
1483
1484 2018-06-01  Ryosuke Niwa  <rniwa@webkit.org>
1485
1486         ResourceLoader::cancel() shouldn't synchronously fire load event on document
1487         https://bugs.webkit.org/show_bug.cgi?id=185284
1488
1489         Reviewed by Antti Koivisto.
1490
1491         Because a resource loading can be canceled as a node is removed a document or CachedResource is destructed,
1492         it's not safe to synchronously fire load event on document upon cancelation. This patch makes the cancellation
1493         of a resource load schedule m_checkTimer in FrameLoader to fire a load event asynchronously instead.
1494
1495         Specifically, this patch makes FrameLoader::loadDone call FrameLoader::scheduleCheckCompleted when the load
1496         had failed or cancled instead of calling FrameLoader::checkCompleted which can synchronously fire load event.
1497         To differentiate the two cases, new enum LoadCompletionType has been added to FrameLoader::loadDone and related
1498         functions. To avoid calling the navigation delegate too early, the same abstraction for checkLoadComplete()
1499         has been added in the form of FrameLoader::subresourceLoadDone.
1500
1501         Unfortunately, delaying calls to checkCompleted() and checkLoadComplete() by a timer can result in client
1502         callbacks such as didFinishLoadForFrame and didFailLoadWithError to never get called when the frame gets
1503         detached from the parent after the last resource had stopped loading but before the timer fires. To preserve
1504         these deleagte callbacks, this patch expedites the timer in FrameLoader::frameDetached and Page::goToItem by
1505         by invoking newly added stopAllLoadersAndCheckCompleteness, which stops all loading and then immediately invokes
1506         checkCompleted() and checkLoadComplete() synchronously if m_checkTimer had been started.
1507
1508         Tests: http/tests/preload/dynamic_removing_preload.html
1509
1510         * css/CSSFontSelector.cpp:
1511         (WebCore::CSSFontSelector::beginLoadTimerFired): Removed superfluous call to checkLoadComplete since
1512         cachedResourceLoader's loadDone would call checkLoadComplete anyway.
1513         * html/HTMLFrameOwnerElement.cpp:
1514         (WebCore::HTMLFrameOwnerElement::disconnectContentFrame): Removed the misleading comment added in r140090.
1515         Firefox DOES indeed fire unload event in the content document of a removed frame. While this comment made
1516         it sound like this function isn't called when a frame is removed from the tree when in reality we simply
1517         remove a frame prior to removing the node via disconnectSubframesIfNeeded.
1518         * loader/DocumentLoader.cpp:
1519         (WebCore::DocumentLoader::removeSubresourceLoader):
1520         * loader/DocumentLoader.h:
1521         * loader/FrameLoader.cpp:
1522         (WebCore::FrameLoader::FrameLoader):
1523         (WebCore::FrameLoader::loadDone):
1524         (WebCore::FrameLoader::subresourceLoadDone):
1525         (WebCore::FrameLoader::checkCompleted): Added a release assert that this function is only called when it's safe
1526         to execute scripts.
1527         (WebCore::FrameLoader::checkTimerFired):
1528         (WebCore::FrameLoader::checkCompletenessNow):Extracted from checkTimerFired.
1529         (WebCore::FrameLoader::stopAllLoaders): Removed the code to stop m_checkTimer introduced in r53655.
1530         Stopping the timer here would prevent FrameLoader::frameDetached to detect the case when stopping the loader
1531         scheduled a load completion check. Also stopping this timer without clearing the corresponding booleans:
1532         m_checkingLoadCompleteForDetachment and m_checkingLoadCompleteForDetachment is problematic. The assertion
1533         r53655 addressed is now addressed by explicitly checking & clearing the timer in frameDetached.
1534         (WebCore::FrameLoader::stopAllLoadersAndCheckCompleteness): Added.
1535         (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Avoid an early exit when the newly added boolean
1536         m_checkingLoadCompleteForDetachment is set since m_isStopping is no longer set in frameDetached in order
1537         to invoke didFailLoadWithError when detaching a frame.
1538         (WebCore::FrameLoader::frameDetached): Call checkCompletenessNow in the case the frame had already been
1539         completed loading. Also call stopAllLoadersAndCheckCompleteness in the case stopping loading would complete
1540         the loading before stopping active DOM objects.
1541         * loader/FrameLoader.h:
1542         (WebCore::FrameLoader::m_checkingLoadCompleteForDetachment): Added.
1543         * loader/FrameLoaderTypes.h:
1544         (WebCore::LoadCompletionType): Added.
1545         * loader/SubresourceLoader.cpp:
1546         (WebCore::SubresourceLoader::didFinishLoading):
1547         (WebCore::SubresourceLoader::didFail):
1548         (WebCore::SubresourceLoader::didCancel):
1549         (WebCore::SubresourceLoader::notifyDone):
1550         * loader/SubresourceLoader.h:
1551         * loader/cache/CachedResourceLoader.cpp:
1552         (WebCore::CachedResourceLoader::loadDone):
1553         * loader/cache/CachedResourceLoader.h:
1554         * page/Page.cpp:
1555         (WebCore::Page::goToItem): Call stopAllLoadersAndCheckCompleteness instead of stopAllLoaders since stopping
1556         loading here may complete loading.
1557
1558 2018-06-01  Sihui Liu  <sihui_liu@apple.com>
1559
1560         Stop using StorageTracker.db in LocalStorageDatabaseTracker
1561         https://bugs.webkit.org/show_bug.cgi?id=186104
1562
1563         Reviewed by Geoffrey Garen.
1564
1565         No behavior change.
1566
1567         * platform/sql/SQLiteFileSystem.h:
1568
1569 2018-06-01  Zalan Bujtas  <zalan@apple.com>
1570
1571         [LFC] Simplify the formatting class implementation by pushing down some of the logic to the Geometry class
1572         https://bugs.webkit.org/show_bug.cgi?id=186179
1573
1574         Reviewed by Antti Koivisto.
1575
1576         * layout/FormattingContext.cpp:
1577         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const):
1578         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
1579         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
1580         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
1581         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
1582         * layout/FormattingContext.h:
1583         * layout/FormattingContextGeometry.cpp:
1584         (WebCore::Layout::outOfFlowNonReplacedHeight):
1585         (WebCore::Layout::outOfFlowNonReplacedWidth):
1586         (WebCore::Layout::outOfFlowReplacedHeight):
1587         (WebCore::Layout::outOfFlowReplacedWidth):
1588         (WebCore::Layout::floatingNonReplacedHeight):
1589         (WebCore::Layout::floatingNonReplacedWidth):
1590         (WebCore::Layout::floatingReplacedHeight):
1591         (WebCore::Layout::floatingReplacedWidth):
1592         (WebCore::Layout::outOfFlowNonReplacedPosition):
1593         (WebCore::Layout::outOfFlowReplacedPosition):
1594         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeight):
1595         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidth):
1596         (WebCore::Layout::FormattingContext::Geometry::floatingHeight):
1597         (WebCore::Layout::FormattingContext::Geometry::floatingWidth):
1598         (WebCore::Layout::FormattingContext::Geometry::outOfFlowPosition):
1599         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight):
1600         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth):
1601         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeight): Deleted.
1602         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidth): Deleted.
1603         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): Deleted.
1604         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth): Deleted.
1605         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeight): Deleted.
1606         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidth): Deleted.
1607         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): Deleted.
1608         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth): Deleted.
1609         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedPosition): Deleted.
1610         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedPosition): Deleted.
1611         (WebCore::Layout::FormattingContext::Geometry::replacedHeight): Deleted.
1612         (WebCore::Layout::FormattingContext::Geometry::replacedWidth): Deleted.
1613         * layout/blockformatting/BlockFormattingContext.cpp:
1614         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
1615         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
1616         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
1617         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
1618         * layout/blockformatting/BlockFormattingContext.h:
1619         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1620         (WebCore::Layout::inFlowNonReplacedHeight):
1621         (WebCore::Layout::inFlowNonReplacedWidth):
1622         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeight):
1623         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidth):
1624         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): Deleted.
1625         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth): Deleted.
1626
1627 2018-06-01  Zalan Bujtas  <zalan@apple.com>
1628
1629         [LFC] Push FormattingContext::computeWidth/computeHeight logic from the base to the subclasses.
1630         https://bugs.webkit.org/show_bug.cgi?id=186172
1631
1632         Reviewed by Antti Koivisto.
1633
1634         FormattingContext::computeWidth/computeHeight virtual functions have very little benefit and in the long run
1635         it's better if we keep the number of virtual functions to the minimum necessary.
1636
1637         * layout/FormattingContext.cpp:
1638         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
1639         (WebCore::Layout::FormattingContext::computeStaticPosition const): Deleted.
1640         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const): Deleted.
1641         (WebCore::Layout::FormattingContext::computeWidth const): Deleted.
1642         (WebCore::Layout::FormattingContext::computeHeight const): Deleted.
1643         (WebCore::Layout::FormattingContext::computeMargin const): Deleted.
1644         * layout/FormattingContext.h:
1645         * layout/FormattingContextGeometry.cpp:
1646         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight):
1647         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth):
1648         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight):
1649         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth):
1650         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight):
1651         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth):
1652         (WebCore::Layout::FormattingContext::Geometry::replacedHeight): Deleted.
1653         (WebCore::Layout::FormattingContext::Geometry::replacedWidth): Deleted.
1654         * layout/blockformatting/BlockFormattingContext.cpp:
1655         (WebCore::Layout::BlockFormattingContext::computeWidth const):
1656         (WebCore::Layout::BlockFormattingContext::computeHeight const):
1657         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
1658         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
1659         * layout/blockformatting/BlockFormattingContext.h:
1660         * layout/inlineformatting/InlineFormattingContext.cpp:
1661         (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
1662         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
1663         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): Deleted.
1664         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const): Deleted.
1665         * layout/inlineformatting/InlineFormattingContext.h:
1666
1667 2018-06-01  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1668
1669         [GTK] Difficult to read combo box text in dark theme
1670         https://bugs.webkit.org/show_bug.cgi?id=165072
1671
1672         Reviewed by Carlos Garcia Campos.
1673
1674         Set listbox foreground color to theme color to fix hard-to-read
1675         text color in combo box while using dark theme.
1676
1677         No new tests required. ManualTests/gtk/theme.html already covers it.
1678         See the "Option Lists" section.
1679
1680         * rendering/RenderTheme.cpp:
1681         (WebCore::RenderTheme::adjustStyle):
1682         Adjust style for ListboxPart as well.
1683         * rendering/RenderTheme.h: Add adjustListboxStyle()
1684         * rendering/RenderThemeGtk.cpp:
1685         (WebCore::RenderThemeGtk::adjustListboxStyle const):
1686         Set color to the theme foreground color.
1687         * rendering/RenderThemeGtk.h: adjustListboxStyle() overriden.
1688
1689 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1690
1691         [GTK] Switch to use a popup window with a tree view instead of a menu for option menu default implementation
1692         https://bugs.webkit.org/show_bug.cgi?id=186146
1693
1694         Reviewed by Michael Catanzaro.
1695
1696         Make it possible to use GUniquePtr with GtkTreePath.
1697
1698         * platform/gtk/GUniquePtrGtk.h:
1699
1700 2018-05-31  Per Arne Vollan  <pvollan@apple.com>
1701
1702         Add OpenGL display mask to WebPage creation parameters.
1703         https://bugs.webkit.org/show_bug.cgi?id=186163
1704         <rdar://problem/40634504>
1705
1706         Reviewed by Brent Fulgham.
1707
1708         To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
1709         The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
1710         early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
1711         on some hardware configurations.
1712  
1713         No new tests, since it is not trivial to test whether OpenGL rendering is hardware accelerated.
1714
1715         * platform/PlatformScreen.h:
1716         * platform/mac/PlatformScreenMac.mm:
1717         (WebCore::displayID):
1718
1719 2018-05-31  Megan Gardner  <megan_gardner@apple.com>
1720
1721         Add setting to allow override screen size to be disabled.
1722         https://bugs.webkit.org/show_bug.cgi?id=186109
1723
1724         Reviewed by Andy Estes.
1725
1726         Not Testable, and for debug only.
1727
1728         Pipe settings and use them to ignore override screen size if setting is set. 
1729
1730         * page/DeprecatedGlobalSettings.cpp:
1731         * page/DeprecatedGlobalSettings.h:
1732         (WebCore::DeprecatedGlobalSettings::setDisableScreenSizeOverride):
1733         (WebCore::DeprecatedGlobalSettings::disableScreenSizeOverride):
1734         * page/Settings.yaml:
1735         * platform/ios/PlatformScreenIOS.mm:
1736
1737 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
1738
1739         REGRESSION(r216119): DocumentLoader::detachFromFrame still encounters nullptr frame
1740         https://bugs.webkit.org/show_bug.cgi?id=186081
1741         <rdar://problem/34918109>
1742
1743         Reviewed by David Kilzer.
1744
1745         The nullptr check that was removed in r216119 was still needed because when the DocumentLoader
1746         is in 'm_waitingForNavigationPolicy' or in 'm_waitingForContentPolicy', a call to the policy checker
1747         to stopCheck we will clear the frame as part of the cleanup phase.
1748
1749         If m_frame is nullptr after cancelPolicyCheckIfNeeded, our work is already done so just return.
1750
1751         * loader/DocumentLoader.cpp:
1752         (WebCore::DocumentLoader::detachFromFrame):
1753
1754 2018-05-31  Dean Jackson  <dino@apple.com>
1755
1756         Don't paint the System Preview badge if the image isn't fully decoded
1757         https://bugs.webkit.org/show_bug.cgi?id=186158
1758         <rdar://problem/40454866>
1759
1760         Reviewed by Antoine Quint.
1761
1762         Only paint the system preview badge if the image itself said
1763         that it succeeded in drawing.
1764
1765         * rendering/RenderImage.cpp:
1766         (WebCore::RenderImage::paintIntoRect): Check the ImageDrawResult.
1767
1768 2018-05-31  David Kilzer  <ddkilzer@apple.com>
1769
1770         Implement checked cast for DDResultRef once DDResultGetCFTypeID() is available
1771         <https://webkit.org/b/184554>
1772         <rdar://problem/36241894>
1773
1774         Reviewed by Brent Fulgham.
1775
1776         * editing/cocoa/DataDetection.mm:
1777         (WebCore::detectItemAtPositionWithRange): Implement checked cast
1778         for DDResultRef.
1779
1780 2018-05-31  Alex Christensen  <achristensen@webkit.org>
1781
1782         Fix Windows build after r232246.
1783         https://bugs.webkit.org/show_bug.cgi?id=186024
1784
1785         * rendering/svg/SVGTextLayoutEngineBaseline.cpp:
1786         (WebCore::SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift const):
1787
1788 2018-05-31  Chris Dumez  <cdumez@apple.com>
1789
1790         Fix memory leak under NetworkStateNotifier::updateStateWithoutNotifying()
1791         https://bugs.webkit.org/show_bug.cgi?id=186149
1792         <rdar://problem/40674537>
1793
1794         Reviewed by Geoffrey Garen.
1795
1796         * platform/network/mac/NetworkStateNotifierMac.cpp:
1797         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
1798
1799 2018-05-31  Zalan Bujtas  <zalan@apple.com>
1800
1801         [LFC] Layout code needs to know the type of the Element associated with a Layout::Box
1802         https://bugs.webkit.org/show_bug.cgi?id=186117
1803
1804         Reviewed by Antti Koivisto.
1805
1806         Since these attributes don't change during layout, we could just pass them in to Layout::Box instead
1807         of keep querying the Element.
1808
1809         * layout/layouttree/LayoutBlockContainer.cpp:
1810         (WebCore::Layout::BlockContainer::BlockContainer):
1811         * layout/layouttree/LayoutBlockContainer.h:
1812         * layout/layouttree/LayoutBox.cpp:
1813         (WebCore::Layout::Box::Box):
1814         (WebCore::Layout::Box::isPaddingApplicable const):
1815         (WebCore::Layout::Box::isDocumentBox const): Deleted.
1816         (WebCore::Layout::Box::isBodyBox const): Deleted.
1817         * layout/layouttree/LayoutBox.h:
1818         (WebCore::Layout::Box::isAnonymous const):
1819         (WebCore::Layout::Box::isDocumentBox const):
1820         (WebCore::Layout::Box::isBodyBox const):
1821         (WebCore::Layout::Box::ElementAttributes::ElementAttributes):
1822         (WebCore::Layout::Box::setPreviousSibling):
1823         (WebCore::Layout::Box::setIsAnonymous): Deleted.
1824         * layout/layouttree/LayoutContainer.cpp:
1825         (WebCore::Layout::Container::Container):
1826         * layout/layouttree/LayoutContainer.h:
1827         * layout/layouttree/LayoutInlineBox.cpp:
1828         (WebCore::Layout::InlineBox::InlineBox):
1829         * layout/layouttree/LayoutInlineBox.h:
1830         * layout/layouttree/LayoutInlineContainer.cpp:
1831         (WebCore::Layout::InlineContainer::InlineContainer):
1832         * layout/layouttree/LayoutInlineContainer.h:
1833         * layout/layouttree/LayoutTreeBuilder.cpp:
1834         (WebCore::Layout::TreeBuilder::createLayoutTree):
1835         (WebCore::Layout::TreeBuilder::createSubTree):
1836
1837 2018-05-31  Chris Dumez  <cdumez@apple.com>
1838
1839         Unreviewed iOS build fix after r232335.
1840
1841         * html/BaseChooserOnlyDateAndTimeInputType.h:
1842         * html/BaseDateAndTimeInputType.h:
1843
1844 2018-05-31  Chris Dumez  <cdumez@apple.com>
1845
1846         Unreviewed, apply review comments from Darin after r232310.
1847
1848         * platform/ReferrerPolicy.cpp:
1849         (WebCore::parseReferrerPolicy):
1850
1851 2018-05-31  Zalan Bujtas  <zalan@apple.com>
1852
1853         [LFC] Margin box is border box + margins.
1854         https://bugs.webkit.org/show_bug.cgi?id=186124
1855
1856         Reviewed by Antti Koivisto.
1857
1858         * layout/displaytree/DisplayBox.cpp:
1859         (WebCore::Display::Box::marginBox const):
1860
1861 2018-05-31  Zalan Bujtas  <zalan@apple.com>
1862
1863         [LFC] Add quirks mode setter/getting to LayoutContext
1864         https://bugs.webkit.org/show_bug.cgi?id=186122
1865
1866         Reviewed by Antti Koivisto.
1867
1868         * layout/LayoutContext.h:
1869         (WebCore::Layout::LayoutContext::setInQuirksMode):
1870         (WebCore::Layout::LayoutContext::inQuirksMode const):
1871         * page/FrameViewLayoutContext.cpp:
1872         (WebCore::layoutUsingFormattingContext):
1873
1874 2018-05-30  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1875
1876         [GTK] Hardcoded text color in input fields
1877         https://bugs.webkit.org/show_bug.cgi?id=126907
1878
1879         Reviewed by Carlos Garcia Campos.
1880
1881         Set text color in input fields to foreground theme color.
1882         Also, set "window.background" as base GtkStyleContext to mimic
1883         GTK applications and fix some theme bugs.
1884
1885         No new tests required. ManualTests/gtk/theme.html already covers it.
1886
1887         * platform/gtk/RenderThemeGadget.cpp:
1888         (WebCore::baseStyleContext): Added.
1889         (WebCore::RenderThemeGadget::RenderThemeGadget):
1890         Use "window.background" GtkStyleContext instead of
1891         null parent for RenderThemeGadgets.
1892         * rendering/RenderThemeGtk.cpp:
1893         (WebCore::RenderThemeGtk::adjustButtonStyle const):
1894         Set color as foreground theme color.
1895         (WebCore::RenderThemeGtk::adjustTextFieldStyle const): Ditto.
1896         (WebCore::RenderThemeGtk::adjustTextAreaStyle const): Ditto.
1897         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const): Ditto.
1898         * rendering/RenderThemeGtk.h: adjustTextAreaStyle() overriden.
1899
1900 2018-05-30  Yusuke Suzuki  <utatane.tea@gmail.com>
1901
1902         [JSC] Pass VM& parameter as much as possible
1903         https://bugs.webkit.org/show_bug.cgi?id=186085
1904
1905         Reviewed by Saam Barati.
1906
1907         No behavior change.
1908
1909         * bindings/js/JSCSSRuleListCustom.cpp:
1910         (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):
1911         * bindings/js/JSCallbackData.cpp:
1912         (WebCore::JSCallbackData::invokeCallback):
1913         * bindings/js/JSCustomXPathNSResolver.cpp:
1914         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
1915         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
1916         (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
1917         * bindings/js/JSDOMConvertScheduledAction.h:
1918         (WebCore::Converter<IDLScheduledAction>::convert):
1919         * bindings/js/JSDOMIterator.h:
1920         (WebCore::iteratorForEach):
1921         * bindings/js/JSDOMMapLike.cpp:
1922         (WebCore::forwardFunctionCallToBackingMap):
1923         (WebCore::forwardForEachCallToBackingMap):
1924         * bindings/js/JSDOMPromise.cpp:
1925         (WebCore::callFunction):
1926         * bindings/js/JSDOMPromiseDeferred.cpp:
1927         (WebCore::DeferredPromise::callFunction):
1928         (WebCore::createRejectedPromiseWithTypeError):
1929         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
1930         (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
1931         * bindings/js/JSEventListener.cpp:
1932         (WebCore::JSEventListener::handleEvent):
1933         * bindings/js/JSNodeListCustom.cpp:
1934         (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
1935         * bindings/js/JSPluginElementFunctions.cpp:
1936         (WebCore::pluginElementCustomPut):
1937         (WebCore::callPlugin):
1938         * bindings/js/JSWindowProxy.cpp:
1939         (WebCore::JSWindowProxy::setWindow):
1940         * bindings/js/ReadableStream.cpp:
1941         (WebCore::ReadableStreamInternal::callFunction):
1942         * bindings/js/ReadableStreamDefaultController.cpp:
1943         (WebCore::callFunction):
1944         * bindings/js/ScheduledAction.cpp:
1945         (WebCore::ScheduledAction::executeFunctionInContext):
1946         * bindings/js/SerializedScriptValue.cpp:
1947         (WebCore::CloneSerializer::getProperty):
1948         (WebCore::CloneSerializer::serialize):
1949         * bindings/js/StructuredClone.cpp:
1950         (WebCore::structuredCloneArrayBufferView):
1951         * bindings/js/WorkerScriptController.cpp:
1952         (WebCore::WorkerScriptController::initScript):
1953         * bridge/NP_jsobject.cpp:
1954         * bridge/objc/WebScriptObject.mm:
1955         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1956         * testing/Internals.cpp:
1957         (WebCore::Internals::cloneArrayBuffer):
1958         * testing/js/WebCoreTestSupport.cpp:
1959         (WebCoreTestSupport::injectInternalsObject):
1960
1961 2018-05-28  Darin Adler  <darin@apple.com>
1962
1963         Straighten out HTMLInputElement attribute handling
1964         https://bugs.webkit.org/show_bug.cgi?id=186043
1965
1966         Reviewed by Daniel Bates.
1967
1968         * dom/RadioButtonGroups.cpp:
1969         (WebCore::RadioButtonGroup::requiredStateChanged): Renamed from requiredAttributeChanged,
1970         and changed to take a reference.
1971         (WebCore::RadioButtonGroups::requiredStateChanged): Ditto.
1972         * dom/RadioButtonGroups.h: Updated for changes above.
1973
1974         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1975         (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree): Call
1976         updateInnerTextValue by its new name.
1977         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): Renamed
1978         from updateAppearance.
1979         (WebCore::BaseChooserOnlyDateAndTimeInputType::setValue): Call
1980         updateInnerTextValue by its new name.
1981         (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Override this
1982         instead of valueAttributeChanged.
1983         * html/BaseChooserOnlyDateAndTimeInputType.h: Tighten up inheritance a bit.
1984         Also use final a bit more and update for changes above.
1985
1986         * html/BaseDateAndTimeInputType.cpp:
1987         (WebCore::BaseDateAndTimeInputType::attributeChanged): Replaced
1988         minOrMaxAttributeChanged with this override, checking for the attribute names.
1989         * html/BaseDateAndTimeInputType.h: Updated for changes above.
1990
1991         * html/FileInputType.cpp:
1992         (WebCore::FileInputType::disabledStateChanged): Renamed from disabledAttributeChanged.
1993         (WebCore::FileInputType::attributeChanged): Replaced
1994         multipleAttributeChanged with this override, checking for the attribute names.
1995         * html/FileInputType.h: Updated for changes above.
1996
1997         * html/HTMLFormControlElement.cpp:
1998         (WebCore::HTMLFormControlElement::parseAttribute): Updated function names to say
1999         "state changed" rather than "attribute changed" if they are called only when the
2000         computed value is changed, not the raw attribute value.
2001         (WebCore::HTMLFormControlElement::readOnlyStateChanged): Updated name.
2002         (WebCore::HTMLFormControlElement::requiredStateChanged): Ditto.
2003         * html/HTMLFormControlElement.h: Updated for changes above.
2004
2005         * html/HTMLInputElement.cpp:
2006         (WebCore::HTMLInputElement::parseAttribute): Removed the code to call lots of specific
2007         attribute changed functions that have now been deleted. Also removed empty code for a
2008         couple of attributes.
2009         (WebCore::HTMLInputElement::disabledStateChanged): Added. Forward call to input type.
2010         (WebCore::HTMLInputElement::readOnlyStateChanged): Ditto.
2011         (WebCore::HTMLInputElement::requiredStateChanged): Renamed from requiredAttributeChanged.
2012         * html/HTMLInputElement.h: Updated for changes above.
2013
2014         * html/HTMLTextFormControlElement.cpp:
2015         (WebCore::HTMLTextFormControlElement::readOnlyStateChanged): Renamed from
2016         readOnlyAttributeChanged. Also fixed incorrect call to base class. This may have
2017         fixed a bug: With some work we could probably create a test case to demonstrate that.
2018         * html/HTMLTextFormControlElement.h: Updated for changes above.
2019
2020         * html/ImageInputType.cpp:
2021         (WebCore::ImageInputType::attributeChanged): Replaced
2022         altAttributeChanged and srcAttributeChanged with this override, checking for the
2023         attribute names.
2024         * html/ImageInputType.h: Updated for changes above.
2025
2026         * html/InputType.cpp:
2027         (WebCore::InputType::altAttributeChanged): Deleted.
2028         (WebCore::InputType::srcAttributeChanged): Deleted.
2029         (WebCore::InputType::maxResultsAttributeChanged): Deleted.
2030         (WebCore::InputType::minOrMaxAttributeChanged): Deleted.
2031         (WebCore::InputType::stepAttributeChanged): Deleted.
2032         (WebCore::InputType::valueAttributeChanged): Deleted.
2033         (WebCore::InputType::attributeChanged): Moved to header as an inline so derived
2034         classes can call through to the base class with the empty function inlined.
2035         (WebCore::InputType::multipleAttributeChanged): Deleted.
2036         (WebCore::InputType::disabledAttributeChanged): Moved to header as an inline.
2037         (WebCore::InputType::readonlyAttributeChanged): Ditto.
2038         (WebCore::InputType::requiredAttributeChanged): Ditto.
2039         * html/InputType.h: Updated for changes above.
2040
2041         * html/NumberInputType.cpp:
2042         (WebCore::NumberInputType::attributeChanged): Replaced
2043         minOrMaxAttributeChanged and stepAttributeChanged with this override, checking
2044         for the attribute names.
2045         * html/NumberInputType.h: Updated for changes above.
2046
2047         * html/RangeInputType.cpp:
2048         (WebCore::RangeInputType::disabledStateChanged): Renamed from
2049         disabledAttributeChanged.
2050         (WebCore::RangeInputType::attributeChanged): Replaced
2051         minOrMaxAttributeChanged with this override, checking for the attribute names.
2052         * html/RangeInputType.h: Updated for changes above.
2053
2054         * html/SearchInputType.cpp:
2055         (WebCore::SearchInputType::SearchInputType): Removed unneeded initialization of
2056         RefPtr data members to nullptr.
2057         (WebCore::updateResultButtonPseudoType): Removed unneeded if statement; the two
2058         cases above cover 0, and less than 0, so there is no need to check for greater
2059         than 0 for the third case.
2060         (WebCore::SearchInputType::attributeChanged): Replaced
2061         maxResultsAttributeChanged with this override, checking for the attribute name.
2062         * html/SearchInputType.h: Updated for changes above and marked more
2063         member functions final.
2064
2065         * html/TextFieldInputType.cpp:
2066         (WebCore::TextFieldInputType::attributeChanged): Added a call through to the
2067         base class to match the style of other overrides of this function.
2068         (WebCore::TextFieldInputType::disabledStateChanged): Renamed from disabledAttributeChanged.
2069         (WebCore::TextFieldInputType::readOnlyStateChanged): Renamed from readonlyAttributeChanged.
2070         * html/TextFieldInputType.h: Updated for changes above. Also made attributeChanged no
2071         longer be marked final since derived classes now override it.
2072
2073         * html/shadow/SliderThumbElement.cpp:
2074         (WebCore::SliderThumbElement::SliderThumbElement): Moved some data member initialization
2075         from this constructor to the class definition.
2076         (WebCore::SliderThumbElement::hostDisabledStateChanged): Renamed from disabledAttributeChanged.
2077         * html/shadow/SliderThumbElement.h: Updated for changes above and marked more
2078         member functions final.
2079
2080 2018-05-30  Nan Wang  <n_wang@apple.com>
2081
2082         AX: VoiceOver on macOS does not announce fieldset description from aria-describedby when focussing inputs
2083         https://bugs.webkit.org/show_bug.cgi?id=185246
2084         <rdar://problem/39939028>
2085
2086         Reviewed by Chris Fleizach.
2087
2088         Exposed the fieldset's description to its form control children.
2089
2090         Test: accessibility/mac/aria-describedby-fieldset.html
2091
2092         * accessibility/AccessibilityNodeObject.cpp:
2093         (WebCore::AccessibilityNodeObject::helpText const):
2094
2095 2018-05-30  Chris Fleizach  <cfleizach@apple.com>
2096
2097         AX: Expose link rel type to voiceover
2098         https://bugs.webkit.org/show_bug.cgi?id=186084
2099         <rdar://problem/40640871>
2100
2101         Reviewed by Sam Weinig.
2102
2103         Make the link rel attribute available to accessibility clients.
2104
2105         Test: accessibility/mac/linkrel.html
2106
2107         * accessibility/AccessibilityObject.cpp:
2108         (WebCore::AccessibilityObject::linkRelValue const):
2109         * accessibility/AccessibilityObject.h:
2110         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2111         (-[WebAccessibilityObjectWrapper accessibilityLinkRelationshipType]):
2112         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2113         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
2114         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2115
2116 2018-05-30  Brady Eidson  <beidson@apple.com>
2117
2118         REGRESSION (r224684): User-agent seen by page does not change when modified by the develop menu options after reloading.
2119         <rdar://problem/34918109> and https://bugs.webkit.org/show_bug.cgi?id=186111
2120
2121         Reviewed by Andy Estes.
2122
2123         Test: http/tests/navigation/useragent-reload.php
2124
2125         * Modules/websockets/WebSocketHandshake.cpp:
2126         (WebCore::WebSocketHandshake::clientHandshakeRequest const): Use setUserAgent() for consistency.
2127
2128         * loader/DocumentLoader.cpp:
2129         (WebCore::DocumentLoader::startLoadingMainResource): Clear the user agent from the original DocumentLoader request
2130           before adding additional fields, as reloads should pick up user agent changes.
2131
2132 2018-05-30  Dean Jackson  <dino@apple.com>
2133
2134         WebContent crashes with system preview content
2135         https://bugs.webkit.org/show_bug.cgi?id=186118
2136
2137         Reviewed by Myles Maxfield.
2138
2139         We were receiving crash reports on iOS devices when getting
2140         platformContext() from a GraphicsContext. This usually
2141         occurred when the page was invisible. Debugging showed that
2142         it was trying to draw with a disabled context.
2143
2144         * rendering/RenderThemeIOS.mm:
2145         (WebCore::RenderThemeIOS::paintSystemPreviewBadge): Early
2146         return if the context has painting disabled.
2147
2148 2018-05-30  Daniel Bates  <dabates@apple.com>
2149
2150         Web Inspector: Annotate Same-Site cookies
2151         https://bugs.webkit.org/show_bug.cgi?id=184897
2152         <rdar://problem/35178209>
2153
2154         Reviewed by Brian Burg.
2155
2156         Store and retrieve the Same-Site cookie policy from CFNetwork.
2157
2158         * inspector/agents/InspectorPageAgent.cpp:
2159         (WebCore::cookieSameSitePolicyJSON): Added.
2160         (WebCore::buildObjectForCookie): Modified to include cookie Same-Site policy. 
2161         * platform/Cookie.h:
2162         (WebCore::Cookie::encode const): Encode Same-Site policy.
2163         (WebCore::Cookie::decode): Decode Same-Site policy.
2164         * platform/network/cocoa/CookieCocoa.mm:
2165         (WebCore::portStringFromVector):
2166         (WebCore::coreSameSitePolicy):
2167         (WebCore::nsSameSitePolicy):
2168         (WebCore::Cookie::operator NSHTTPCookie * _Nullable  const):
2169         (WebCore::Cookie::operator NSHTTPCookie * const): Deleted.
2170
2171 2018-05-30  Daniel Bates  <dabates@apple.com>
2172
2173         NavigationAction does not need to hold initiating DOM Event
2174         https://bugs.webkit.org/show_bug.cgi?id=185958
2175         <rdar://problem/40531539>
2176
2177         Reviewed by Simon Fraser.
2178
2179         Take a similar approach as was done in <https://bugs.webkit.org/show_bug.cgi?id=185712>
2180         and have NavigationAction hold only as many details of the initiating DOM Event as
2181         necessary to support WebKit functionality. Retaining a DOM Event effectively retains
2182         the document that associated with the event. And DocumentLoader always keeps around
2183         the NavigationAction of the last navigation for the "benefit of the various policy handlers".
2184         Therefore, having NavigationAction hold only the relevant details of the DOM Event
2185         instead of the DOM Event itself we avoid keeping the document we navigated from alive
2186         longer than necessary. 
2187
2188         * dom/MouseRelatedEvent.h:
2189         * dom/UIEventWithKeyState.h:
2190         * loader/NavigationAction.cpp:
2191         (WebCore::NavigationAction::UIEventWithKeyStateData::UIEventWithKeyStateData): Added.
2192         (WebCore::NavigationAction::MouseEventData::MouseEventData): Added.
2193         (WebCore::keyStateDataForFirstEventWithKeyState): Added.
2194         (WebCore::mouseEventDataForFirstMouseEvent): Added.
2195         * loader/NavigationAction.h:
2196         (WebCore::NavigationAction::keyStateEventData const): Added.
2197         (WebCore::NavigationAction::mouseEventData const): Added
2198         (WebCore::NavigationAction::event const): Deleted.
2199
2200 2018-05-30  Youenn Fablet  <youenn@apple.com>
2201
2202         Revert changes made to URLWithUserTypedString made in https://trac.webkit.org/changeset/232281
2203         https://bugs.webkit.org/show_bug.cgi?id=186108
2204         <rdar://problem/40663065>
2205
2206         Reviewed by Alex Christensen.
2207
2208         Covered by existing API tests.
2209
2210         * platform/mac/WebCoreNSURLExtras.mm:
2211         (WebCore::URLWithUserTypedString):
2212         Return early if WebCore::URL is not able to create a CFURL.
2213         Use CFURL otherwise to keep the existing behavior as much as possible.
2214
2215 2018-05-30  Youenn Fablet  <youenn@apple.com>
2216
2217         Rename FromOrigin runtime flag to CrossOriginResourcePolicy and enable it by default
2218         https://bugs.webkit.org/show_bug.cgi?id=186082
2219
2220         Reviewed by Chris Dumez.
2221
2222         No change of behavior.
2223
2224         * page/RuntimeEnabledFeatures.h:
2225         (WebCore::RuntimeEnabledFeatures::setCrossOriginResourcePolicyEnabled):
2226         (WebCore::RuntimeEnabledFeatures::crossOriginResourcePolicyEnabled const):
2227         (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled): Deleted.
2228         (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const): Deleted.
2229
2230 2018-05-30  Chris Dumez  <cdumez@apple.com>
2231
2232         Referrer-Policy response header is ignored
2233         https://bugs.webkit.org/show_bug.cgi?id=186037
2234         <rdar://problem/40600335>
2235
2236         Reviewed by Youenn Fablet.
2237
2238         Add support for Referrer-Policy HTTP response header:
2239         - https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header
2240
2241         Tests: http/tests/security/referrer-policy-header-and-meta-tag-emptyString.html
2242                http/tests/security/referrer-policy-header-and-meta-tag.html
2243                http/tests/security/referrer-policy-header.html
2244
2245         * dom/Document.cpp:
2246         (WebCore::Document::setReferrerPolicy):
2247         (WebCore::Document::processReferrerPolicy):
2248         * dom/Document.h:
2249         (WebCore::Document::referrerPolicy const):
2250         * html/HTMLMetaElement.cpp:
2251         (WebCore::HTMLMetaElement::process):
2252         * loader/FrameLoader.cpp:
2253         (WebCore::FrameLoader::didBeginDocument):
2254         * loader/SubresourceLoader.cpp:
2255         (WebCore::SubresourceLoader::updateReferrerPolicy):
2256         * platform/ReferrerPolicy.cpp:
2257         (WebCore::parseReferrerPolicyToken):
2258         (WebCore::parseReferrerPolicy):
2259         * platform/ReferrerPolicy.h:
2260
2261 2018-05-30  Youenn Fablet  <youenn@apple.com>
2262
2263         Rename CrossOriginResourcePolicy same to same-origin
2264         https://bugs.webkit.org/show_bug.cgi?id=186080
2265
2266         Reviewed by Chris Dumez.
2267
2268         Covered by updated tests.
2269
2270         * platform/network/HTTPParsers.cpp:
2271         (WebCore::parseCrossOriginResourcePolicyHeader):
2272         * platform/network/HTTPParsers.h:
2273
2274 2018-05-30  Aditya Keerthi  <akeerthi@apple.com>
2275
2276         Fix the ENABLE(DATALIST_ELEMENT) build
2277         https://bugs.webkit.org/show_bug.cgi?id=186105
2278
2279         Reviewed by Wenson Hsieh.
2280
2281         * WebCore.xcodeproj/project.pbxproj:
2282         * html/ColorInputType.cpp:
2283         (WebCore::ColorInputType::suggestions const):
2284         * html/HTMLInputElement.h:
2285         * html/HTMLOptionElement.cpp:
2286         (WebCore::HTMLOptionElement::ownerDataListElement const):
2287         * rendering/RenderTheme.cpp:
2288         (WebCore::RenderTheme::paintSliderTicks):
2289
2290 2018-05-30  Alex Christensen  <achristensen@webkit.org>
2291
2292         Reduce String allocations
2293         https://bugs.webkit.org/show_bug.cgi?id=186059
2294
2295         Reviewed by Darin Adler.
2296
2297         Don't allocate Strings just to convert it to another form.
2298         Based mostly on Darin's feedback on bug 185986.
2299
2300         No change in behavior.
2301
2302         * Modules/websockets/WebSocketHandshake.cpp:
2303         (WebCore::hostName):
2304         (WebCore::WebSocketHandshake::host const):
2305         * css/parser/CSSSelectorParser.cpp:
2306         (WebCore::CSSSelectorParser::consumePseudo):
2307         (WebCore::CSSSelectorParser::consumeANPlusB):
2308         * loader/mac/LoaderNSURLExtras.mm:
2309         (suggestedFilenameWithMIMEType):
2310         * page/SecurityOriginData.h:
2311         (WebCore::SecurityOriginData::fromURL):
2312         * page/csp/ContentSecurityPolicySource.cpp:
2313         (WebCore::wildcardMatches):
2314         (WebCore::ContentSecurityPolicySource::hostMatches const):
2315         * platform/URL.cpp:
2316         (WebCore::URL::hostAndPort const):
2317         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2318         (WebCore::SocketStreamHandleImpl::createStreams):
2319
2320 2018-05-30  Jer Noble  <jer.noble@apple.com>
2321
2322         Media elements outside fullscreen should not be considered main content.
2323         https://bugs.webkit.org/show_bug.cgi?id=186063
2324         <rdar://problem/40630437>
2325
2326         Reviewed by Eric Carlson.
2327
2328         Test: platform/mac/media/video-best-element-for-playback-controls-purpose.html
2329
2330         Media elements outside the current fullscreen element are not visible, and thus should not be considered
2331         main content.
2332
2333         Drive-by fix: set the m_hasEverNotifiedAboutPlaying before dispatching the 'playing' event, so that
2334         tests can check bestMediaElementForShowingPlaybackControlsManager() in the 'playing' handler.
2335
2336         * html/HTMLMediaElement.cpp:
2337         (WebCore::HTMLMediaElement::notifyAboutPlaying):
2338         * html/HTMLMediaElement.h:
2339         * html/MediaElementSession.cpp:
2340         (WebCore::MediaElementSession::canShowControlsManager const):
2341         * testing/Internals.cpp:
2342         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
2343         * testing/Internals.h:
2344         * testing/Internals.idl:
2345
2346 2018-05-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2347
2348         Unreviewed, silence a -Wreturn-type warning
2349
2350         * css/SVGCSSComputedStyleDeclaration.cpp:
2351         (WebCore::glyphOrientationToCSSPrimitiveValue):
2352
2353 2018-05-30  Alexey Proskuryakov  <ap@apple.com>
2354
2355         Build fix attempt after https://trac.webkit.org/r232198
2356
2357         * platform/network/cf/ResourceHandleCFNet.cpp:
2358         (WebCore::ResourceHandle::createCFURLConnection): Added some toString() calls.
2359
2360 2018-05-30  Zalan Bujtas  <zalan@apple.com>
2361
2362         [LFC] Miscellaneous fixes to get closer to geometry correctness
2363         https://bugs.webkit.org/show_bug.cgi?id=186083
2364
2365         Reviewed by Antti Koivisto.
2366
2367         * layout/FormattingContextGeometry.cpp:
2368         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
2369         * layout/LayoutContext.cpp:
2370         (WebCore::Layout::LayoutContext::initializeRoot):
2371         * layout/Verification.cpp:
2372         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
2373         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2374         (WebCore::Layout::isStretchedToViewport):
2375         (WebCore::Layout::initialContainingBlock):
2376         (WebCore::Layout::computedInFlowNonReplacedComputedHeight):
2377         (WebCore::Layout::inFlowNonReplacedComputedWidth):
2378         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): lambda should capture the specification part. 
2379         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth):
2380         * layout/displaytree/DisplayBox.cpp:
2381         (WebCore::Display::Box::marginBox const):
2382         (WebCore::Display::Box::paddingBox const):
2383         (WebCore::Display::Box::contentBox const):
2384         * layout/layouttree/LayoutBox.cpp:
2385         (WebCore::Layout::Box::isDocumentBox const):
2386         (WebCore::Layout::Box::isBodyBox const):
2387         * layout/layouttree/LayoutBox.h:
2388         * rendering/style/BorderValue.h: ignore border-width when type is hidden or none. 
2389         (WebCore::BorderValue::boxModelWidth const):
2390
2391 2018-05-30  Stephen McGruer  <smcgruer@chromium.org>
2392
2393         iOS: setting 'defaultValue' of input type=date from script should cause a UI update
2394         https://bugs.webkit.org/show_bug.cgi?id=185982
2395
2396         Reviewed by Darin Adler.
2397
2398         Test: fast/forms/date/date-appearance-defaultValue.html
2399
2400         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2401         (WebCore::BaseChooserOnlyDateAndTimeInputType::valueAttributeChanged):
2402         * html/BaseChooserOnlyDateAndTimeInputType.h:
2403         * html/HTMLInputElement.cpp:
2404         (WebCore::HTMLInputElement::parseAttribute):
2405         * html/InputType.cpp:
2406         (WebCore::InputType::valueAttributeChanged):
2407         * html/InputType.h:
2408
2409 2018-05-29  Nan Wang  <n_wang@apple.com>
2410
2411         Unreviewed, follow-up after r232285
2412         https://bugs.webkit.org/show_bug.cgi?id=180871
2413
2414         Removed redundant null check.
2415
2416         * accessibility/AccessibilityObject.cpp:
2417         (WebCore::AccessibilityObject::isExpanded const):
2418
2419 2018-05-29  Nan Wang  <n_wang@apple.com>
2420
2421         AX: macOS VoiceOver doesn't announce when details element is expanded when using role group
2422         https://bugs.webkit.org/show_bug.cgi?id=180866
2423         <rdar://problem/36074338>
2424
2425         Reviewed by Chris Fleizach.
2426
2427         We should use is<HTMLDetailsElement> to check for the details parent instead
2428         of using the role.
2429
2430         Added test cases to the existing test.
2431
2432         * accessibility/AccessibilityObject.cpp:
2433         (WebCore::AccessibilityObject::isExpanded const):
2434
2435 2018-05-29  Youenn Fablet  <youenn@apple.com>
2436
2437         Add a consistency check between URL and CFURL
2438         https://bugs.webkit.org/show_bug.cgi?id=186057
2439         <rdar://problem/40258457>
2440
2441         Reviewed by Geoff Garen.
2442
2443         It is important that WebCore::URL used in WebCore and CFURL that gets serialized in the network pipe remain consistent.
2444         Otherwise, we will end-up with odd bugs.
2445
2446         We add such a check when creating a CFURL from an URL.
2447         To make things more consistent, we also rely now more on WebCore::URL instead of directly creating a CFURL.
2448
2449         * platform/URL.h:
2450         * platform/cf/CFURLExtras.cpp:
2451         (WebCore::isCFURLSameOrigin):
2452         * platform/cf/CFURLExtras.h:
2453         * platform/cf/URLCF.cpp:
2454         (WebCore::URL::createCFURL const):
2455         * platform/mac/URLMac.mm:
2456         (WebCore::URL::createCFURL const):
2457         * platform/mac/WebCoreNSURLExtras.mm:
2458         (WebCore::URLWithUserTypedString):
2459
2460 2018-05-29  Timothy Hatcher  <timothy@apple.com>
2461
2462         Printing does not apply the right colors in all cases.
2463
2464         https://bugs.webkit.org/show_bug.cgi?id=186066
2465         rdar://problem/40274975
2466
2467         Reviewed by Tim Horton.
2468
2469         * inspector/agents/InspectorPageAgent.cpp:
2470         (WebCore::InspectorPageAgent::setEmulatedMedia): Call RenderTheme::platformColorsDidChange
2471         to invalidate the color cache.
2472         * page/FrameView.cpp:
2473         (WebCore::FrameView::adjustMediaTypeForPrinting): Ditto.
2474         * page/Page.cpp:
2475         (WebCore::Page::defaultAppearance const): Added. Use default when not screen.
2476         * page/Page.h:
2477         (WebCore::Page::defaultAppearance const): Deleted.
2478
2479 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
2480
2481         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
2482         https://bugs.webkit.org/show_bug.cgi?id=186056
2483
2484         Reviewed by Brent Fulgham.
2485
2486         No new tests, no change in behavior.
2487
2488         * platform/PlatformScreen.h:
2489         * platform/mac/PlatformScreenMac.mm:
2490         (WebCore::screenProperties):
2491         (WebCore::getScreenProperties):
2492         (WebCore::setScreenProperties):
2493
2494 2018-05-29  Ryosuke Niwa  <rniwa@webkit.org>
2495
2496         iOS WK1: Occasional crash in sanitizedMarkupForFragmentInDocument
2497         https://bugs.webkit.org/show_bug.cgi?id=186011
2498
2499         Reviewed by David Kilzer.
2500
2501         The crash was caused by the HTML parser in sanitizedMarkupForFragmentInDocument yielding in the web thread
2502         when _WebThreadLock() sets webThreadShouldYield to true in the main thread.
2503
2504         No new tests. This is occasionally caught by existing tests.
2505
2506         * editing/markup.cpp:
2507         (WebCore::createPageForSanitizingWebContent): Fixed the bug by making the HTML parser never yield.
2508         Also release-assert that the body is never null here.
2509         (WebCore::sanitizedMarkupForFragmentInDocument): Removed superflous call to WTFMove since appendChild
2510         takes a reference, not a Ref.
2511         * inspector/InspectorOverlay.cpp:
2512         (WebCore::InspectorOverlay::overlayPage): Deployed the same fix.
2513         * loader/DocumentWriter.cpp:
2514         (WebCore::DocumentWriter::insertDataSynchronously): Added.
2515         * loader/DocumentWriter.h:
2516
2517 2018-05-29  Chris Dumez  <cdumez@apple.com>
2518
2519         Avoid unnecessary String allocation in isPublicSuffix(const String&)
2520         https://bugs.webkit.org/show_bug.cgi?id=186054
2521
2522         Reviewed by Sam Weinig.
2523
2524         Avoid unnecessary String allocation in isPublicSuffix(const String&) by calling directly
2525         the decodeHostName() overload taking in a NSString*. This overload returns a NSString*,
2526         which is what we need. We would previously call the overloading taking in a String, which
2527         would return a String, which we would have to convert back to a NSString*.
2528
2529         * platform/mac/PublicSuffixMac.mm:
2530         (WebCore::isPublicSuffix):
2531
2532 2018-05-29  Alex Christensen  <achristensen@webkit.org>
2533
2534         Do even fewer allocations in URL host operations
2535         https://bugs.webkit.org/show_bug.cgi?id=186003
2536
2537         Reviewed by Geoffrey Garen.
2538
2539         * loader/ResourceLoadStatistics.cpp:
2540         (WebCore::ResourceLoadStatistics::primaryDomain):
2541         * loader/ResourceLoadStatistics.h:
2542         * platform/URL.cpp:
2543         (WebCore::URL::hostIsIPAddress):
2544         * platform/URL.h:
2545         * platform/mac/URLMac.mm:
2546         (WebCore::URL::hostIsIPAddress):
2547         * platform/soup/URLSoup.cpp:
2548         (WebCore::URL::hostIsIPAddress):
2549
2550 2018-05-29  Tadeu Zagallo  <tzagallo@apple.com>
2551
2552         Don't assert on m_actionsStart when setting actions on DFA nodes
2553         https://bugs.webkit.org/show_bug.cgi?id=185979
2554         <rdar://problem/39669458>
2555
2556         Reviewed by Geoffrey Garen.
2557
2558         DFANode::setActions is called immediately after the node is created, and once again to set
2559         the actions of catch-all regular expressions (.*) on the root node. That works because
2560         m_actionsStart is initially 0, since the root was the first node to be created, but may fail
2561         after minimizing the DFA, when the root may no longer be the first node, and therefore
2562         m_actionsStart would not be 0, even if there are no actions attached to that node.
2563
2564         Test: http/tests/contentextensions/root-actions.html
2565
2566         * contentextensions/DFANode.h:
2567
2568 2018-05-29  Nan Wang  <n_wang@apple.com>
2569
2570         AX: setValue on contenteditable should preserve whitespace
2571         https://bugs.webkit.org/show_bug.cgi?id=185897
2572
2573         Reviewed by Ryosuke Niwa.
2574
2575         We should mimic typing when setting value to a contenteditable from accessibility
2576         instead of mutating the DOM by using setInnerText.
2577
2578         Updated tests to cover this change.
2579
2580         * accessibility/AccessibilityRenderObject.cpp:
2581         (WebCore::AccessibilityRenderObject::setValue):
2582
2583 2018-05-29  Zalan Bujtas  <zalan@apple.com>
2584
2585         [LFC] Miscellaneous fixes to ensure no assertion in LayoutContext::layout
2586         https://bugs.webkit.org/show_bug.cgi?id=186052
2587
2588         Reviewed by Antti Koivisto.
2589
2590         With this patch, LayoutContext::layout() does not assert on <html><body><div></div></body></html> anymore.
2591
2592         * layout/LayoutContext.cpp:
2593         (WebCore::Layout::LayoutContext::initializeRoot): New context root is always a layout root.
2594         * layout/LayoutContext.h:
2595         * layout/Verification.cpp:
2596         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
2597         * layout/blockformatting/BlockFormattingContext.cpp:
2598         (WebCore::Layout::BlockFormattingContext::layout const): we need computed margin/border/padding for width computation  
2599         * layout/displaytree/DisplayBox.cpp: Add clone() method to be able to carry over the 'hasValid*' bits.
2600         (WebCore::Display::Box::Style::Style):
2601         (WebCore::Display::Box::borderBox const):
2602         (WebCore::Display::Box::contentBox const):
2603         * layout/displaytree/DisplayBox.h:
2604         (WebCore::Display::Box::Rect::operator LayoutRect const):
2605         (WebCore::Display::Box::setSize):
2606         (WebCore::Display::Box::setHasValidMargin):
2607         (WebCore::Display::Box::setHasValidBorder):
2608         (WebCore::Display::Box::setHasValidPadding):
2609         (WebCore::Display::Box::Rect::setHasValidPosition):
2610         (WebCore::Display::Box::Rect::setHasValidSize):
2611         (WebCore::Display::Box::Rect::setSize):
2612         (WebCore::Display::Box::Rect::clone const):
2613         (WebCore::Display::Box::setMargin):
2614         (WebCore::Display::Box::setBorder):
2615         (WebCore::Display::Box::setPadding):
2616         (WebCore::Display::Box::Rect::Rect): Deleted.
2617
2618 2018-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2619
2620         [Extra zoom mode] "Significant area painted" rendering progress event is rarely fired
2621         https://bugs.webkit.org/show_bug.cgi?id=186042
2622         <rdar://problem/40604182>
2623
2624         Reviewed by Tim Horton.
2625
2626         Makes a minor tweak to the size of the relevant view rect in extra zoom mode, such that it's no wider than the
2627         visible content rect. Previously, the width of this rect has hard-coded to a value optimized for macOS (980),
2628         which makes it difficult for content laid out at device width in extra zoom mode to cover a significant portion
2629         of the relevant view rect.
2630
2631         Test: RenderingProgressTests.FirstPaintWithSignificantArea
2632
2633         * page/Page.cpp:
2634         (WebCore::relevantViewRect):
2635
2636 2018-05-29  Antoine Quint  <graouts@apple.com>
2637
2638         [Web Animations] Handle relative length units
2639         https://bugs.webkit.org/show_bug.cgi?id=186047
2640
2641         Reviewed by Dean Jackson.
2642
2643         In order to correctly handle relative units, such as "em", "vw" and "vh", we need to do two things.
2644
2645         First, because we need to apply the cascade to correctly compute relative lengths, we need to delay the computation of
2646         "blending keyframes" to when we have both keyframes data and a valid target. This also means that we need to reset blending
2647         keyframes when the target changes. As a result, old call sites of updateBlendingKeyframes() have been replaced by a call to
2648         m_blendingKeyframes.clear() and the method now gets called as part of apply() with the RenderStyle of the targeted element
2649         as a parameter.
2650
2651         Second, and as a result of the first change, we need to update the accelerated animation state based on animation
2652         progress rather than when calling specific methods, such as Animation.play() and Animation.pause(), since blending
2653         keyframes may not be available at those more specific call sites. We now have a new updateAcceleratedAnimationState()
2654         method that gets called as part of apply(). We also rename animationPlayStateDidChange() to animationSuspensionStateDidChange()
2655         since this method was specific to suspension and had a confusing name.
2656
2657         * animation/AnimationEffectReadOnly.h: Rename animationPlayStateDidChange() to animationSuspensionStateDidChange().
2658         * animation/KeyframeEffectReadOnly.cpp:
2659         (WebCore::KeyframeEffectReadOnly::getKeyframes): Fix a crash that revealed itself after other changes in this patch. We would later
2660         call into ComputedStyleExtractor::animationSuspensionStateDidChange() and this would yield an assertion because we'd call potentially
2661         call it with a custom CSS property.
2662         (WebCore::KeyframeEffectReadOnly::processKeyframes): Reset blending keyframes instead of calling updateBlendingKeyframes() since
2663         blending keyframes is now performed asynchronously upon style resolution.
2664         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): Take the target's RenderStyle as a parameter and use it to reset the
2665         associated StyleResolver's state, just like we do in StyleResolver::keyframeStylesForAnimation(), so that the CSS cascade is correctly
2666         accounted for when computing values using relative length units. Since blending keyframes can now be computed several times for a
2667         given set of keyframes, since the effect's target may change, we also need to create a copy of the MutableStyleProperties to pass
2668         to StyleRuleKeyframe::create().
2669         (WebCore::KeyframeEffectReadOnly::setTarget): Reset blending keyframes instead of calling updateBlendingKeyframes() since
2670         blending keyframes is now performed asynchronously upon style resolution.
2671         (WebCore::KeyframeEffectReadOnly::apply): Update blending keyframes and the accelerated animation state.
2672         (WebCore::KeyframeEffectReadOnly::getAnimatedStyle): Make sure we have blending keyframes with a call to updateBlendingKeyframes()
2673         in case the animation hasn't naturally progressed when this method is called.
2674         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Make sure we have blending keyframes with a call to
2675         updateBlendingKeyframes() in case the animation hasn't naturally progressed when this method is called.
2676         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): Account for the animation's local time and play state to update
2677         the accelerated animation state.
2678         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Record the last accelerated action in a member variable which we can
2679         use to determine if we're running accelerated accounting for uncommited changes.
2680         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Only record an AcceleratedAction::Seek action if we're already running accelerated.
2681         (WebCore::KeyframeEffectReadOnly::animationSuspensionStateDidChange): Only record an AcceleratedAction::Pause or AcceleratedAction::Play
2682         action if we're already running accelerated.
2683         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Ensure we clone and clear the list of accelerated actions and check that
2684         we have any cloned actions before proceeding any further. Then we can stop accounting for m_startedAccelerated since the list of accelerated
2685         actions already account for animation state changes.
2686         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Deleted.
2687         * animation/KeyframeEffectReadOnly.h:
2688         (WebCore::KeyframeEffectReadOnly::isRunningAccelerated const): Account for the m_lastRecordedAcceleratedAction to identify whether we're running.
2689         * animation/WebAnimation.cpp:
2690         (WebCore::WebAnimation::play): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when
2691         the animation's effect is applied.
2692         (WebCore::WebAnimation::pause): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when
2693         the animation's effect is applied.
2694         (WebCore::WebAnimation::resolve): Make sure we update the finished state prior to applying the animation's effect since the play state can
2695         change when updating the finished state and KeyframeEffectReadOnly::updateAcceleratedAnimationState(), which is called when calling into
2696         KeyframeEffectReadOnly::apply(), relies on it to correctly update the accelerated animation state.
2697         (WebCore::WebAnimation::setSuspended): Rename animationPlayStateDidChange() to animationSuspensionStateDidChange().
2698         * css/StyleResolver.cpp:
2699         (WebCore::StyleResolver::setNewStateWithElement): Add a new public method to reset a StyleResolver's state such that we can call it when creating
2700         blending keyframes for JS-originated animations just like we do when creating blending keyframes for CSS Animations in keyframeStylesForAnimation().
2701         (WebCore::StyleResolver::keyframeStylesForAnimation): Use the new setNewStateWithElement() method.
2702         * css/StyleResolver.h:
2703
2704 2018-05-29  Thibault Saunier  <tsaunier@igalia.com>
2705
2706         [GStreamer] Update "qtdemux: Clarify field name about stream-encryption-system" patch
2707         https://bugs.webkit.org/show_bug.cgi?id=186040
2708
2709         Reviewed by Xabier Rodriguez-Calvar.
2710
2711         s/avalaible-stream-encryption-systems/available-stream-encryption-systems/g
2712
2713         Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-*
2714
2715         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2716         (WebCore::extractEventsAndSystemsFromMessage):
2717
2718 2018-05-28  Zalan Bujtas  <zalan@apple.com>
2719
2720         Unreviewed build fix.
2721
2722         * layout/displaytree/DisplayBox.h:
2723         (WebCore::Display::Box::Rect::operator LayoutRect const):
2724
2725 2018-05-28  Zalan Bujtas  <zalan@apple.com>
2726
2727         [LFC] Add Rect interface to Display::Box
2728         https://bugs.webkit.org/show_bug.cgi?id=186019
2729
2730         Reviewed by Antti Koivisto.
2731
2732         Having a dedicated Rect class and moving the geometry invalidation to it enables us to call
2733         displayBox.contentBox().left() even when the widht/height are not computed yet.
2734         Also having Rect with top/left/bottom/right interface is more aligned with the rest of the layout code than x/y/maxX/maxY.
2735
2736         * layout/FormattingContextGeometry.cpp:
2737         (WebCore::Layout::contentHeightForFormattingContextRoot):
2738         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2739         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
2740         * layout/displaytree/DisplayBox.cpp:
2741         (WebCore::Display::Box::marginBox const):
2742         (WebCore::Display::Box::borderBox const):
2743         (WebCore::Display::Box::paddingBox const):
2744         (WebCore::Display::Box::contentBox const):
2745         * layout/displaytree/DisplayBox.h:
2746         (WebCore::Display::Box::Rect::invalidateTop):
2747         (WebCore::Display::Box::Rect::invalidateLeft):
2748         (WebCore::Display::Box::Rect::invalidateWidth):
2749         (WebCore::Display::Box::Rect::invalidateHeight):
2750         (WebCore::Display::Box::Rect::hasValidPosition const):
2751         (WebCore::Display::Box::Rect::hasValidSize const):
2752         (WebCore::Display::Box::Rect::hasValidGeometry const):
2753         (WebCore::Display::Box::rect const):
2754         (WebCore::Display::Box::top const):
2755         (WebCore::Display::Box::left const):
2756         (WebCore::Display::Box::bottom const):
2757         (WebCore::Display::Box::right const):
2758         (WebCore::Display::Box::topLeft const):
2759         (WebCore::Display::Box::bottomRight const):
2760         (WebCore::Display::Box::size const):
2761         (WebCore::Display::Box::width const):
2762         (WebCore::Display::Box::height const):
2763         (WebCore::Display::Box::setTopLeft):
2764         (WebCore::Display::Box::setTop):
2765         (WebCore::Display::Box::setLeft):
2766         (WebCore::Display::Box::setWidth):
2767         (WebCore::Display::Box::setHeight):
2768         (WebCore::Display::Box::Rect::invalidatePosition):
2769         (WebCore::Display::Box::Rect::setHasValidPosition):
2770         (WebCore::Display::Box::Rect::Rect):
2771         (WebCore::Display::Box::Rect::top const):
2772         (WebCore::Display::Box::Rect::left const):
2773         (WebCore::Display::Box::Rect::bottom const):
2774         (WebCore::Display::Box::Rect::right const):
2775         (WebCore::Display::Box::Rect::topLeft const):
2776         (WebCore::Display::Box::Rect::bottomRight const):
2777         (WebCore::Display::Box::Rect::size const):
2778         (WebCore::Display::Box::Rect::width const):
2779         (WebCore::Display::Box::Rect::height const):
2780         (WebCore::Display::Box::Rect::setTopLeft):
2781         (WebCore::Display::Box::Rect::setTop):
2782         (WebCore::Display::Box::Rect::setLeft):
2783         (WebCore::Display::Box::Rect::setWidth):
2784         (WebCore::Display::Box::Rect::setHeight):
2785         (WebCore::Display::Box::Rect::shiftLeftTo):
2786         (WebCore::Display::Box::Rect::shiftRightTo):
2787         (WebCore::Display::Box::Rect::shiftTopTo):
2788         (WebCore::Display::Box::Rect::shiftBottomTo):
2789         (WebCore::Display::Box::Rect::expand):
2790         (WebCore::Display::Box::invalidateTop): Deleted.
2791         (WebCore::Display::Box::invalidateLeft): Deleted.
2792         (WebCore::Display::Box::invalidateWidth): Deleted.
2793         (WebCore::Display::Box::invalidateHeight): Deleted.
2794         (WebCore::Display::Box::hasValidPosition const): Deleted.
2795         (WebCore::Display::Box::hasValidSize const): Deleted.
2796         (WebCore::Display::Box::hasValidGeometry const): Deleted.
2797         (WebCore::Display::Box::invalidatePosition): Deleted.
2798         (WebCore::Display::Box::setHasValidPosition): Deleted.
2799
2800 2018-05-28  Zalan Bujtas  <zalan@apple.com>
2801
2802         [LFC] Add formatting context testing codepath in FrameViewLayoutContext
2803         https://bugs.webkit.org/show_bug.cgi?id=186036
2804
2805         Reviewed by Antti Koivisto.
2806
2807         This is to verify the formatting context layout correctness.
2808
2809         * layout/LayoutContext.cpp:
2810         (WebCore::Layout::LayoutContext::LayoutContext):
2811         (WebCore::Layout::LayoutContext::initializeRoot):
2812         * layout/LayoutContext.h:
2813         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
2814         * page/FrameViewLayoutContext.cpp:
2815         (WebCore::layoutUsingFormattingContext):
2816         (WebCore::FrameViewLayoutContext::layout):
2817
2818 2018-05-28  Zalan Bujtas  <zalan@apple.com>
2819
2820         [LFC] Add layout tree verification.
2821         https://bugs.webkit.org/show_bug.cgi?id=186018
2822
2823         Reviewed by Antti Koivisto.
2824
2825         Compare layout and render tree geometry and output the mismtaching rectangles.
2826
2827         * Sources.txt:
2828         * WebCore.xcodeproj/project.pbxproj: Add missing headers and make then private.
2829         * layout/LayoutContext.h:
2830         * layout/Verification.cpp: Added.
2831         (WebCore::Layout::outputMismatchedBoxInformationIfNeeded):
2832         (WebCore::Layout::verifySubtree):
2833         (WebCore::Layout::LayoutContext::verifyAndOutputLayoutTree const):
2834
2835 2018-05-28  Sam Weinig  <sam@webkit.org>
2836
2837         Modernize SVGRenderStyleDefs.h
2838         https://bugs.webkit.org/show_bug.cgi?id=186024
2839
2840         Reviewed by Daniel Bates.
2841
2842         Modernized the set of enums in SVGRenderStyleDefs.h and WindRule.h by:
2843             - Converting them to enum classes
2844             - Renaming them to remove unnecessary prefix 'E's
2845             - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal)
2846             - Renaming to match modern conventions (e.g BNONE -> None)
2847
2848         Modernizes the following enums:
2849             SVGPaintType
2850             BaselineShift (renamed from EBaselineShift)
2851             TextAnchor (renamed from ETextAnchor)
2852             ColorInterpolation (renamed from EColorInterpolation)
2853             ColorRendering (renamed from EColorRendering)
2854             ShapeRendering (renamed from EShapeRendering)
2855             GlyphOrientation (renamed from EGlyphOrientation)
2856             AlignmentBaseline (renamed from EAlignmentBaseline)
2857             DominantBaseline (renamed from EDominantBaseline)
2858             VectorEffect (renamed from EVectorEffect)
2859             BufferedRendering (renamed from EBufferedRendering)
2860             MaskType (renamed from EMaskType)
2861             WindRule
2862
2863         * css/CSSBasicShapes.cpp:
2864         (WebCore::buildPathString):
2865         (WebCore::buildPolygonString):
2866         * css/CSSBasicShapes.h:
2867         * css/CSSPrimitiveValueMappings.h:
2868         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2869         (WebCore::CSSPrimitiveValue::operator WindRule const):
2870         (WebCore::CSSPrimitiveValue::operator AlignmentBaseline const):
2871         (WebCore::CSSPrimitiveValue::operator BufferedRendering const):
2872         (WebCore::CSSPrimitiveValue::operator ColorInterpolation const):
2873         (WebCore::CSSPrimitiveValue::operator ColorRendering const):
2874         (WebCore::CSSPrimitiveValue::operator DominantBaseline const):
2875         (WebCore::CSSPrimitiveValue::operator ShapeRendering const):
2876         (WebCore::CSSPrimitiveValue::operator TextAnchor const):
2877         (WebCore::CSSPrimitiveValue::operator VectorEffect const):
2878         (WebCore::CSSPrimitiveValue::operator MaskType const):
2879         (WebCore::CSSPrimitiveValue::operator EAlignmentBaseline const): Deleted.
2880         (WebCore::CSSPrimitiveValue::operator EBufferedRendering const): Deleted.
2881         (WebCore::CSSPrimitiveValue::operator EColorInterpolation const): Deleted.
2882         (WebCore::CSSPrimitiveValue::operator EColorRendering const): Deleted.
2883         (WebCore::CSSPrimitiveValue::operator EDominantBaseline const): Deleted.
2884         (WebCore::CSSPrimitiveValue::operator EShapeRendering const): Deleted.
2885         (WebCore::CSSPrimitiveValue::operator ETextAnchor const): Deleted.
2886         (WebCore::CSSPrimitiveValue::operator EVectorEffect const): Deleted.
2887         (WebCore::CSSPrimitiveValue::operator EMaskType const): Deleted.
2888         * css/SVGCSSComputedStyleDeclaration.cpp:
2889         (WebCore::glyphOrientationToCSSPrimitiveValue):
2890         (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
2891         (WebCore::ComputedStyleExtractor::svgPropertyValue):
2892         * css/StyleBuilderConverter.h:
2893         (WebCore::StyleBuilderConverter::convertGlyphOrientation):
2894         (WebCore::StyleBuilderConverter::convertGlyphOrientationOrAuto):
2895         * css/StyleBuilderCustom.h:
2896         (WebCore::StyleBuilderCustom::applyValueBaselineShift):
2897         (WebCore::StyleBuilderCustom::applyValueFill):
2898         (WebCore::StyleBuilderCustom::applyValueStroke):
2899         * css/parser/CSSPropertyParser.cpp:
2900         (WebCore::consumeBasicShapePolygon):
2901         (WebCore::consumeBasicShapePath):
2902         * html/canvas/CanvasRenderingContext2DBase.cpp:
2903         (WebCore::toWindRule):
2904         * page/animation/CSSPropertyAnimation.cpp:
2905         (WebCore::PropertyWrapperSVGPaint::PropertyWrapperSVGPaint):
2906         * platform/graphics/FloatPolygon.cpp:
2907         (WebCore::FloatPolygon::contains const):
2908         * platform/graphics/GraphicsContext.cpp:
2909         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2910         * platform/graphics/GraphicsContext.h:
2911         * platform/graphics/GraphicsLayer.cpp:
2912         (WebCore::GraphicsLayer::shapeLayerWindRule const):
2913         * platform/graphics/GraphicsLayer.h:
2914         * platform/graphics/GraphicsTypes.cpp:
2915         (WebCore::operator<<):
2916         * platform/graphics/Path.h:
2917         * platform/graphics/ShadowBlur.cpp:
2918         (WebCore::ShadowBlur::drawInsetShadow):
2919         (WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
2920         (WebCore::ShadowBlur::drawInsetShadowWithTiling):
2921         * platform/graphics/WindRule.h:
2922         (): Deleted.
2923         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2924         (PlatformCALayerCocoa::shapeWindRule const):
2925         (PlatformCALayerCocoa::setShapeWindRule):
2926         * platform/graphics/cg/GraphicsContextCG.cpp:
2927         (WebCore::calculateDrawingMode):
2928         (WebCore::GraphicsContext::fillPath):
2929         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2930         (WebCore::GraphicsContext::clipPath):
2931         * platform/graphics/cg/PathCG.cpp:
2932         (WebCore::Path::contains const):
2933         * platform/mock/MockRealtimeVideoSource.cpp:
2934         (WebCore::MockRealtimeVideoSource::drawAnimation):
2935         * rendering/FilterEffectRenderer.cpp:
2936         (WebCore::FilterEffectRenderer::buildReferenceFilter):
2937         * rendering/RenderBoxModelObject.cpp:
2938         (WebCore::RenderBoxModelObject::paintBorder):
2939         (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
2940         * rendering/RenderElement.cpp:
2941         (WebCore::RenderElement::paintOutline):
2942         * rendering/RenderLayer.cpp:
2943         (WebCore::RenderLayer::computeClipPath const):
2944         * rendering/style/BasicShapes.h:
2945         (WebCore::BasicShape::windRule const):
2946         * rendering/style/RenderStyle.h:
2947         (WebCore::RenderStyle::fillPaintType const):
2948         (WebCore::RenderStyle::setFillPaintColor):
2949         (WebCore::RenderStyle::strokePaintType const):
2950         (WebCore::RenderStyle::setStrokePaintColor):
2951         * rendering/style/SVGRenderStyle.h:
2952         (WebCore::SVGRenderStyle::initialAlignmentBaseline):
2953         (WebCore::SVGRenderStyle::initialDominantBaseline):
2954         (WebCore::SVGRenderStyle::initialBaselineShift):
2955         (WebCore::SVGRenderStyle::initialVectorEffect):
2956         (WebCore::SVGRenderStyle::initialBufferedRendering):
2957         (WebCore::SVGRenderStyle::initialClipRule):
2958         (WebCore::SVGRenderStyle::initialColorInterpolation):
2959         (WebCore::SVGRenderStyle::initialColorInterpolationFilters):
2960         (WebCore::SVGRenderStyle::initialColorRendering):
2961         (WebCore::SVGRenderStyle::initialFillRule):
2962         (WebCore::SVGRenderStyle::initialShapeRendering):
2963         (WebCore::SVGRenderStyle::initialTextAnchor):
2964         (WebCore::SVGRenderStyle::initialGlyphOrientationHorizontal):
2965         (WebCore::SVGRenderStyle::initialGlyphOrientationVertical):
2966         (WebCore::SVGRenderStyle::initialFillPaintType):
2967         (WebCore::SVGRenderStyle::initialStrokePaintType):
2968         (WebCore::SVGRenderStyle::initialMaskType):
2969         (WebCore::SVGRenderStyle::setAlignmentBaseline):
2970         (WebCore::SVGRenderStyle::setDominantBaseline):
2971         (WebCore::SVGRenderStyle::setBaselineShift):
2972         (WebCore::SVGRenderStyle::setVectorEffect):
2973         (WebCore::SVGRenderStyle::setBufferedRendering):
2974         (WebCore::SVGRenderStyle::setClipRule):
2975         (WebCore::SVGRenderStyle::setColorInterpolation):
2976         (WebCore::SVGRenderStyle::setColorInterpolationFilters):
2977         (WebCore::SVGRenderStyle::setColorRendering):
2978         (WebCore::SVGRenderStyle::setFillRule):
2979         (WebCore::SVGRenderStyle::setShapeRendering):
2980         (WebCore::SVGRenderStyle::setTextAnchor):
2981         (WebCore::SVGRenderStyle::setGlyphOrientationHorizontal):
2982         (WebCore::SVGRenderStyle::setGlyphOrientationVertical):
2983         (WebCore::SVGRenderStyle::setMaskType):
2984         (WebCore::SVGRenderStyle::alignmentBaseline const):
2985         (WebCore::SVGRenderStyle::dominantBaseline const):
2986         (WebCore::SVGRenderStyle::baselineShift const):
2987         (WebCore::SVGRenderStyle::vectorEffect const):
2988         (WebCore::SVGRenderStyle::bufferedRendering const):
2989         (WebCore::SVGRenderStyle::clipRule const):
2990         (WebCore::SVGRenderStyle::colorInterpolation const):
2991         (WebCore::SVGRenderStyle::colorInterpolationFilters const):
2992         (WebCore::SVGRenderStyle::colorRendering const):
2993         (WebCore::SVGRenderStyle::fillRule const):
2994         (WebCore::SVGRenderStyle::shapeRendering const):
2995         (WebCore::SVGRenderStyle::textAnchor const):
2996         (WebCore::SVGRenderStyle::glyphOrientationHorizontal const):
2997         (WebCore::SVGRenderStyle::glyphOrientationVertical const):
2998         (WebCore::SVGRenderStyle::fillPaintType const):
2999         (WebCore::SVGRenderStyle::strokePaintType const):
3000         (WebCore::SVGRenderStyle::maskType const):
3001         (WebCore::SVGRenderStyle::visitedLinkFillPaintType const):
3002         (WebCore::SVGRenderStyle::visitedLinkStrokePaintType const):
3003         (WebCore::SVGRenderStyle::hasStroke const):
3004         (WebCore::SVGRenderStyle::hasFill const):
3005         (WebCore::SVGRenderStyle::setBitDefaults):
3006         * rendering/style/SVGRenderStyleDefs.h:
3007         (WebCore::StyleFillData::create):
3008         (WebCore::StyleFillData::operator!= const):
3009         (WebCore::StyleStrokeData::create):
3010         (WebCore::StyleStrokeData::operator!= const):
3011         (WebCore::StyleStopData::create):
3012         (WebCore::StyleStopData::operator!= const):
3013         (WebCore::StyleTextData::create):
3014         (WebCore::StyleTextData::operator!= const):
3015         (WebCore::StyleMiscData::create):
3016         (WebCore::StyleMiscData::operator!= const):
3017         (WebCore::StyleShadowSVGData::create):
3018         (WebCore::StyleShadowSVGData::operator!= const):
3019         (WebCore::StyleResourceData::create):
3020         (WebCore::StyleResourceData::operator!= const):
3021         (WebCore::StyleInheritedResourceData::create):
3022         (WebCore::StyleInheritedResourceData::operator!= const):
3023         (WebCore::StyleLayoutData::create):
3024         (WebCore::StyleLayoutData::operator!= const):
3025         (): Deleted.
3026         * rendering/svg/RenderSVGImage.cpp:
3027         (WebCore::RenderSVGImage::paint):
3028         * rendering/svg/RenderSVGRect.cpp:
3029         (WebCore::RenderSVGRect::updateShapeFromElement):
3030         * rendering/svg/RenderSVGResource.cpp:
3031         (WebCore::requestPaintingResource):
3032         * rendering/svg/RenderSVGResourceClipper.cpp:
3033         (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
3034         * rendering/svg/RenderSVGResourceFilter.cpp:
3035         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
3036         * rendering/svg/RenderSVGResourceGradient.cpp:
3037         (WebCore::RenderSVGResourceGradient::applyResource):
3038         * rendering/svg/RenderSVGResourceMasker.cpp:
3039         (WebCore::RenderSVGResourceMasker::applyResource):
3040         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
3041         * rendering/svg/RenderSVGResourcePattern.cpp:
3042         (WebCore::RenderSVGResourcePattern::applyResource):
3043         * rendering/svg/RenderSVGShape.cpp:
3044         (WebCore::RenderSVGShape::paint):
3045         * rendering/svg/RenderSVGShape.h:
3046         (WebCore::RenderSVGShape::hasNonScalingStroke const):
3047         * rendering/svg/SVGRenderTreeAsText.cpp:
3048         (WebCore::writeStyle):
3049         (WebCore::writeSVGInlineTextBox):
3050         * rendering/svg/SVGResources.cpp:
3051         (WebCore::paintingResourceFromSVGPaint):
3052         * rendering/svg/SVGTextChunk.cpp:
3053         (WebCore::SVGTextChunk::SVGTextChunk):
3054         * rendering/svg/SVGTextLayoutEngineBaseline.cpp:
3055         (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift const):
3056         (WebCore::SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBaseline const):
3057         (WebCore::SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift const):
3058         (WebCore::SVGTextLayoutEngineBaseline::calculateGlyphOrientationAngle const):
3059         * rendering/svg/SVGTextLayoutEngineBaseline.h:
3060
3061 2018-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3062
3063         [Web Animations] Test webanimations/css-animations.html is crashing
3064         https://bugs.webkit.org/show_bug.cgi?id=186031
3065
3066         Reviewed by Antoine Quint.
3067
3068         This is another case of std::optional value being used while it's nullopt, I guess this started to fail when we
3069         stopped using the WTF implementation of std::optional. The problem is that we try to get the current iteration
3070         of a declarative animation when the active time is unresolved.
3071
3072         * animation/DeclarativeAnimation.cpp:
3073         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Use value_or(0) instead of value() to get the current
3074         iteration of the effect.
3075
3076 2018-05-28  Thibault Saunier  <tsaunier@igalia.com>
3077
3078         [GStreamer] Handle changes in the "drm-preferred-decryption-system-id" NEED_CONTEXT message.
3079         https://bugs.webkit.org/show_bug.cgi?id=185948
3080
3081         Reviewed by Xabier Rodriguez-Calvar.
3082
3083         - The "stream-encryption-systems" field of the "drm-preferred-decryption-system-id" query was renamed to
3084           "avalaible-stream-encryption-systems"
3085         - It can now be NULL, meaning there is no decryptor avalaible.
3086
3087         Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-*
3088
3089         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3090         (WebCore::extractEventsAndSystemsFromMessage): Handle NULL value for "avalaible-stream-encryption-systems",
3091         moved some code to make the order of the Arrays in the pair clearer.
3092
3093 2018-05-27  Dan Bernstein  <mitz@apple.com>
3094
3095         Reverted the changes made for https://webkit.org/b/186016
3096
3097         They broke the USE(APPLE_INTERNAL_SDK) Sierra build.
3098
3099 2018-05-27  David Kilzer  <ddkilzer@apple.com>
3100
3101         [iOS] Fix warnings about leaks found by clang static analyzer
3102         <https://webkit.org/b/186009>
3103         <rdar://problem/40574267>
3104
3105         Reviewed by Daniel Bates.
3106
3107         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
3108         (WebCore::LocalAuthenticator::makeCredential):
3109         (WebCore::LocalAuthenticator::getAssertion):
3110         (WebCore::LocalAuthenticator::issueClientCertificate const):
3111         - Don't leak CF objects in early return paths, and get rid of
3112           `retained*` variables, by making original variables use
3113           RetainPtr<>.
3114         * bridge/objc/WebScriptObject.mm:
3115         (+[WebUndefined allocWithZone:]): Modernize WebUndefined by
3116         using NeverDestroyed<RetainPr<WebUndefined>> type.  Explicitly
3117         retain the object returned on each call.
3118         (+[WebUndefined undefined]): Explicitly autorelease the object
3119         returned.  Note that neither of these changes fixes the static
3120         analyzer warnings in this source file.
3121         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3122         (WebCore::exernalDeviceDisplayNameForPlayer): Use RetainPtr<> to
3123         stop leaking NSString objects in a loop.
3124         * platform/ios/wak/WAKWindow.h:
3125         (-[WAKWindow _newFirstResponderAfterResigning]): Mark as
3126         NS_RETURNS_NOT_RETAINED like the corresponding AppKit method
3127         since this doesn't return a new object.  This fixes some
3128         false-positive leaks warnings.
3129
3130 2018-05-27  Dan Bernstein  <mitz@apple.com>
3131
3132         [Cocoa] Avoid importing directly from subumbrella frameworks
3133         https://bugs.webkit.org/show_bug.cgi?id=186016
3134
3135         Reviewed by Sam Weinig.
3136
3137         * Configurations/WebCore.xcconfig: Removed -iframework options from OTHER_CFLAGS and
3138           OTHER_CPLUSPLUSFLAGS.
3139         * editing/mac/DictionaryLookup.mm: Import Quartz.h instead of a PDFKit header.
3140         * html/HTMLKeygenElement.cpp: Removed "using namespace WebCore" from this WebCore
3141           implementation file.
3142         * platform/mac/PlatformEventFactoryMac.mm: Import Carbon.h instead of HIToolbox headers.
3143         * platform/mac/PlatformScreenMac.mm: Import ApplicationServices.h instead of ColorSync.h
3144           when using SDKs earlier than 10.13.
3145         * platform/mediastream/CaptureDeviceManager.cpp: Enclosed the definitions in the WebCore
3146           namespace and removed "using namespace WebCore" from this WebCore implementation file.
3147         * platform/text/mac/TextEncodingRegistryMac.mm: Import Carbon.h instead of CarbonCore.h.
3148
3149 2018-05-27  Fujii Hironori  <Hironori.Fujii@sony.com>
3150
3151         REGRESSION(r232198) [WinCairo] cannot convert from 'WTF::StringView' to 'const WTF::String'
3152         https://bugs.webkit.org/show_bug.cgi?id=186027
3153
3154         Unreviewed build fix
3155
3156         No new tests (No behavior change).
3157
3158         * platform/network/curl/AuthenticationChallengeCurl.cpp:
3159         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
3160         * platform/network/curl/CurlRequest.cpp:
3161         (WebCore::CurlRequest::setupTransfer):
3162         (WebCore::CurlRequest::willSetupSslCtx):
3163
3164 2018-05-27  Sam Weinig  <sam@webkit.org>
3165
3166         Modernize RenderStyleConstants.h - Part 3
3167         https://bugs.webkit.org/show_bug.cgi?id=186015
3168
3169         Reviewed by Yusuke Suzuki.
3170
3171         Modernized the third and final set of enums in RenderStyleConstants.h by:
3172             - Converting them to enum classes
3173             - Renaming them to remove unnecessary prefix 'E's
3174             - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal)
3175
3176         Modernizes the following enums:
3177             TextDecoration
3178             TextDecorationSkip (renamed from TextDecorationSkipItems)
3179             TextUnderlinePosition
3180             HangingPunctuation
3181             SpeakAs (renamed from ESpeakAs)
3182             TextEmphasisPosition (renamed from TextEmphasisPositions)
3183
3184         This final set of enums are mostly (TextUnderlinePosition isn't really) used as bitmasks,
3185         so this change also converts their uses to use OptionSet. 
3186
3187         * accessibility/AccessibilityObject.h:
3188         (WebCore::AccessibilityObject::speakAsProperty const):
3189         * accessibility/AccessibilityRenderObject.cpp:
3190         (WebCore::AccessibilityRenderObject::speakAsProperty const):
3191         (WebCore::AccessibilityRenderObject::hasPlainText const):
3192         (WebCore::AccessibilityRenderObject::hasUnderline const):
3193         * accessibility/AccessibilityRenderObject.h:
3194         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3195         (AXAttributeStringSetStyle):
3196         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3197         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
3198         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3199         (AXAttributeStringSetStyle):
3200         * css/CSSComputedStyleDeclaration.cpp:
3201         (WebCore::renderTextDecorationFlagsToCSSValue):
3202         (WebCore::renderTextDecorationSkipFlagsToCSSValue):
3203         (WebCore::renderEmphasisPositionFlagsToCSSValue):
3204         (WebCore::speakAsToCSSValue):
3205         (WebCore::hangingPunctuationToCSSValue):
3206         * css/CSSLineBoxContainValue.h:
3207         * css/CSSPrimitiveValueMappings.h:
3208         (WebCore::CSSPrimitiveValue::operator HangingPunctuation const):
3209         (WebCore::CSSPrimitiveValue::operator TextDecoration const):
3210         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3211         (WebCore::CSSPrimitiveValue::operator TextUnderlinePosition const):
3212         (WebCore::CSSPrimitiveValue::operator SpeakAs const):
3213         (WebCore::CSSPrimitiveValue::operator ESpeakAs const): Deleted.
3214         * css/StyleBuilderConverter.h:
3215         (WebCore::StyleBuilderConverter::convertTextDecoration):
3216         (WebCore::StyleBuilderConverter::valueToEmphasisPosition):
3217         (WebCore::StyleBuilderConverter::convertTextEmphasisPosition):
3218         (WebCore::StyleBuilderConverter::convertTextUnderlinePosition):
3219         (WebCore::StyleBuilderConverter::valueToDecorationSkip):
3220         (WebCore::StyleBuilderConverter::convertTextDecorationSkip):
3221         (WebCore::StyleBuilderConverter::convertSpeakAs):
3222         (WebCore::StyleBuilderConverter::convertHangingPunctuation):
3223         * editing/cocoa/EditorCocoa.mm:
3224         (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle const):
3225         * editing/cocoa/HTMLConverter.mm:
3226         (WebCore::editingAttributedStringFromRange):
3227         * rendering/InlineFlowBox.cpp:
3228         (WebCore::InlineFlowBox::maxLogicalBottomForTextDecorationLine const):
3229         (WebCore::InlineFlowBox::minLogicalTopForTextDecorationLine const):
3230         * rendering/InlineFlowBox.h:
3231         * rendering/InlineTextBox.cpp:
3232         (WebCore::emphasisPositionHasNeitherLeftNorRight):
3233         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
3234         (WebCore::InlineTextBox::paint):
3235         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3236         * rendering/RenderBlockFlow.cpp:
3237         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
3238         * rendering/RenderBlockLineLayout.cpp:
3239         (WebCore::setLogicalWidthForTextRun):
3240         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
3241         * rendering/RenderElement.cpp:
3242         (WebCore::RenderElement::enclosingRendererWithTextDecoration const):
3243         * rendering/RenderElement.h:
3244         * rendering/RenderTableSection.cpp:
3245         (WebCore::RenderTableSection::addCell):
3246         * rendering/SimpleLineLayout.cpp:
3247         (WebCore::SimpleLineLayout::canUseForStyle):
3248         (WebCore::SimpleLineLayout::canUseForWithReason):
3249         * rendering/SimpleLineLayoutFunctions.cpp:
3250         (WebCore::SimpleLineLayout::paintFlow):
3251         * rendering/TextDecorationPainter.cpp:
3252         (WebCore::TextDecorationPainter::TextDecorationPainter):
3253         (WebCore::TextDecorationPainter::paintTextDecoration):
3254         (WebCore::collectStylesForRenderer):
3255         (WebCore::TextDecorationPainter::stylesForRenderer):
3256         * rendering/TextDecorationPainter.h:
3257         * rendering/TextPaintStyle.cpp:
3258         (WebCore::computeTextPaintStyle):
3259         * rendering/line/BreakingContext.h:
3260         (WebCore::BreakingContext::handleText):
3261         * rendering/style/RenderStyle.cpp:
3262         (WebCore::RenderStyle::RenderStyle):
3263         (WebCore::RenderStyle::changeAffectsVisualOverflow const):
3264         * rendering/style/RenderStyle.h:
3265         (WebCore::RenderStyle::textDecorationsInEffect const):
3266         (WebCore::RenderStyle::textDecoration const):
3267         (WebCore::RenderStyle::textDecorationSkip const):
3268         (WebCore::RenderStyle::hangingPunctuation const):
3269         (WebCore::RenderStyle::textEmphasisPosition const):
3270         (WebCore::RenderStyle::speakAs const):
3271         (WebCore::RenderStyle::addToTextDecorationsInEffect):
3272         (WebCore::RenderStyle::setTextDecorationsInEffect):
3273         (WebCore::RenderStyle::setTextDecoration):
3274         (WebCore::RenderStyle::setTextDecorationSkip):
3275         (WebCore::RenderStyle::setSpeakAs):
3276         (WebCore::RenderStyle::setTextEmphasisPosition):
3277         (WebCore::RenderStyle::setHangingPunctuation):
3278         (WebCore::RenderStyle::initialHangingPunctuation):
3279         (WebCore::RenderStyle::initialTextDecoration):
3280         (WebCore::RenderStyle::initialTextDecorationSkip):
3281         (WebCore::RenderStyle::initialTextUnderlinePosition):
3282         (WebCore::RenderStyle::initialSpeakAs):
3283         (WebCore::RenderStyle::initialTextEmphasisPosition):
3284         * rendering/style/RenderStyleConstants.h:
3285         (WebCore::operator|): Deleted.
3286         (WebCore::operator|=): Deleted.
3287         * rendering/style/StyleRareInheritedData.cpp:
3288         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3289         * rendering/style/StyleVisualData.cpp:
3290         (WebCore::StyleVisualData::StyleVisualData):
3291         * rendering/svg/SVGInlineTextBox.cpp:
3292         (WebCore::SVGInlineTextBox::paint):
3293         (WebCore::positionOffsetForDecoration):
3294         (WebCore::thicknessForDecoration):
3295         (WebCore::findRendererDefininingTextDecoration):
3296         (WebCore::SVGInlineTextBox::paintDecoration):
3297         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
3298         * rendering/svg/SVGInlineTextBox.h:
3299         * style/InlineTextBoxStyle.cpp:
3300         (WebCore::computeUnderlineOffset):
3301         (WebCore::visualOverflowForDecorations):
3302
3303 2018-05-26  Zalan Bujtas  <zalan@apple.com>
3304
3305         [LFC] Implement margin computation
3306         https://bugs.webkit.org/show_bug.cgi?id=186008
3307
3308         Reviewed by Antti Koivisto.
3309
3310         * WebCore.xcodeproj/project.pbxproj:
3311         * layout/FormattingContext.cpp:
3312         (WebCore::Layout::FormattingContext::computeMargin const):
3313         (WebCore::Layout::FormattingContext::marginTop const): Deleted.
3314         (WebCore::Layout::FormattingContext::marginLeft const): Deleted.
3315         (WebCore::Layout::FormattingContext::marginBottom const): Deleted.
3316         (WebCore::Layout::FormattingContext::marginRight const): Deleted.
3317         * layout/FormattingContext.h:
3318         * layout/blockformatting/BlockFormattingContext.cpp:
3319         (WebCore::Layout::BlockFormattingContext::layout const):
3320         (WebCore::Layout::BlockFormattingContext::computeMargin const):
3321         (WebCore::Layout::BlockFormattingContext::marginTop const): Deleted.
3322         (WebCore::Layout::BlockFormattingContext::marginBottom const): Deleted.
3323         * layout/blockformatting/BlockFormattingContext.h:
3324         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3325         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight):
3326         (WebCore::Layout::BlockFormattingContext::Geometry::computedMargin):
3327         * layout/blockformatting/BlockMarginCollapse.cpp:
3328         (WebCore::Layout::_isMarginBottomCollapsedWithParent):
3329         (WebCore::Layout::collapsedMarginBottomFromLastChild):
3330         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
3331         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
3332         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3333         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
3334         (WebCore::Layout::BlockMarginCollapse::marginTop): Deleted.
3335         (WebCore::Layout::BlockMarginCollapse::marginBottom): Deleted.
3336         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent): Deleted.
3337         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted.
3338         * layout/blockformatting/BlockMarginCollapse.h: Removed.
3339
3340 2018-05-25  Myles C. Maxfield  <mmaxfield@apple.com>
3341
3342         [Cocoa] Delete unnecessary WebCascadeList in ComplexTextController
3343         https://bugs.webkit.org/show_bug.cgi?id=186007
3344
3345         Reviewed by Zalan Bujtas.
3346
3347         Inside ComplexTextController::collectComplexTextRuns(), we chop up text based on which fonts should be
3348         used to render which grapheme clusters. For each grapheme cluster, we run through the font-family list
3349         in FontCascade::fontForCombiningCharacterSequence() and find the first font that can render the cluster.
3350         If no items can render the cluster, we construct a WebCascadeList and let CoreText try to figure out
3351         which fonts can render which clusters.
3352
3353         Except there's no point, because we just determined that no font in the list can be used to render the
3354         cluster. CoreText isn't magic; it isn't going to somehow disagree with us. WebCascadeList is just
3355         useless code.
3356
3357         No new tests because there is no behavior change.
3358
3359         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3360         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3361         (-[WebCascadeList initWithFont:character:]): Deleted.
3362         (-[WebCascadeList count]): Deleted.
3363         (-[WebCascadeList objectAtIndex:]): Deleted.
3364
3365 2018-05-25  Myles C. Maxfield  <mmaxfield@apple.com>
3366
3367         Improve the performance of Font::canRenderCombiningCharacterSequence()
3368         https://bugs.webkit.org/show_bug.cgi?id=185933
3369
3370         Reviewed by Ryosuke Niwa.
3371
3372         We don't need to create a whole CTLine just to determine whether or not a font supports rendering a grapheme cluster.
3373         Instead, the right way to do it is just see if the font's cmap table supports every code point in the cluster.
3374
3375         This patch reports a 2% progression on the attached PerformanceTest.
3376
3377         Test: Layout/ComplexLongUnique.html
3378
3379         * platform/graphics/Font.cpp:
3380         (WebCore::Font::canRenderCombiningCharacterSequence const):
3381         * platform/graphics/Font.h:
3382         * platform/graphics/cocoa/FontCocoa.mm:
3383         (WebCore::provideStringAndAttributes): Deleted.
3384         (WebCore::Font::canRenderCombiningCharacterSequence const): Deleted.
3385         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3386         (WebCore::Font::canRenderCombiningCharacterSequence const): Deleted.
3387
3388 2018-05-25  Eric Carlson  <eric.carlson@apple.com>
3389
3390         Captions are sized incorrectly in PiP mode
3391         https://bugs.webkit.org/show_bug.cgi?id=186005
3392         <rdar://problem/39729718>
3393
3394         Reviewed by Dean Jackson.
3395
3396         * html/shadow/MediaControlElements.cpp:
3397         (WebCore::MediaControlTextTrackContainerElement::updateSizes): Only sync text track bounds 
3398         when the size actually changes.
3399
3400         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
3401         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): Call syncTextTrackBounds.
3402         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): Set the text track layer size
3403         to m_videoFullscreenFrame, it is always set the size of the PiP/Fullscreen layer.
3404
3405 2018-05-25  Timothy Hatcher  <timothy@apple.com>
3406
3407         Setting drawsBackground to YES on a WKView doesn't take effect immediately
3408         https://bugs.webkit.org/show_bug.cgi?id=185885
3409         rdar://problem/39706506
3410
3411         Reviewed by Simon Fraser.
3412
3413         * page/Frame.cpp:
3414         (WebCore::Frame::createView): Always call updateBackgroundRecursively, it handles
3415         invalid colors correctly already.
3416         * page/FrameView.cpp:
3417         (WebCore::FrameView::setTransparent): Call setNeedsLayout() since base background color
3418         and transparent is used to update layers.
3419         (WebCore::FrameView::setBaseBackgroundColor): Ditto.
3420         (WebCore::FrameView::updateBackgroundRecursively): Schedule layout if needed.
3421         * page/FrameView.h:
3422         * rendering/RenderLayerCompositor.cpp:
3423         (WebCore::RenderLayerCompositor::viewHasTransparentBackground const): Use baseBackgroundColor
3424         instead of hardcoding white.
3425         (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Fixed incorrect changed logging.
3426
3427 2018-05-25  Youenn Fablet  <youenn@apple.com>
3428
3429         Migrate From-Origin to Cross-Origin-Resource-Policy
3430         https://bugs.webkit.org/show_bug.cgi?id=185840
3431
3432         Reviewed by Chris Dumez.
3433
3434         Tests: http/wpt/cross-origin-resource-policy/fetch-in-iframe.html
3435                http/wpt/cross-origin-resource-policy/fetch.html
3436                http/wpt/cross-origin-resource-policy/iframe-loads.html
3437                http/wpt/cross-origin-resource-policy/image-loads.html
3438                http/wpt/cross-origin-resource-policy/script-loads.html
3439
3440         * platform/network/HTTPHeaderNames.in:
3441         * platform/network/HTTPParsers.cpp:
3442         (WebCore::parseCrossOriginResourcePolicyHeader):
3443         * platform/network/HTTPParsers.h:
3444
3445 2018-05-25  Daniel Bates  <dabates@apple.com>
3446
3447         NavigationAction should not hold a strong reference to a Document
3448         https://bugs.webkit.org/show_bug.cgi?id=185712
3449         <rdar://problem/40320916>
3450
3451         Reviewed by Brent Fulgham.
3452
3453         Have NavigationAction store all the relevant details callers need to know about the document
3454         that initiated the navigation in an independent data structure, called NavigationAction::Requester,
3455         as opposed to holding a RefPtr to the document itself. The benefit of this approach is that it
3456         is a step towards ensuring that NavigationAction does not keep the document alive after navigating
3457         to a new document given that DocumentLoader stores the NavigationAction for the last navigation.
3458
3459         * loader/NavigationAction.cpp:
3460         (WebCore::NavigationAction::Requester::Requester): Track all relevant details of the document that
3461         requested this navigation that are needed to support WebKit API/SPI. We hold the SecurityOrigin in
3462         a RefPtr to avoid the need to explicitly define a copy constructor and copy-assignment constructor
3463         because Requester needs to be copyable as NavigationAction, which owns a Requester, is copyable.
3464         (WebCore::shouldTreatAsSameOriginNavigation): Fix some style nits.
3465         (WebCore::NavigationAction::NavigationAction): Instantiate a Requester from the specified document.
3466         * loader/NavigationAction.h:
3467         (WebCore::NavigationAction::Requester::url const): Added.
3468         (WebCore::NavigationAction::Requester::securityOrigin const): Added.
3469         (WebCore::NavigationAction::Requester::pageID const): Added.
3470         (WebCore::NavigationAction::Requester::frameID const): Added.
3471         (WebCore::NavigationAction::requester const): Returns details about the document that requested
3472         this navigation, if applicable.
3473         (WebCore::NavigationAction::isEmpty const): Update criterion for being empty to consider the
3474         requester.
3475         (WebCore::NavigationAction::setOpener): Extracted out the datatype of the parameter into a
3476         type alias to avoid duplication and updated this code to use the alias.
3477         (WebCore::NavigationAction::opener const): Ditto.
3478         (WebCore::NavigationAction::sourceDocument const): Deleted.
3479
3480 2018-05-25  Jeremy Jones  <jeremyj@apple.com>
3481
3482         Fullscreen element can be clipped by ancestor.
3483         https://bugs.webkit.org/show_bug.cgi?id=185980
3484         rdar://problem/40320006
3485
3486         Reviewed by Jer Noble.
3487
3488         Adds style to fullscreen css to prevent the fullscreen element from being clipped by an ancestor element.
3489
3490         * css/fullscreen.css:
3491         (:-webkit-full-screen-ancestor:not(iframe)):
3492
3493 2018-05-25  Jeremy Jones  <jeremyj@apple.com>
3494
3495         Use correct AVKit delegate for picture in picture failure.
3496         https://bugs.webkit.org/show_bug.cgi?id=185981
3497         rdar://problem/40549652
3498
3499         Reviewed by Eric Carlson.
3500
3501         No new tests since we don't have a way to simulate picture-in-picture failure.
3502
3503         Use the new name for this delegate callback.
3504
3505         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3506         (-[WebAVPlayerViewControllerDelegate playerViewController:failedToStartPictureInPictureWithError:]):
3507         (-[WebAVPlayerViewControllerDelegate playerViewControllerFailedToStartPictureInPicture:withError:]): Deleted.
3508
3509 2018-05-25  Zalan Bujtas  <zalan@apple.com>
3510
3511         iBooks: text can disappear/flash during finger drag highlight
3512         https://bugs.webkit.org/show_bug.cgi?id=185993
3513         <rdar://problem/34026943>
3514
3515         Reviewed by Simon Fraser.
3516
3517         Reuse existing tiles when override rect is fully covered by the active grid.
3518         Also, recover dropped tiles if override rect forces us to create new ones. 
3519
3520         Unable to create a reproducible test case.
3521
3522         * platform/ios/LegacyTileCache.h:
3523         * platform/ios/LegacyTileCache.mm:
3524         (WebCore::LegacyTileCache::setOverrideVisibleRect):
3525         * platform/ios/LegacyTileLayer.mm:
3526         (-[LegacyTileHostLayer renderInContext:]):
3527
3528 2018-05-25  Eric Carlson  <eric.carlson@apple.com>
3529
3530         Encode ISOWebVTTCue "strings" when logging
3531         https://bugs.webkit.org/show_bug.cgi?id=185991
3532         <rdar://problem/40563902>
3533
3534         Reviewed by Jer Noble.
3535
3536         * platform/graphics/iso/ISOVTTCue.cpp:
3537         (WebCore::ISOWebVTTCue::toJSONString const): Use encodeWithURLEscapeSequences for all Strings
3538         taken from ISO boxes.
3539
3540 2018-05-25  Alex Christensen  <achristensen@webkit.org>
3541
3542         URL::host should return a StringView to reduce allocations
3543         https://bugs.webkit.org/show_bug.cgi?id=185986
3544
3545         Reviewed by Geoff Garen.
3546
3547         No change in behaviour.  Just fewer allocations.
3548
3549         * Modules/plugins/YouTubePluginReplacement.cpp:
3550         (WebCore::isYouTubeURL):
3551         (WebCore::processAndCreateYouTubeURL):
3552         * Modules/websockets/WebSocketHandshake.cpp:
3553         (WebCore::hostName):
3554         (WebCore::WebSocketHandshake::host const):
3555         * contentextensions/ContentExtension.cpp:
3556         (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
3557         * html/HTMLAnchorElement.cpp:
3558         (WebCore::HTMLAnchorElement::parseAttribute):
3559         * html/HTMLMediaElement.cpp:
3560         (WebCore::HTMLMediaElement::mediaSessionTitle const):
3561         (WebCore::needsSeekingSupportQuirk):
3562         * html/HTMLPlugInImageElement.cpp:
3563         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
3564         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot):
3565         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
3566         * html/ImageDocument.cpp:
3567         (WebCore::ImageDocument::finishedParsing):
3568         * html/URLUtils.h:
3569         (WebCore::URLUtils<T>::hostname const):
3570         * loader/FrameLoader.cpp:
3571         (WebCore::FrameLoader::setFirstPartyForCookies):
3572         * loader/LinkLoader.cpp:
3573         (WebCore::LinkLoader::loadLink):
3574         * loader/ResourceLoadStatistics.cpp:
3575         (WebCore::ResourceLoadStatistics::primaryDomain):
3576         * loader/mac/LoaderNSURLExtras.mm:
3577         (suggestedFilenameWithMIMEType):
3578         * page/Chrome.cpp:
3579         (WebCore::Chrome::mouseDidMoveOverElement):
3580         * page/Location.cpp:
3581         (WebCore::Location::hostname const):
3582         * page/Page.cpp:
3583         (WebCore::Page::mainFrameLoadStarted):
3584         * page/PerformanceMonitor.cpp:
3585         (WebCore::reportPageOverPostLoadResourceThreshold):
3586         * page/SecurityOrigin.cpp:
3587         (WebCore::isLoopbackIPAddress):
3588         (WebCore::shouldTreatAsPotentiallyTrustworthy):
3589         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress):
3590         * page/SecurityOrigin.h:
3591         * page/SecurityOriginData.h:
3592         (WebCore::SecurityOriginData::fromURL):
3593         * page/UserContentURLPattern.cpp:
3594         (WebCore::UserContentURLPattern::matchesHost const):
3595         * page/csp/ContentSecurityPolicySource.cpp:
3596         (WebCore::ContentSecurityPolicySource::hostMatches const):
3597         * platform/PublicSuffix.h:
3598         * platform/URL.cpp:
3599         (WebCore::URL::host const):
3600         (WebCore::URL::hostAndPort const):
3601         (WebCore::URL::isMatchingDomain const):
3602         * platform/URL.h:
3603         * platform/mac/SSLKeyGeneratorMac.mm:
3604         (WebCore::signedPublicKeyAndChallengeString):
3605         * platform/network/ResourceRequestBase.h:
3606         (WebCore::registrableDomainsAreEqual):
3607         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3608         (WebCore::getPartitioningDomain):
3609         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3610         (WebCore::SocketStreamHandleImpl::createStreams):
3611         * workers/WorkerLocation.cpp:
3612         (WebCore::WorkerLocation::hostname const):
3613         * workers/service/server/SWServer.cpp:
3614         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
3615
3616 2018-05-24  Dean Jackson  <dino@apple.com>
3617
3618         Need to provide a way to feature detect support for system preview
3619         https://bugs.webkit.org/show_bug.cgi?id=185970
3620         <rdar://problem/40538321>
3621
3622         Reviewed by Sam Weinig.
3623
3624         Update the supports function in the DOMTokenList that HTMLAnchorElement
3625         produces for relList to return true for the system preview token.
3626
3627         Tested internally.
3628
3629         * html/HTMLAnchorElement.cpp:
3630         (WebCore::HTMLAnchorElement::relList const):
3631
3632 2018-05-25  Chris Dumez  <cdumez@apple.com>
3633
3634         Minor ApplicationCacheStorage clean up
3635         https://bugs.webkit.org/show_bug.cgi?id=185984
3636
3637         Reviewed by Youenn Fablet.
3638
3639         * loader/appcache/ApplicationCacheStorage.cpp:
3640         (WebCore::ApplicationCacheStorage::getManifestURLs):
3641         (WebCore::ApplicationCacheStorage::deleteCacheGroup):
3642         (WebCore::ApplicationCacheStorage::originsWithCache):
3643         (WebCore::ApplicationCacheStorage::deleteAllCaches):
3644         (WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
3645         (WebCore::ApplicationCacheStorage::ApplicationCacheStorage):
3646         (WebCore::ApplicationCacheStorage::cacheDirectory const): Deleted.
3647         (WebCore::ApplicationCacheStorage::cacheGroupSize): Deleted.
3648         (WebCore::ApplicationCacheStorage::getOriginsWithCache): Deleted.
3649         (WebCore::ApplicationCacheStorage::create): Deleted.
3650         * loader/appcache/ApplicationCacheStorage.h:
3651         (WebCore::ApplicationCacheStorage::create):
3652
3653 2018-05-25  Sihui Liu  <sihui_liu@apple.com>
3654
3655         [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
3656         https://bugs.webkit.org/show_bug.cgi?id=185041
3657         <rdar://problem/34684214>
3658
3659         Reviewed by Geoffrey Garen.
3660
3661         Set creationtime property when creating Cookie object to keep consistency after conversion.
3662
3663         New API test: WebKit.WKHTTPCookieStoreCreationTime.
3664
3665         * platform/network/cocoa/CookieCocoa.mm:
3666         (WebCore::Cookie::operator NSHTTPCookie * const):
3667
3668 2018-05-25  Zalan Bujtas  <zalan@apple.com>
3669
3670         [LFC] Implement border and padding computation
3671         https://bugs.webkit.org/show_bug.cgi?id=185972
3672
3673         Reviewed by Antti Koivisto.
3674
3675         This patch also removes redundant Display::Box methods and adds a lightweight Edge struct.
3676         (Since padding is optional, if during layout we mistakenly try to access paddingTop/Left/Bottom/Right, Display::Box will assert!)
3677
3678         * layout/FormattingContext.cpp:
3679         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
3680         * layout/FormattingContext.h:
3681         * layout/FormattingContextGeometry.cpp:
3682         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
3683         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
3684         * layout/blockformatting/BlockFormattingContext.cpp:
3685         (WebCore::Layout::BlockFormattingContext::layout const):
3686         * layout/displaytree/DisplayBox.cpp:
3687         (WebCore::Display::Box::marginBox const):
3688         (WebCore::Display::Box::paddingBox const):
3689         (WebCore::Display::Box::contentBox const):
3690         * layout/displaytree/DisplayBox.h:
3691         (WebCore::Display::Box::Edges::Edges):
3692         (WebCore::Display::Box::setHasValidPosition):
3693         (WebCore::Display::Box::setWidth):
3694         (WebCore::Display::Box::setHeight):
3695         (WebCore::Display::Box::setMargin):
3696         (WebCore::Display::Box::setBorder):
3697         (WebCore::Display::Box::setPadding):
3698         (WebCore::Display::Box::marginTop const):
3699         (WebCore::Display::Box::marginLeft const):
3700         (WebCore::Display::Box::marginBottom const):
3701         (WebCore::Display::Box::marginRight const):
3702         (WebCore::Display::Box::paddingTop const):
3703         (WebCore::Display::Box::paddingLeft const):
3704         (WebCore::Display::Box::paddingBottom const):
3705         (WebCore::Display::Box::paddingRight const):
3706         (WebCore::Display::Box::borderTop const):
3707         (WebCore::Display::Box::borderLeft const):
3708         (WebCore::Display::Box::borderBottom const):
3709         (WebCore::Display::Box::borderRight const):
3710         (WebCore::Display::Box::invalidateSize): Deleted.
3711         (WebCore::Display::Box::setHasValidSize): Deleted.
3712         (WebCore::Display::Box::setHasValidGeometry): Deleted.
3713         (WebCore::Display::Box::setRect): Deleted.
3714         (WebCore::Display::Box::setSize): Deleted.
3715         * layout/layouttree/LayoutBox.cpp:
3716         (WebCore::Layout::Box::isPaddingEnabled const):
3717         * layout/layouttree/LayoutBox.h:
3718
3719 2018-05-25  David Kilzer  <ddkilzer@apple.com>
3720
3721         Fix issues with -dealloc methods found by clang static analyzer
3722         <https://webkit.org/b/185887>
3723
3724         Reviewed by Joseph Pecoraro.
3725
3726         * platform/ios/WebAVPlayerController.mm:
3727         (-[WebAVPlayerController dealloc]): Release `_minTiming` and
3728         `_maxTiming` to fix leaks.
3729         * platform/ios/WebBackgroundTaskController.mm:
3730         (-[WebBackgroundTaskController dealloc]): Release
3731         `_backgroundTaskStartBlock` and `_backgroundTaskEndBlock` to fix
3732         leaks.
3733         * platform/ios/WebItemProviderPasteboard.mm:
3734         (-[WebItemProviderRegistrationInfoList dealloc]): Release
3735         `_teamData` to fix leak.
3736
3737 2018-05-25  Antoine Quint  <graouts@apple.com>
3738
3739         [Web Animations] WebAnimation objects never get destroyed
3740         https://bugs.webkit.org/show_bug.cgi?id=185917
3741         <rdar://problem/39539371>
3742
3743         Reviewed by Dean Jackson and Antti Koivisto.
3744
3745         The AnimationTimeline class keeps references to WebAnimation objects organized in various ways. First, there
3746         are three main maps across which all animations are stored, one for non-subclass WebAnimation objects
3747         (m_elementToAnimationsMap), one for CSSSAnimation objects (m_elementToCSSAnimationsMap) and one for CSSTranstion
3748         objects (m_elementToCSSTransitionsMap). On top of that, we also keep a map to access CSSAnimation objects for
3749         a given element by CSS animation name (m_elementToCSSAnimationByName) and another map to access CSSTransition 
3750         objects for a given element by CSS property (m_elementToCSSTransitionByCSSPropertyID).
3751
3752         None of the RefPtr<WebAnimation> stored in these maps would get cleared when the document would get torn down,
3753         which would also prevent the AnimationTimeline (and its DocumentTimeline subclass) from being destroyed.
3754
3755         We now ensure that element and document tear-down correctly removes animations and clears those maps, which
3756         in turn allows the DocumentTimeline to be destroyed, fixing the significant memory leak introduced by Web Animations
3757         so far.
3758
3759         Finally, we change the collection type for those maps to be ListHashRef instead of Vector to guarantee we only
3760         add an animation once per collection due to changes in how setEffect() and setTimeline() operate.
3761
3762         Test: animations/leak-document-with-css-animation.html
3763
3764         * animation/AnimationTimeline.cpp:
3765         (WebCore::AnimationTimeline::~AnimationTimeline): There is no need to clear those tables as they'll need to be empty
3766         for the AnimationTimeline to even be destroyed.
3767         (WebCore::AnimationTimeline::relevantMapForAnimation): Change to use ListHashRef instead of Vector.
3768         (WebCore::AnimationTimeline::animationWasAddedToElement): Change to use ListHashRef instead of Vector.
3769         (WebCore::AnimationTimeline::animationWasRemovedFromElement): When an animation is removed from an element, ensure that
3770         references to this animation stored in the m_elementToCSSAnimationByName and m_elementToCSSTransitionByCSSPropertyID maps
3771         are cleared.
3772         (WebCore::AnimationTimeline::animationsForElement const): Change to use ListHashRef instead of Vector.
3773         (WebCore::AnimationTimeline::removeAnimationsForElement): Instead of just calling cancel() on all known declarative animations
3774         (this method used to be called cancelDeclarativeAnimationsForElement()), we now set the effect of known animations, declarative
3775         or not, for the provided element which will in turn call animationWasRemovedFromElement() and remove the animation from all
3776         maps that might keep a reference to it.
3777         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Replace call to removeDeclarativeAnimation() with a simple call
3778         to removeAnimation() which will remove references for this animation from the relevant maps.
3779         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Ditto.
3780         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): Deleted.
3781         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Deleted.
3782         * animation/AnimationTimeline.h:
3783         (WebCore::AnimationTimeline::elementToAnimationsMap): Change to use ListHashRef instead of Vector.
3784         (WebCore::AnimationTimeline::elementToCSSAnimationsMap): Change to use ListHashRef instead of Vector.
3785         (WebCore::AnimationTimeline::elementToCSSTransitionsMap): Change to use ListHashRef instead of Vector.
3786         * animation/WebAnimation.cpp:
3787         (WebCore::WebAnimation::setEffect): In the case of a declarative animation, we don't want to remove the animation from the relevant
3788         maps because while the effect was set via the API, the element still has a transition or animation set up and we must not break the
3789         timeline-to-animation relationship.
3790         (WebCore::WebAnimation::setEffectInternal): Factor parts of setEffect() out into a new method that can be called from
3791         AnimationTimeline::removeAnimationsForElement() to reset the m_effect member and correctly call animationWasRemovedFromElement()
3792         without all the Web Animations machinery of setEffect(), which is a public API that has unwanted side effects (such as rejecting
3793         promises).
3794         (WebCore::WebAnimation::setTimeline): In the case of a declarative animation, we don't want to remove the animation from the
3795         relevant maps because, while the timeline was set via the API, the element still has a transition or animation set up and we must
3796         not break the relationship.
3797         * animation/DocumentTimeline.cpp:
3798         (WebCore::DocumentTimeline::~DocumentTimeline):
3799         (WebCore::DocumentTimeline::detachFromDocument): Close the GenericTaskQueues when detaching from the document as it's too late to
3800         perform this work in the destructor. We also cancel the schedule timer which we had forgotten to do before.
3801         * animation/WebAnimation.h:
3802         * dom/Document.cpp:
3803         (WebCore::Document::prepareForDestruction):
3804         * dom/Element.cpp:
3805         (WebCore::Element::removedFromAncestor):
3806         * dom/PseudoElement.cpp:
3807         (WebCore::PseudoElement::clearHostElement):
3808         * rendering/updating/RenderTreeUpdater.cpp:
3809         (WebCore::RenderTreeUpdater::tearDownRenderers):
3810
3811 2018-05-24  Chris Dumez  <cdumez@apple.com>
3812
3813         Avoid doing unnecessary work in Document::shouldEnforceContentDispositionAttachmentSandbox() when setting is disabled
3814         https://bugs.webkit.org/show_bug.cgi?id=185964
3815
3816         Reviewed by Geoffrey Garen.
3817
3818         * dom/Document.cpp:
3819         (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox const):
3820
3821 2018-05-24  Chris Dumez  <cdumez@apple.com>
3822
3823         [iOS] Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text
3824         https://bugs.webkit.org/show_bug.cgi?id=185966
3825
3826         Reviewed by Geoffrey Garen.
3827
3828         Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text
3829         for performance reasons.
3830
3831         * loader/ios/PreviewLoader.mm:
3832         (WebCore::PreviewLoader::shouldCreateForMIMEType):
3833
3834 2018-05-24  Sam Weinig  <sam@webkit.org>
3835
3836         Modernize RenderStyleConstants.h - Part 2
3837         https://bugs.webkit.org/show_bug.cgi?id=185901
3838
3839         Reviewed by Simon Fraser.
3840
3841         Modernized the second set of enums in RenderStyleConstants.h by:
3842             - Converting them to enum classes
3843             - Renaming them to remove unnecessary prefix 'E's
3844             - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal)
3845             - Renaming to match modern conventions (e.g BNONE -> None)
3846             - Reformatting them so that each value is on its own line.
3847
3848         Modernizes the following enums:
3849             PseudoId
3850             ListStyleType (renamed from EListStyleType)
3851             BorderFit (renamed from EBorderFit)
3852             AnimationFillMode (renamed from EAnimationFillMode)
3853             AnimationPlayState (renamed from EAnimPlayState)
3854             WhiteSpace (renamed from EWhiteSpace)
3855             TextAlignMode (renamed from ETextAlign)
3856             TextTransform (renamed from ETextTransform)
3857             TextDecorationStyle
3858             TextAlignLast
3859             TextJustify
3860             TextZoom
3861             BreakBetween
3862             BreakInside
3863             EmptyCell (renamed from EEmptyCell)
3864             CaptionSide (renamed from ECaptionSide)
3865             ListStylePosition (renamed from EListStylePosition)
3866             Visibility (renamed from EVisibility)
3867             CursorType (renamed from ECursor)
3868             CursorVisibility
3869             DisplayType (renamed from EDisplay)
3870             InsideLink (renamed from EInsideLink)
3871             PointerEvents (renamed from EPointerEvents)
3872             Hyphens
3873             TextEmphasisFill
3874             TextEmphasisMark
3875             ImageResolutionSource
3876             ImageResolutionSnap
3877             Order
3878             ColumnAxis
3879             ColumnProgression
3880             LineSnap
3881             LineAlign
3882             RubyPosition
3883             AutoRepeatType
3884             CSSBoxType
3885
3886         * accessibility/AXObjectCache.cpp:
3887         (WebCore::AXObjectCache::isNodeVisible const):
3888         * accessibility/AccessibilityList.cpp:
3889         (WebCore::AccessibilityList::determineAccessibilityRole):
3890         * accessibility/AccessibilityMediaControls.cpp:
3891         (WebCore::AccessibilityMediaControl::computeAccessibilityIsIgnored const):
3892         (WebCore::AccessibilityMediaTimeDisplay::computeAccessibilityIsIgnored const):
3893         * accessibility/AccessibilityObject.cpp:
3894         (WebCore::AccessibilityObject::isDOMHidden const):
3895         * accessibility/AccessibilityRenderObject.cpp:
3896         (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
3897         (WebCore::AccessibilityRenderObject::isUnvisited const):
3898         (WebCore::AccessibilityRenderObject::isVisited const):
3899         (WebCore::AccessibilityRenderObject::setValue):
3900         * accessibility/AccessibilityTable.cpp:
3901         (WebCore::AccessibilityTable::isDataTable const):
3902         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
3903         (getAttributeSetForAccessibilityObject):
3904         * animation/AnimationTimeline.cpp:
3905         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
3906         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
3907         * animation/CSSAnimation.cpp:
3908         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
3909         * animation/DeclarativeAnimation.cpp:
3910         (WebCore::DeclarativeAnimation::initialize):
3911         * animation/KeyframeEffectReadOnly.cpp:
3912         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const):
3913         * css/CSSComputedStyleDeclaration.cpp:
3914         (WebCore::renderTextDecorationStyleFlagsToCSSValue):
3915         (WebCore::convertToPageBreak):
3916         (WebCore::convertToColumnBreak):
3917         (WebCore::ComputedStyleExtractor::styledElement const):
3918         (WebCore::ComputedStyleExtractor::styledRenderer const):
3919         (WebCore::computeRenderStyleForProperty):
3920         (WebCore::shapePropertyValue):
3921         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3922         * css/CSSComputedStyleDeclaration.h:
3923         * css/CSSPrimitiveValueMappings.h:
3924         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3925         (WebCore::CSSPrimitiveValue::operator CaptionSide const):
3926         (WebCore::CSSPrimitiveValue::operator CursorType const):
3927         (WebCore::CSSPrimitiveValue::operator CursorVisibility const):
3928         (WebCore::CSSPrimitiveValue::operator DisplayType const):