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