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