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