Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-16  Chris Dumez  <cdumez@apple.com>
2
3         Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread
4         https://bugs.webkit.org/show_bug.cgi?id=187702
5
6         Reviewed by Youenn Fablet.
7
8         Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since
9         it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is
10         ThreadSafeRefCounted and frequently passed to other threads.
11
12         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
13         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
14         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
15
16 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
17
18         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
19         https://bugs.webkit.org/show_bug.cgi?id=187631
20         <rdar://problem/42164227>
21
22         Reviewed by Brady Eidson.
23
24         When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin 
25         is that origin. Given that the origin may create IndexedDB from subframes, we should delete 
26         databases whose openingOrigin is that origin too.
27
28         Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. 
29
30         * Modules/indexeddb/server/IDBServer.cpp:
31         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
32
33 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
34
35         Shrink some font-related classes and enums
36         https://bugs.webkit.org/show_bug.cgi?id=187686
37
38         Reviewed by Myles Maxfield.
39         
40         Use enum class for enums in TextFlags.h and make them one byte big.
41
42         Re-order members of Font to shrink it from 360 to 328 bytes.
43
44         * css/CSSPrimitiveValueMappings.h:
45         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
46         (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const):
47         (WebCore::CSSPrimitiveValue::operator FontSmallCaps const):
48         (WebCore::CSSPrimitiveValue::operator TextRenderingMode const):
49         * platform/graphics/Font.cpp:
50         (WebCore::Font::Font):
51         (WebCore::Font::verticalRightOrientationFont const):
52         * platform/graphics/Font.h:
53         * platform/graphics/FontCascade.cpp:
54         (WebCore::offsetToMiddleOfGlyph):
55         * platform/graphics/FontCascade.h:
56         (WebCore::FontCascade::advancedTextRenderingMode const):
57         * platform/graphics/FontCascadeFonts.cpp:
58         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
59         (WebCore::FontCascadeFonts::glyphDataForVariant):
60         (WebCore::glyphPageFromFontRanges):
61         * platform/graphics/FontDescription.cpp:
62         (WebCore::FontCascadeDescription::FontCascadeDescription):
63         * platform/graphics/FontDescription.h:
64         (WebCore::FontDescription::setTextRenderingMode):
65         (WebCore::FontDescription::setOrientation):
66         (WebCore::FontDescription::setWidthVariant):
67         (WebCore::FontCascadeDescription::setFontSmoothing):
68         (WebCore::FontCascadeDescription::initialSmallCaps):
69         (WebCore::FontCascadeDescription::initialFontSmoothing):
70         (WebCore::FontCascadeDescription::initialTextRenderingMode):
71         * platform/graphics/FontPlatformData.h:
72         (WebCore::FontPlatformData::isForTextCombine const):
73         * platform/graphics/cocoa/FontCacheCoreText.cpp:
74         (WebCore::preparePlatformFont):
75         * platform/graphics/cocoa/FontCascadeCocoa.mm:
76         (WebCore::showLetterpressedGlyphsWithAdvances):
77         (WebCore::showGlyphsWithAdvances):
78         (WebCore::FontCascade::drawGlyphs):
79         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
80         * platform/graphics/cocoa/FontCocoa.mm:
81         (WebCore::Font::platformInit):
82         (WebCore::Font::platformBoundsForGlyph const):
83         (WebCore::Font::platformWidthForGlyph const):
84         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
85         (WebCore::FontPlatformData::hash const):
86         (WebCore::mapFontWidthVariantToCTFeatureSelector):
87         (WebCore::FontPlatformData::ctFont const):
88         (WebCore::FontPlatformData::description const):
89         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
90         (WebCore::FontPlatformData::buildScaledFont):
91         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
92         (WebCore::Font::platformInit):
93         (WebCore::Font::platformWidthForGlyph const):
94         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
95         (WebCore::fontFeatures):
96         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
97         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
98         (WebCore::Font::getCFStringAttributes const):
99         * platform/graphics/win/FontCGWin.cpp:
100         (WebCore::FontCascade::drawGlyphs):
101         * platform/graphics/win/FontCascadeDirect2D.cpp:
102         (WebCore::FontCascade::drawGlyphs):
103         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
104         (WebCore::GlyphPage::fill):
105         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
106         (WebCore::Font::platformInit):
107         (WebCore::Font::platformBoundsForGlyph const):
108         (WebCore::Font::platformWidthForGlyph const):
109         * platform/text/TextFlags.h:
110         * rendering/RenderCombineText.cpp:
111         (WebCore::RenderCombineText::combineTextIfNeeded):
112         * rendering/RenderLayer.cpp:
113         (WebCore::RenderLayer::calculateClipRects const):
114         * rendering/TextPainter.cpp:
115         (WebCore::TextPainter::paintTextWithShadows):
116         * rendering/TextPainter.h:
117         * rendering/style/RenderStyle.cpp:
118         (WebCore::RenderStyle::fontAndGlyphOrientation):
119         * rendering/svg/RenderSVGInlineText.cpp:
120         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
121
122 2018-07-16  Sergio Villar Senin  <svillar@igalia.com>
123
124         [WebVR] Add support for connect/disconnect and mount/unmount device events
125         https://bugs.webkit.org/show_bug.cgi?id=187343
126
127         Reviewed by Žan Doberšek.
128
129         WebVR specs define a series of events as part of the Window Interface Extension. We're
130         adding support for the connect/disconnect and mount/unmount events both at the module level
131         and the platform level using OpenVR.
132
133         In order to do that we need to keep lists of VRPlatformDisplays at platform level and
134         VRDisplays at bindings level. We then update those lists accordingly to detect potential
135         additions/removals, and emit the corresponding signals. A new client interface
136         VRPlatformDisplayClient was also defined so that VRPlatformDisplay implementations could
137         notify their clients (typically a VRDisplay).
138
139         Last but not least, NavigatorWebVR was updated so it supplements Navigator instead of
140         supplementing Page.
141
142         * Modules/webvr/NavigatorWebVR.cpp: Supplement Navigator not Page.
143         (WebCore::NavigatorWebVR::getVRDisplays): Keep a list of VRDisplays and update them
144         conveniently, also emitting the required events under certain conditions (like device
145         disconnection).
146         (WebCore::NavigatorWebVR::supplementName): New method.
147         (WebCore::NavigatorWebVR::from): Ditto.
148         * Modules/webvr/NavigatorWebVR.h: Supplement Navigator not Page.
149         * Modules/webvr/VRDisplay.cpp:
150         (WebCore::VRDisplay::create): Moved suspendIfNeeded() to constructor.
151         (WebCore::VRDisplay::VRDisplay): Set itself as VRPlatformDisplay client.
152         (WebCore::VRDisplay::~VRDisplay): Unset as  VRPlatformDisplay client.
153         (WebCore::VRDisplay::VRPlatformDisplayConnected): Dispatch event on DOM window.
154         (WebCore::VRDisplay::VRPlatformDisplayDisconnected): Ditto.
155         (WebCore::VRDisplay::VRPlatformDisplayMounted): Ditto.
156         (WebCore::VRDisplay::VRPlatformDisplayUnmounted): Ditto.
157         * Modules/webvr/VRDisplay.h: Extend from VRPlatformDisplayClient.
158         (WebCore::VRDisplay::document):
159         * Modules/webvr/VRDisplayEvent.cpp: Updated Copyright.
160         * Modules/webvr/VRDisplayEvent.h: Ditto.
161         * Sources.txt: Added the two new files.
162         * WebCore.xcodeproj/project.pbxproj: Ditto.
163         * platform/vr/VRManager.cpp:
164         (WebCore::VRManager::getVRDisplays): Keep a list of VRPlatformDisplays and update them conveniently,
165         also emitting the required events under certain conditions (like device disconnection).
166         * platform/vr/VRManager.h:
167         * platform/vr/VRPlatformDisplay.cpp: New file with common implementations for VRPlatformDisplays.
168         (WebCore::VRPlatformDisplay::setClient):
169         (WebCore::VRPlatformDisplay::notifyVRPlatformDisplayEvent):
170         * platform/vr/VRPlatformDisplay.h: Added a generic method to notify about different
171         events. Added the client pointer.
172         * platform/vr/VRPlatformDisplayClient.h: New file. VRPlatformDisplay implementations will
173         call the client methods in the event of some circumstances happening.
174         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayConnected):
175         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayDisconnected):
176         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayMounted):
177         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayUnmounted):
178         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
179         (WebCore::VRPlatformDisplayOpenVR::updateDisplayInfo): Poll the device for new events to
180         detect connection/disconnections or device activations/deactivations (HMD
181         mounted/unmounted).
182         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
183
184 2018-07-16  Zan Dobersek  <zdobersek@igalia.com>
185
186         [Nicosia] Add Nicosia::PlatformLayer, Nicosia::CompositionLayer classes
187         https://bugs.webkit.org/show_bug.cgi?id=187693
188
189         Reviewed by Carlos Garcia Campos.
190
191         Add the Nicosia::PlatformLayer class. This will be the base platform
192         layer class from which different derivatives will be created, addressing
193         different use cases. The generic PlatformLayer type alias will point to
194         this class in the future.
195
196         First class deriving from Nicosia::PlatformLayer is
197         Nicosia::CompositionLayer, purpose of which will be to mirror the state
198         that's stored in the platform-specific GraphicsLayer derivative. It will
199         also allow making thread-safe updates to that state.
200
201         CoordinatedGraphicsLayer implementation now spawns a CompositionLayer
202         object and tracks state changes in a separate
203         CompositionLayer::LayerState::Delta object. During flushing, the changed
204         state is applied to the layer's pending state before the delta is nulled
205         out. The updated state isn't used anywhere yet, but future changes will
206         implement committing this state into the rendering pipeline.
207
208         There's bits of state not yet being managed by CompositionLayer, e.g.
209         debug visuals, filters and animations. These will be addressed later.
210
211         The m_solidColor member variable is added to CoordinatedGraphicsLayer in
212         order to properly store the solid color value. Normally this would be
213         contained by the parent GraphicsLayer class, but no such member variable
214         exists there.
215
216         * platform/TextureMapper.cmake:
217         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Added.
218         (Nicosia::PlatformLayer::PlatformLayer):
219         (Nicosia::CompositionLayer::CompositionLayer):
220         * platform/graphics/nicosia/NicosiaPlatformLayer.h: Added.
221         (Nicosia::PlatformLayer::isCompositionLayer const):
222         (Nicosia::PlatformLayer::id const):
223         (Nicosia::CompositionLayer::create):
224         (Nicosia::CompositionLayer::LayerState::Flags::Flags):
225         (Nicosia::CompositionLayer::updateState):
226         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
227         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
228         (WebCore::CoordinatedGraphicsLayer::setPosition):
229         (WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
230         (WebCore::CoordinatedGraphicsLayer::setSize):
231         (WebCore::CoordinatedGraphicsLayer::setTransform):
232         (WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
233         (WebCore::CoordinatedGraphicsLayer::setPreserves3D):
234         (WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
235         (WebCore::CoordinatedGraphicsLayer::setDrawsContent):
236         (WebCore::CoordinatedGraphicsLayer::setContentsVisible):
237         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
238         (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
239         (WebCore::CoordinatedGraphicsLayer::setOpacity):
240         (WebCore::CoordinatedGraphicsLayer::setContentsRect):
241         (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
242         (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
243         (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
244         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
245         (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
246         (WebCore::CoordinatedGraphicsLayer::syncChildren):
247         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
248         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
249
250 2018-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
251
252         [iOS apps on macOS] Playing embedded Twitter videos in the News app crashes the web process
253         https://bugs.webkit.org/show_bug.cgi?id=187690
254         <rdar://problem/41869703>
255
256         Reviewed by Tim Horton.
257
258         Work around unexpected behavior when soft-linking AVFoundation. After using `dlopen_preflight` to check for the
259         existence of a library prior to loading the library using `dlopen`, `dlsym` subsequently returns null for some
260         symbols that would otherwise be available. This causes us to RELEASE_ASSERT later down the road when we try to
261         load AVAudioSessionModeDefault in AudioSessionIOS.mm.
262
263         To fix this for now, simply check for the library directly instead of using the more lightweight preflight
264         check. See clone: <rdar://problem/42224780> for more detail.
265
266         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm:
267         (WebCore::AVFoundationMIMETypeCache::isAvailable const):
268
269 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
270
271         Shrink StyleFillData, StyleStrokeData and StyleMiscData
272         https://bugs.webkit.org/show_bug.cgi?id=187681
273
274         Reviewed by Anders Carlsson.
275
276         Shrink these data structures by making more enum classes one byte in size, and
277         re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72,
278         StyleMiscData from 40 to 32 bytes.
279
280         * rendering/style/SVGRenderStyleDefs.cpp:
281         (WebCore::StyleFillData::StyleFillData):
282         (WebCore::StyleFillData::operator== const):
283         (WebCore::StyleStrokeData::StyleStrokeData):
284         (WebCore::StyleStrokeData::operator== const):
285         (WebCore::StyleStopData::operator== const):
286         (WebCore::StyleMiscData::StyleMiscData):
287         * rendering/style/SVGRenderStyleDefs.h:
288
289 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
290
291         Shrink CachedResource and subclasses
292         https://bugs.webkit.org/show_bug.cgi?id=187546
293
294         Reviewed by Daniel Bates.
295
296         Shrink CachedResource down from 1384 to 1336 bytes, CachedImage from 1480 to
297         1424 bytes, and CachedFont a little.
298         
299         This saves about 23KB on cnn.com.
300
301         * loader/ResourceLoaderOptions.h:
302         * loader/cache/CachedFont.h:
303         * loader/cache/CachedImage.h:
304         * loader/cache/CachedResource.cpp:
305         (WebCore::CachedResource::CachedResource):
306         * loader/cache/CachedResource.h:
307         * platform/network/CacheValidation.h:
308         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
309         * platform/network/NetworkLoadMetrics.h:
310         * platform/network/ParsedContentRange.h:
311         * platform/network/ResourceRequestBase.h:
312         * platform/network/ResourceResponseBase.h:
313
314 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
315
316         Shrink some style-related classes and enums
317         https://bugs.webkit.org/show_bug.cgi?id=187680
318
319         Reviewed by Antti Koivisto.
320         
321         Make all the enum classes in RenderStyleConstants be one byte big (all have less
322         than 256 values).
323         
324         Shrink DocumentRuleSet from 384 to 368 bytes by re-ordering, which also helps shrink
325         StyleResolver from 1024 to 952 bytes.
326         
327         Shrink BorderValue by re-ordering (now that the layout of Color has changed) which
328         shrinks BorderData from 168 to 136 bytes.
329         
330         Convert a couple of other enums to enum class so that they can have explicit size.
331
332         * css/DocumentRuleSets.h:
333         * css/MediaQueryMatcher.cpp:
334         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle const):
335         * css/StyleMedia.cpp:
336         (WebCore::StyleMedia::matchMedium const):
337         * css/StyleResolver.cpp:
338         (WebCore::StyleResolver::StyleResolver):
339         (WebCore::StyleResolver::State::State):
340         (WebCore::StyleResolver::styleForElement):
341         (WebCore::StyleResolver::cascadedPropertiesForRollback):
342         (WebCore::StyleResolver::applyProperty):
343         (WebCore::cascadeLevelForIndex):
344         * css/StyleResolver.h:
345         * rendering/style/BorderValue.h:
346         * rendering/style/RenderStyle.cpp:
347         * rendering/style/RenderStyleConstants.h:
348         * style/StyleTreeResolver.cpp:
349         (WebCore::Style::TreeResolver::styleForElement):
350         * svg/SVGElementRareData.h:
351         (WebCore::SVGElementRareData::overrideComputedStyle):
352
353 2018-07-14  Kocsen Chung  <kocsen_chung@apple.com>
354
355         Ensure WebKit stack is ad-hoc signed
356         https://bugs.webkit.org/show_bug.cgi?id=187667
357
358         Reviewed by Alexey Proskuryakov.
359
360         * Configurations/Base.xcconfig:
361
362 2018-07-14  Dirk Schulze  <krit@webkit.org>
363
364         [css-masking] Fully support -webkit-clip-path on SVG elements
365         https://bugs.webkit.org/show_bug.cgi?id=185829
366
367         Reviewed by Simon Fraser.
368
369         -webkit-clip-path contributes to SVG elements with boxes, shapes and now with
370         element references to <clipPath> elements as well. Make sure that all types
371         contribute to hit-testing of the SVG element as well as they should.
372
373         Tests: svg/clip-path/webkit-clip-path-after-expected.svg
374                svg/clip-path/webkit-clip-path-after.svg
375                svg/clip-path/webkit-clip-path-before-expected.svg
376                svg/clip-path/webkit-clip-path-before.svg
377                svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html
378                svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html
379                svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html
380                svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html
381
382         * rendering/svg/SVGRenderSupport.cpp: Share code as much as possible.
383         (WebCore::clipPathReferenceBox):
384         (WebCore::isPointInCSSClippingArea): Take -webkit-clip-path into account.
385         (WebCore::SVGRenderSupport::clipContextToCSSClippingArea):
386         (WebCore::SVGRenderSupport::pointInClippingArea):
387         * rendering/svg/SVGRenderSupport.h:
388         * rendering/svg/SVGRenderingContext.cpp: Clip to -webkit-clip-path boxes, shapes and references.
389         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
390         * rendering/svg/SVGResources.cpp: Add -webkit-clip-path references to cached resources. Mimic SVG clip-path.
391         (WebCore::SVGResources::buildCachedResources):
392
393 2018-07-13  Simon Fraser  <simon.fraser@apple.com>
394
395         Avoid fetching visitedDependentColor() so many times in editing code
396         https://bugs.webkit.org/show_bug.cgi?id=187676
397
398         Reviewed by Zalan Bujtas.
399         
400         editingAttributedStringFromRange called style.visitedDependentColor() twice for each property,
401         and fontAttributesForSelectionStart() called it two or three times. Use a local Color variable
402         to avoid so many calls. Also replace a call to alpha() with isVisible() which makes the usage more clear.
403
404         No behavior change.
405
406         * editing/cocoa/EditorCocoa.mm:
407         (WebCore::Editor::fontAttributesForSelectionStart const):
408         * editing/cocoa/HTMLConverter.mm:
409         (WebCore::editingAttributedStringFromRange):
410
411 2018-07-13  Youenn Fablet  <youenn@apple.com>
412
413         Support connecting a MediaStreamAudioDestinationNode to RTCPeerConnection
414         https://bugs.webkit.org/show_bug.cgi?id=187627
415         <rdar://problem/35334400>
416
417         Reviewed by Jer Noble.
418
419         When MediaStreamAudioSource is called to read new audio samples,
420         convert these samples to a WebAudioBufferList and call RealtimeMediaSource::audioSamplesAvailable.
421         This makes its observers to get the audio data.
422
423         Test: webrtc/peer-connection-createMediaStreamDestination.html
424
425         * Modules/mediastream/MediaStream.cpp:
426         (WebCore::MediaStream::create): Minor refactoring.
427         * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
428         (WebCore::createMediaStream):
429         (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
430         (WebCore::MediaStreamAudioDestinationNode::process):
431         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
432         * Modules/webaudio/MediaStreamAudioSource.cpp:
433         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
434         (WebCore::MediaStreamAudioSource::consumeAudio):
435         * Modules/webaudio/MediaStreamAudioSource.h:
436         * Modules/webaudio/MediaStreamAudioSourceCocoa.cpp: Added.
437         (WebCore::streamDescription):
438         (WebCore::MediaStreamAudioSource::consumeAudio):
439         * WebCore.xcodeproj/project.pbxproj:
440         * platform/audio/AudioDestinationConsumer.h: Removed.
441         * platform/mediastream/MediaStreamPrivate.cpp:
442         (WebCore::MediaStreamPrivate::create):
443         * platform/mediastream/MediaStreamPrivate.h:
444
445 2018-07-13  Christopher Reid  <chris.reid@sony.com>
446
447         [WinCairo] Enable WebGL when Accelerated Compositing is disabled
448         https://bugs.webkit.org/show_bug.cgi?id=187664
449
450         Reviewed by Fujii Hironori.
451
452         AC was disabled for WinCairo in r233725 but it can still run WebGL without AC.
453
454         * html/HTMLCanvasElement.cpp:
455
456 2018-07-13  Chris Dumez  <cdumez@apple.com>
457
458         Crash under ApplicationCacheGroup::didFailLoadingEntry()
459         https://bugs.webkit.org/show_bug.cgi?id=187661
460         <rdar://problem/42179755>
461
462         Reviewed by Youenn Fablet.
463
464         If ApplicationCacheResourceLoader::create() fails synchronously with
465         ApplicationCacheResourceLoader::Error::CannotCreateResource error, then
466         m_entryLoader will be null when didFailLoadingEntry() is called. However,
467         didFailLoadingEntry() fails to null check m_entryLoader before using it.
468
469         * loader/appcache/ApplicationCacheGroup.cpp:
470         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
471         (WebCore::ApplicationCacheGroup::startLoadingEntry):
472         * loader/appcache/ApplicationCacheGroup.h:
473
474 2018-07-13  Alex Christensen  <achristensen@webkit.org>
475
476         Add release assertion to check thread in TimerBase::setNextFireTime
477         https://bugs.webkit.org/show_bug.cgi?id=187666
478
479         Reviewed by Ryosuke Niwa.
480
481         This should give us insight into what is causing <rdar://problem/33352721>
482         
483         * platform/Timer.cpp:
484         (WebCore::TimerBase::setNextFireTime):
485
486 2018-07-13  Ryosuke Niwa  <rniwa@webkit.org>
487
488         [iOS] [WK1] Crash inside IOSurfacePool::platformGarbageCollectNow() in WebThread
489         https://bugs.webkit.org/show_bug.cgi?id=187635
490         <rdar://problem/34297065>
491
492         Reviewed by Simon Fraser.
493
494         r167717 added code to trigger a CA commit in the web process via platformGarbageCollectNow() in order to free IOSurface-related memory.
495         However, that code is also running in the web thread in apps using WebKit1, causing unwanted UIView layout on the web thread.
496
497         Fix by not triggering this CA commit if it's called on the web thread.
498
499         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
500         (WebCore::IOSurfacePool::platformGarbageCollectNow):
501
502 2018-07-13  Antoine Quint  <graouts@apple.com>
503
504         Dark Mode: document markers are difficult to see
505         https://bugs.webkit.org/show_bug.cgi?id=187632
506         <rdar://problem/41099719>
507
508         Reviewed by Simon Fraser.
509
510         We update the way we draw the document markers for macOS and use more constrasting colors in dark mode.
511         Paving the way for future improvements, we move the drawLineForDocumentMarker() method from GraphicsContext
512         to RenderTheme and implement a first version in RenderThemeMac. The circles used for the underline are now
513         drawn directly with Core Graphics and we no longer use an image resource. To allow both GraphicsContext
514         and RenderTheme to have different versions of the drawLineForDocumentMarker() method, the DocumentMarkerLineStyle
515         enum is now an "enum class".
516
517         No new test due to webkit.org/b/105616, webkit.org/b/187655 was raised to track the creation of new tests
518         when it becomes possible again.
519
520         * platform/graphics/GraphicsContext.h:
521         * platform/graphics/GraphicsContextImpl.h:
522         * platform/graphics/cairo/CairoOperations.cpp:
523         (WebCore::Cairo::drawLineForDocumentMarker):
524         * platform/graphics/cairo/CairoOperations.h:
525         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
526         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
527         * platform/graphics/cairo/GraphicsContextImplCairo.h:
528         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
529         (WebCore::GraphicsContext::drawLineForDocumentMarker):
530         * platform/graphics/displaylists/DisplayListItems.h:
531         (WebCore::DisplayList::DrawLineForDocumentMarker::create):
532         (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker):
533         * platform/graphics/displaylists/DisplayListRecorder.cpp:
534         (WebCore::DisplayList::Recorder::drawLineForDocumentMarker):
535         * platform/graphics/displaylists/DisplayListRecorder.h:
536         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
537         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
538         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
539         * platform/graphics/win/GraphicsContextCGWin.cpp:
540         (WebCore::GraphicsContext::drawLineForDocumentMarker):
541         * rendering/InlineTextBox.cpp:
542         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call drawLineForDocumentMarker() on the RenderTheme on
543         macOS and on GraphicsContext in all other cases.
544         * rendering/RenderTheme.cpp:
545         (WebCore::RenderTheme::drawLineForDocumentMarker):
546         * rendering/RenderTheme.h:
547         * rendering/RenderThemeMac.h:
548         * rendering/RenderThemeMac.mm:
549         (WebCore::colorForStyle): Provide different colors for light and dark modes.
550         (WebCore::RenderThemeMac::drawLineForDocumentMarker): A new macOS-specific version of drawLineForDocumentMarker()
551         where we paint circles using Core Graphics directly.
552
553 2018-07-13  Charlie Turner  <cturner@igalia.com>
554
555         [GStreamer] Use smart pointers for GstByteReader
556         https://bugs.webkit.org/show_bug.cgi?id=187638
557
558         Reviewed by Xabier Rodriguez-Calvar.
559
560         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Add
561         specialisation for GstByteReader.
562         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
563         Use the new smart pointer class to avoid needing to remember where
564         to call gst_byte_reader_free.
565         (webKitMediaClearKeyDecryptorDecrypt):
566
567 2018-07-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
568
569         [Curl] Move HTTP Setup logic from CurlRequest to CurlHandle for reuse.
570         https://bugs.webkit.org/show_bug.cgi?id=187427
571
572         Reviewed by Fujii Hironori.
573
574         CurlContext will be used by Secure WebSocket client, but HTTP setup code is
575         in CurlRequest, which is only for regular HTTP/HTTPS transaction. This patch
576         allows wss client to setup CurlHandle for HTTPS communication, such as TLS,
577         proxy or authentication.
578
579         No new tests because there's no behavior change.
580
581         * platform/network/curl/CurlContext.cpp:
582         (WebCore::CurlHandle::CurlHandle):
583         (WebCore::CurlHandle::enableSSLForHost):
584         (WebCore::CurlHandle::willSetupSslCtx):
585         (WebCore::CurlHandle::willSetupSslCtxCallback):
586         (WebCore::CurlHandle::sslErrors const):
587         (WebCore::CurlHandle::setUrl):
588         (WebCore::CurlHandle::enableHttp):
589         (WebCore::CurlHandle::enableConnectionOnly):
590         (WebCore::CurlHandle::certificateInfo const):
591         (WebCore::CurlHandle::enableStdErrIfUsed):
592         (WebCore::CurlHandle::initialize): Deleted.
593         * platform/network/curl/CurlContext.h:
594         (WebCore::CurlHandle::url const):
595         * platform/network/curl/CurlRequest.cpp:
596         (WebCore::CurlRequest::setupTransfer):
597         (WebCore::CurlRequest::didReceiveHeader):
598         (WebCore::CurlRequest::didCompleteTransfer):
599         (WebCore::CurlRequest::finalizeTransfer):
600         (WebCore::CurlRequest::willSetupSslCtx): Deleted.
601         (WebCore::CurlRequest::willSetupSslCtxCallback): Deleted.
602         * platform/network/curl/CurlRequest.h:
603         * platform/network/curl/CurlSSLVerifier.cpp:
604         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
605         (WebCore::CurlSSLVerifier::verify):
606         * platform/network/curl/CurlSSLVerifier.h:
607
608 2018-07-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
609
610         [GStreamer][MSE] Add GstFlowCombiner to handle non-linked inactive branches
611         https://bugs.webkit.org/show_bug.cgi?id=187636
612
613         Reviewed by Carlos Garcia Campos.
614
615         When we have more than one source buffer, only one will be
616         rendered and the inactive branch will report linking errors that
617         we have to deal with.
618
619         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GstFlowCombiner.
620         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
621         (webkitMediaSrcChain): Combine the flow in the flow combiner.
622         (webkit_media_src_init): Initialize the flow combiner.
623         (webKitMediaSrcLinkStreamToSrcPad): Add the proxypad to the
624         combiner and set the chain function.
625         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h:
626         Declare the flow combiner.
627
628 2018-07-13  Charlie Turner  <cturner@igalia.com>
629
630         [GStreamer] Add GstBufferMapped abstraction
631         https://bugs.webkit.org/show_bug.cgi?id=187600
632
633         Reviewed by Xabier Rodriguez-Calvar.
634
635         There is a similar abstraction called `mapGstBuffer` and friends,
636         which have a slightly different use-case: wanting a buffer that is
637         mapped for a longer lifetime without have to keep track of the map
638         infos separately. They could be subsumed by this abstraction, but
639         everytime they need to write to the buffer, they'd have to remap
640         the memory blocks.
641
642         This abstraction is more for one-short reads and writes saving the user
643         from remembering to unmap the buffer and having to manage to
644         auxiliary GstMapInfo structures.
645
646         * platform/graphics/gstreamer/GStreamerCommon.h:
647         (WebCore::GstMappedBuffer::GstMappedBuffer):
648         (WebCore::GstMappedBuffer::~GstMappedBuffer):
649         (WebCore::GstMappedBuffer::data):
650         (WebCore::GstMappedBuffer::size const):
651         (WebCore::GstMappedBuffer::operator bool const):
652         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
653         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
654         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
655         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
656         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
657         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
658         (webKitMediaClearKeyDecryptorSetupCipher):
659         (webKitMediaClearKeyDecryptorDecrypt):
660
661 2018-07-12  Wenson Hsieh  <wenson_hsieh@apple.com>
662
663         Make it easier to hit the significant rendered text layout milestone on pages with main article elements
664         https://bugs.webkit.org/show_bug.cgi?id=187578
665         <rdar://problem/42104637>
666
667         Reviewed by Ryosuke Niwa.
668
669         Our current heuristics for triggering the significant rendered text layout milestone are very conservative, with
670         the intention of avoiding false positives. In practice, we can relax some of these constraints when we've
671         detected the presence of a main article element on the page. (e.g. in New York Times articles). See per-method
672         changes below for more detail.
673
674         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
675
676         * dom/Document.cpp:
677         (WebCore::Document::registerArticleElement):
678         (WebCore::Document::unregisterArticleElement):
679         (WebCore::Document::updateMainArticleElementAfterLayout):
680
681         As a post layout task, update the main article element by looping through the articles (up to a maximum limit of
682         10) in search of an article element that is several times larger than the second largest article element.
683
684         * dom/Document.h:
685
686         Store a set containing the article elements in the document, as well as the current main article on the page.
687
688         (WebCore::Document::hasMainArticleElement const):
689         * html/Element.cpp:
690         (WebCore::Element::insertedIntoAncestor):
691         (WebCore::Element::removedFromAncestor):
692
693         Keep track of the article elements that exist in the document whenever elements with the article tag are added
694         to or removed from the document.
695
696         * page/FrameView.cpp:
697
698         Add new minimum thresholds for firing the significant rendered text milestone when there exists a main article.
699
700         (WebCore::FrameView::performPostLayoutTasks):
701         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
702
703         Take the main article element into consideration when determining whether to fire the significant text
704         layout milestone.
705
706 2018-07-12  Daniel Bates  <dabates@apple.com>
707
708         JavaScript URL gives incorrect result when frame is navigated
709         https://bugs.webkit.org/show_bug.cgi?id=187203
710         <rdar://problem/41438443>
711
712         Reviewed by David Kilzer.
713
714         * loader/SubframeLoader.cpp:
715         (WebCore::SubframeLoader::requestFrame):
716
717 2018-07-12  Alex Christensen  <achristensen@webkit.org>
718
719         Reduce size of WebCore::URL
720         https://bugs.webkit.org/show_bug.cgi?id=186820
721
722         Reviewed by Yusuke Suzuki and Youenn Fablet.
723
724         We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive
725         because port numbers are missing or between 0 and 65535.  Let's just use 3 bits here.
726         We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be
727         longer for some custom schemes, but I've never seen one more than 20 characters.  If we assume
728         schemes are always less than 64MB, we can save 8 bytes per URL!
729
730         No change in behavior, just less memory use!
731         
732         To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it.
733
734         * platform/URL.cpp:
735         (WebCore::URL::invalidate):
736         (WebCore::URL::lastPathComponent const):
737         (WebCore::URL::port const):
738         (WebCore::URL::protocolHostAndPort const):
739         (WebCore::URL::path const):
740         (WebCore::URL::removePort):
741         (WebCore::URL::setPort):
742         (WebCore::URL::setHostAndPort):
743         (WebCore::URL::setPath):
744         * platform/URL.h:
745         (WebCore::URL::encode const):
746         (WebCore::URL::decode):
747         (WebCore::URL::hasPath const):
748         (WebCore::URL::pathStart const):
749         * platform/URLParser.cpp:
750         (WebCore::URLParser::copyBaseWindowsDriveLetter):
751         (WebCore::URLParser::urlLengthUntilPart):
752         (WebCore::URLParser::copyURLPartsUntil):
753         (WebCore::URLParser::shouldPopPath):
754         (WebCore::URLParser::popPath):
755         (WebCore::URLParser::parse):
756         (WebCore::URLParser::parsePort):
757         (WebCore::URLParser::parseHostAndPort):
758         (WebCore::URLParser::allValuesEqual):
759         (WebCore::URLParser::internalValuesConsistent):
760         * workers/service/server/RegistrationDatabase.cpp:
761         Increment the service worker registration schema version because of the URL encoding change.
762
763 2018-07-12  Youenn Fablet  <youenn@apple.com>
764
765         Add a FrameLoaderClient willInjectUserScriptForFrame callback
766         https://bugs.webkit.org/show_bug.cgi?id=187565
767
768         Reviewed by Alex Christensen.
769
770         Test: http/tests/contentextensions/injected-script-callback.html.
771
772         * loader/FrameLoaderClient.h:
773         * page/Frame.cpp:
774         (WebCore::Frame::injectUserScriptImmediately):
775         Calling the new callback whenever being about to inject a new script.
776
777 2018-07-12  Megan Gardner  <megan_gardner@apple.com>
778
779         Keep Selections within Shadow DOM boundaries
780         https://bugs.webkit.org/show_bug.cgi?id=187556
781         <rdar://problem/41664567>
782
783         Reviewed by Ryosuke Niwa.
784
785         Expose needed functionality to WebKit to help with determing editing and shadow dom boundries.
786
787         Only exposing functionality to WebKit.
788
789         * dom/TreeScope.h:
790         * editing/Editing.h:
791         * editing/VisibleSelection.cpp:
792         (WebCore::VisibleSelection::adjustPositionForEnd const):
793         (WebCore::VisibleSelection::adjustPositionForStart const):
794         (WebCore::adjustPositionForEnd): Deleted.
795         (WebCore::adjustPositionForStart): Deleted.
796         * editing/VisibleSelection.h:
797         
798 2018-07-12  Sihui Liu  <sihui_liu@apple.com>
799
800         IndexedDB: database file of subframe cannot be removed
801         https://bugs.webkit.org/show_bug.cgi?id=187564
802
803         Reviewed by Youenn Fablet.
804
805         For IndexedDB, if openingOrigin is different from mainFrameOrigin, there will be another 
806         layer in the database file path. 
807         IDBServer should delete database files recursively to make sure all files are removed.
808
809         Covered by modified test: WebKit.WebsiteDataStoreCustomPaths.
810
811         * Modules/indexeddb/server/IDBServer.cpp:
812         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
813
814 2018-07-12  Per Arne Vollan  <pvollan@apple.com>
815
816         Add compile guard for enabling NSRunLoop in the WebContent process.
817         https://bugs.webkit.org/show_bug.cgi?id=187563
818
819         Reviewed by Chris Dumez.
820
821         No new tests, no change in behavior.
822
823         * platform/mac/EventLoopMac.mm:
824         (WebCore::EventLoop::cycle):
825
826 2018-07-12  Zalan Bujtas  <zalan@apple.com>
827
828         Newly added float should trigger full layout on the block.
829         https://bugs.webkit.org/show_bug.cgi?id=187251
830         <rdar://problem/41726137>
831
832         Reviewed by David Kilzer.
833
834         RenderBlockFlow::determineStartPosition() is one of the places where we decide the extent of the line layout for the current block.
835         In here we try to figure out the first line in the block that requires layout. In certain cases when floats are present,
836         (due to their intrusive behavior) we just trigger a full layout on the entire block.
837         One of the special cases is when a new float is added to the block. determineStartPosition() checks for such floats (floats inserted
838         after the "last known float") and marks the block for full layout. However it missed the case when other, unrelated mutations happened
839         in addition to this newly inserted float. This patch fixes this case by checking if the floats after the "last know float" actually need layout.
840
841         Test: fast/inline/new-float-needs-layout-when-line-is-dirty.html
842
843         * rendering/RenderBlockLineLayout.cpp:
844         (WebCore::RenderBlockFlow::determineStartPosition):
845
846 2018-07-12  Thibault Saunier  <tsaunier@igalia.com>
847
848         [GStreamer] Add pads to the GstFlowCombiner in MediaStreamSrc
849         https://bugs.webkit.org/show_bug.cgi?id=187552
850
851         Reviewed by Alejandro G. Castro.
852
853         This was overlooked and it is the way the API is supposed to be used.
854
855         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
856         (WebCore::webkitMediaStreamSrcAddPad):
857
858 2018-07-12  Yusuke Suzuki  <utatane.tea@gmail.com>
859
860         [JSC] Thread VM& to JSCell::methodTable(VM&)
861         https://bugs.webkit.org/show_bug.cgi?id=187548
862
863         Reviewed by Saam Barati.
864
865         * bindings/js/JSDOMConstructorBase.h:
866         (WebCore::JSDOMConstructorBase::className):
867         * bindings/js/JSPluginElementFunctions.cpp:
868         (WebCore::pluginElementCustomGetCallData):
869         * bindings/scripts/CodeGeneratorJS.pm:
870         (GenerateHeader):
871         (GenerateImplementation):
872         * bindings/scripts/test/JS/JSInterfaceName.cpp:
873         (WebCore::JSInterfaceName::estimatedSize):
874         * bindings/scripts/test/JS/JSInterfaceName.h:
875
876 2018-07-11  Youenn Fablet  <youenn@apple.com>
877
878         MediaDevices should derive from EventTarget in its IDL
879         https://bugs.webkit.org/show_bug.cgi?id=187575
880
881         Reviewed by Chris Dumez.
882
883         Test: fast/mediastream/MediaDevices-addEventListener.html
884
885         * Modules/mediastream/MediaDevices.idl:
886
887 2018-07-11  Jon Lee  <jonlee@apple.com>
888
889         Update iOS fullscreen alert text
890         https://bugs.webkit.org/show_bug.cgi?id=187576
891         rdar://problem/42052284
892
893         Reviewed by Ryosuke Niwa.
894
895         * English.lproj/Localizable.strings:
896
897 2018-07-11  Commit Queue  <commit-queue@webkit.org>
898
899         Unreviewed, rolling out r233742.
900         https://bugs.webkit.org/show_bug.cgi?id=187577
901
902         Binary incompatible change with respect to Service Worker
903         registration map (Requested by dydz on #webkit).
904
905         Reverted changeset:
906
907         "Reduce size of WebCore::URL"
908         https://bugs.webkit.org/show_bug.cgi?id=186820
909         https://trac.webkit.org/changeset/233742
910
911 2018-07-11  Aditya Keerthi  <akeerthi@apple.com>
912
913         REGRESSION (231276): Attempting to copy an image fails
914         https://bugs.webkit.org/show_bug.cgi?id=187212
915         <rdar://problem/41540074>
916
917         Reviewed by Ryosuke Niwa.
918
919         Renamed methods to make it clear that one URL and one title are being passed in.
920
921         Test: editing/mac/pasteboard/can-copy-url-without-title.html
922
923         * platform/PasteboardStrategy.h:
924         * platform/PlatformPasteboard.h:
925         * platform/ios/PlatformPasteboardIOS.mm:
926         (WebCore::PlatformPasteboard::setURL):
927         * platform/mac/PasteboardMac.mm:
928         (WebCore::writeURLForTypes):
929         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
930         * platform/mac/PlatformPasteboardMac.mm:
931         (WebCore::PlatformPasteboard::setURL):
932
933 2018-07-11  Alex Christensen  <achristensen@webkit.org>
934
935         Add SPI for immediate injection of user scripts
936         https://bugs.webkit.org/show_bug.cgi?id=173342
937         <rdar://problem/29202285>
938
939         Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen.
940
941         The new SPI is WKUserContentController._addUserScriptImmediately.
942         It is covered by new API tests.
943         Existing functionality remains unchanged unless the new SPI is adopted.
944
945         * page/Frame.cpp:
946         (WebCore::Frame::injectUserScripts):
947         (WebCore::Frame::injectUserScriptImmediately):
948         Move injection functionality to allow us to call it directly from the new SPI.
949         * page/Frame.h:
950         * page/Page.cpp:
951         (WebCore::Page::forEachPage):
952         * page/Page.h:
953
954 2018-07-11  Alex Christensen  <achristensen@webkit.org>
955
956         Reduce size of WebCore::URL
957         https://bugs.webkit.org/show_bug.cgi?id=186820
958
959         Reviewed by Yusuke Suzuki.
960
961         We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive
962         because port numbers are missing or between 0 and 65535.  Let's just use 3 bits here.
963         We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be
964         longer for some custom schemes, but I've never seen one more than 20 characters.  If we assume
965         schemes are always less than 64MB, we can save 8 bytes per URL!
966
967         No change in behavior, just less memory use!
968
969         * platform/URL.cpp:
970         (WebCore::URL::invalidate):
971         (WebCore::URL::lastPathComponent const):
972         (WebCore::URL::port const):
973         (WebCore::URL::protocolHostAndPort const):
974         (WebCore::URL::path const):
975         (WebCore::URL::removePort):
976         (WebCore::URL::setPort):
977         (WebCore::URL::setHostAndPort):
978         (WebCore::URL::setPath):
979         * platform/URL.h:
980         (WebCore::URL::encode const):
981         (WebCore::URL::decode):
982         (WebCore::URL::hasPath const):
983         (WebCore::URL::pathStart const):
984         * platform/URLParser.cpp:
985         (WebCore::URLParser::copyBaseWindowsDriveLetter):
986         (WebCore::URLParser::urlLengthUntilPart):
987         (WebCore::URLParser::copyURLPartsUntil):
988         (WebCore::URLParser::shouldPopPath):
989         (WebCore::URLParser::popPath):
990         (WebCore::URLParser::parse):
991         (WebCore::URLParser::parsePort):
992         (WebCore::URLParser::parseHostAndPort):
993         (WebCore::URLParser::allValuesEqual):
994         (WebCore::URLParser::internalValuesConsistent):
995
996 2018-07-11  Youenn Fablet  <youenn@apple.com>
997
998         Fix remaining Cross-Origin-Resource-Policy failures, if any
999         https://bugs.webkit.org/show_bug.cgi?id=186761
1000         <rdar://problem/41209829>
1001
1002         Reviewed by Alex Christensen.
1003
1004         Add case-sensitive check for CORP header value, as per fetch specification.
1005         Add HTTP->HTTPS check for same-site case, as per fetch specification.
1006         https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
1007
1008         Test: imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html
1009
1010         * loader/CrossOriginAccessControl.cpp:
1011         (WebCore::shouldCrossOriginResourcePolicyCancelLoad):
1012         * platform/network/HTTPParsers.cpp:
1013         (WebCore::parseCrossOriginResourcePolicyHeader):
1014
1015 2018-07-11  Ross Kirsling  <ross.kirsling@sony.com>
1016
1017         [WinCairo] MIME type registry doesn't explicitly recognize *.xht
1018         https://bugs.webkit.org/show_bug.cgi?id=187555
1019
1020         Reviewed by Konstantin Tokarev.
1021
1022         Follow-up to r233715 -- WinCairo bots are failing on *.xht layout tests as they lack a registry key for this filetype.
1023         (Hopefully this is the last one to add.)
1024
1025         * platform/win/MIMETypeRegistryWin.cpp:
1026         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
1027         Add *.xht to the list of recognized filetypes.
1028
1029 2018-07-11  Antoine Quint  <graouts@apple.com>
1030
1031         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1032         https://bugs.webkit.org/show_bug.cgi?id=186501
1033         <rdar://problem/41000224>
1034
1035         Unreviewed build fix after r233729 and r233730.
1036
1037         * animation/KeyframeEffectReadOnly.cpp:
1038         (WebCore::processIterableKeyframes):
1039
1040 2018-07-11  Antoine Quint  <graouts@apple.com>
1041
1042         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1043         https://bugs.webkit.org/show_bug.cgi?id=186501
1044         <rdar://problem/41000224>
1045
1046         Unreviewed build fix after r233729.
1047
1048         * animation/KeyframeEffectReadOnly.cpp:
1049         (WebCore::processIterableKeyframes):
1050
1051 2018-07-10  Antoine Quint  <graouts@apple.com>
1052
1053         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1054         https://bugs.webkit.org/show_bug.cgi?id=186501
1055         <rdar://problem/41000224>
1056
1057         Reviewed by Dean Jackson.
1058
1059         There were two remaining assertions that we were failing in this WPT test file, both related to processing iterable keyframes.
1060         The first one was failing because didn't correctly propagate the TypeError exception in the forEachInIterable() callback. The
1061         second one was failing because we didn't use the "process a keyframe-like object" procedure when processing iterable keyframes
1062         and, as such, we didn't correctly sort property alphabetically before reading their values.
1063
1064         To fix this second issue, we make processIterableKeyframes() use processKeyframeLikeObject(). To do so, we update processKeyframeLikeObject()
1065         to accept a new boolean flag to match the "allow lists" flag from the specification. We also ensure we sort the properties *before*
1066         reading from them which we didn't use to do previously.
1067
1068         * animation/KeyframeEffectReadOnly.cpp:
1069         (WebCore::processKeyframeLikeObject):
1070         (WebCore::processIterableKeyframes):
1071         (WebCore::processPropertyIndexedKeyframes):
1072         * animation/KeyframeEffectReadOnly.h:
1073         * animation/KeyframeEffectReadOnly.idl:
1074
1075 2018-07-11  Zalan Bujtas  <zalan@apple.com>
1076
1077         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
1078         https://bugs.webkit.org/show_bug.cgi?id=186709
1079         <rdar://problem/41173793>
1080
1081         Reviewed by Simon Fraser.
1082
1083         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
1084
1085         Not testable.
1086
1087         * rendering/SimpleLineLayoutFlowContents.h:
1088
1089 2018-07-10  Youenn Fablet  <youenn@apple.com>
1090
1091         Make fetch() use "same-origin" credentials by default
1092         https://bugs.webkit.org/show_bug.cgi?id=176023
1093
1094         Reviewed by Chris Dumez.
1095
1096         Covered by updated tests.
1097
1098         * Modules/fetch/FetchRequest.cpp:
1099         (WebCore::FetchRequest::initializeWith):
1100         Setting credentials mode to same-origin for FetchRequest by default.
1101         * loader/DocumentThreadableLoader.cpp:
1102         (WebCore::DocumentThreadableLoader::redirectReceived):
1103         Handle correctly referrer in case we restart a load.
1104         * page/PerformanceResourceTiming.cpp:
1105         (WebCore::entryStartTime):
1106         (WebCore::entryEndTime):
1107         In case it is not allowed to disclose resource timing info, update as
1108         https://www.w3.org/TR/resource-timing-1/#performanceresourcetiming
1109
1110 2018-07-10  Chris Dumez  <cdumez@apple.com>
1111
1112         "serviceworker.js" is fetched several times in a row
1113         https://bugs.webkit.org/show_bug.cgi?id=187435
1114         <rdar://problem/41940569>
1115
1116         Reviewed by Youenn Fablet.
1117
1118         Soft updates happen every time a fetch event is sent to a service worker for a main resource request.
1119         This can happen many times during a page load and will cause us to spam the HTTP server with update
1120         requests, especially considering that the default behavior is to bypass the HTTP cache. To address
1121         the issue, we now do soft updates on a 1 second delay and we keep rescheduling this timer was long as
1122         soft update requests keep coming. Based on my understanding of the Chromium code, this seems to be
1123         what they are doing so this should align our behavior with them.
1124
1125         * workers/service/ServiceWorkerRegistration.cpp:
1126         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
1127         (WebCore::ServiceWorkerRegistration::scheduleSoftUpdate):
1128         * workers/service/ServiceWorkerRegistration.h:
1129         * workers/service/context/ServiceWorkerFetch.cpp:
1130         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1131
1132 2018-07-10  Ross Kirsling  <ross.kirsling@sony.com>
1133
1134         [WinCairo] MIME type registry doesn't explicitly recognize *.css
1135         https://bugs.webkit.org/show_bug.cgi?id=187538
1136
1137         Reviewed by Yusuke Suzuki.
1138
1139         MIMETypeRegistryWin doesn't explicitly recognize *.css; it instead falls back to the registry key "Content Type"
1140         under HKEY_CLASSES_ROOT\.css. This key doesn't exist on Windows Server unless an application actually registers
1141         it -- as a result, WinCairo bots are currently viewing it as an unrecognized filetype!
1142
1143         * platform/win/MIMETypeRegistryWin.cpp:
1144         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
1145         Add *.css to the list of recognized filetypes.
1146
1147 2018-07-10  Timothy Hatcher  <timothy@apple.com>
1148
1149         REGRESSION (r233552): Find highlight has white text on yellow background
1150         https://bugs.webkit.org/show_bug.cgi?id=187535
1151         rdar://problem/42043371
1152
1153         Reviewed by Tim Horton.
1154
1155         Fixes existing image tests:
1156         - fast/text/mark-matches-rendering.html
1157         - fast/text/mark-matches-broken-line-rendering.html
1158
1159         * rendering/InlineTextBox.cpp:
1160         (WebCore::InlineTextBox::resolveStyleForMarkedText): Remove incorect UseDarkAppearance.
1161
1162 2018-07-10  Chris Fleizach  <cfleizach@apple.com>
1163
1164         AX: Crash in accessing AXObjectCache in textMarkerDataForVisiblePosition
1165         https://bugs.webkit.org/show_bug.cgi?id=187528
1166         <rdar://problem/37231941>
1167
1168         Reviewed by Joanmarie Diggs.
1169
1170         Occasional crashes reported when running accessibility/mac/search-field-cancel-button.html.
1171         Looks like the cache object retrieved was not valid and we weren't checking for it.
1172
1173         * accessibility/AXObjectCache.cpp:
1174         (WebCore::AXObjectCache::visiblePositionForTextMarkerData):
1175         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
1176         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
1177
1178 2018-07-10  Zalan Bujtas  <zalan@apple.com>
1179
1180         FragmentInterval, FragmentIntervalTree and FragmentSearchAdapter should hold not hold raw pointers to renderers.
1181         https://bugs.webkit.org/show_bug.cgi?id=187249
1182         <rdar://problem/41725869>
1183
1184         Reviewed by Simon Fraser.
1185
1186         Test: fast/multicol/crash-in-vertical-writing-mode.html
1187
1188         * rendering/RenderFragmentedFlow.cpp:
1189         (WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect):
1190         * rendering/RenderFragmentedFlow.h:
1191         (WTF::ValueToString<WeakPtr<WebCore::RenderFragmentContainer>>::string):
1192
1193 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
1194
1195         Disable cross-origin-window-policy by default
1196         https://bugs.webkit.org/show_bug.cgi?id=187509
1197
1198         Reviewed by Chris Dumez.
1199
1200         Disabled the feature by default.
1201
1202         * page/Settings.yaml:
1203
1204 2018-07-10  Alejandro G. Castro  <alex@igalia.com>
1205
1206         [GTK][WPE] The LibWebRTCProvider object in RealtimeMediaSourceCenterLibWebRTC is not needed anymore
1207         https://bugs.webkit.org/show_bug.cgi?id=187513
1208
1209         Reviewed by Youenn Fablet.
1210
1211         We used the factory of the LibWebRTCProvider in
1212         RealtimeMediaSourceCenterLibWebRTC as a singleton to make sure the
1213         devices were correctly listed and used, we needed this when using
1214         libwebrtc media devices management. We are now using GStreamer to handle
1215         the media devices so this is not needed anymore.
1216
1217         No new tests, this change removed unused code.
1218
1219         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
1220         (WebCore::RealtimeMediaSourceCenterLibWebRTC::RealtimeMediaSourceCenterLibWebRTC):
1221         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
1222
1223 2018-07-10  Zalan Bujtas  <zalan@apple.com>
1224
1225         Rollout r233530: Candidate for Speedometer regression.
1226         https://bugs.webkit.org/show_bug.cgi?id=187518
1227
1228         * rendering/SimpleLineLayoutFlowContents.h:
1229
1230 2018-07-09  Antoine Quint  <graouts@apple.com>
1231
1232         [Web Animations] Correct handle repetition of composite and easing values
1233         https://bugs.webkit.org/show_bug.cgi?id=187498
1234         <rdar://problem/41999183>
1235
1236         Reviewed by Dean Jackson.
1237
1238         If there are fewer values for "easing" and "composite" than there are keyframes, we are supposed to
1239         fill in missing values by repeating the pattern of specified values. We were starting our iteration
1240         to fill those missing values on the second missing value rather than the first missing value.
1241
1242         * animation/KeyframeEffectReadOnly.cpp:
1243         (WebCore::processPropertyIndexedKeyframes):
1244
1245 2018-07-09  Youenn Fablet  <youenn@apple.com>
1246
1247         Add the possibility to run unsandboxed plug-ins
1248         https://bugs.webkit.org/show_bug.cgi?id=187310
1249         <rdar://problem/41798808>
1250
1251         Reviewed by Alexey Proskuryakov.
1252
1253         Add a runtime flag to enforce plugin sandboxing.
1254         Covered by manual testing.
1255
1256         * page/RuntimeEnabledFeatures.h:
1257         (WebCore::RuntimeEnabledFeatures::setSandboxPlugInEnabled):
1258         (WebCore::RuntimeEnabledFeatures::sandboxPlugInEnabled const):
1259
1260 2018-07-09  Dean Jackson  <dino@apple.com>
1261
1262         Remove fullscreen-auto-hide-delay
1263         https://bugs.webkit.org/show_bug.cgi?id=187493
1264         <rdar://problem/41830852>
1265
1266         Reviewed by Antoine Quint.
1267
1268         Remove the env() value for fullscreen-auto-hide-delay.
1269
1270         * dom/ConstantPropertyMap.cpp:
1271         (WebCore::ConstantPropertyMap::nameForProperty const):
1272         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay): Deleted.
1273         * dom/ConstantPropertyMap.h:
1274         * page/Page.cpp:
1275         (WebCore::Page::setFullscreenAutoHideDelay): Deleted.
1276         * page/Page.h:
1277         * testing/Internals.cpp:
1278         (WebCore::Internals::resetToConsistentState): No need to reset delay.
1279         (WebCore::Internals::setFullscreenAutoHideDelay): Deleted.
1280         * testing/Internals.h: Remove the delay setter/getter.
1281         * testing/Internals.idl:
1282
1283 2018-07-09  Timothy Hatcher  <timothy@apple.com>
1284
1285         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
1286         https://bugs.webkit.org/show_bug.cgi?id=187425
1287         rdar://problem/39948240
1288
1289         Reviewed by Tim Horton.
1290
1291         Added a listener for the accessibility change notification to invalidate our color caches.
1292
1293         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
1294         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
1295         Instead, changed the functions to use the new instance version instead.
1296
1297         * page/Page.cpp:
1298         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
1299         per instance instead of on all pages (since appearance can be difference per view).
1300         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
1301         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
1302         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
1303         * page/Page.h:
1304         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
1305         * platform/mac/LocalDefaultSystemAppearance.mm:
1306         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
1307         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
1308         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
1309         * rendering/RenderThemeMac.mm:
1310         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
1311         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
1312         (WebCore::RenderThemeMac::systemColor): Change how system link colors are cached. Don't store useSystemAppearance link colors in the
1313         ColorCache, since that special bool isn't considered in the cache after the first time.
1314
1315 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
1316
1317         Shrink various loading-related enums to shrink CachedResource
1318         https://bugs.webkit.org/show_bug.cgi?id=187443
1319
1320         Reviewed by Chris Dumez.
1321         
1322         ResourceRequestBase, ResourceResponseBase, ResourceLoaderOptions, FetchOptions and
1323         CachedResource have a lot of enum members variables most of which took 4 bytes each.
1324         These can be packed much more efficiently if the enums are declared with an 8-bit size.
1325         This requires turning enums into enum classes in some cases.
1326         
1327         This reduces the size of CachedResource from 1464 to 1384 bytes, which saves about 49KB
1328         over the ~600 CachedResources on nytimes.com.
1329
1330         * Modules/fetch/FetchLoader.cpp:
1331         (WebCore::FetchLoader::startLoadingBlobURL):
1332         (WebCore::FetchLoader::start):
1333         * css/StyleRuleImport.cpp:
1334         (WebCore::StyleRuleImport::requestStyleSheet):
1335         * fileapi/FileReaderLoader.cpp:
1336         (WebCore::FileReaderLoader::start):
1337         * html/MediaDocument.cpp:
1338         (WebCore::MediaDocumentParser::createDocumentStructure):
1339         * html/PluginDocument.cpp:
1340         (WebCore::PluginDocumentParser::appendBytes):
1341         * html/parser/CSSPreloadScanner.cpp:
1342         (WebCore::CSSPreloadScanner::emitRule):
1343         * html/parser/HTMLPreloadScanner.cpp:
1344         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType const):
1345         * inspector/NetworkResourcesData.cpp:
1346         (WebCore::shouldBufferResourceData):
1347         * inspector/agents/InspectorNetworkAgent.cpp:
1348         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1349         (WebCore::InspectorNetworkAgent::loadResource):
1350         (WebCore::InspectorNetworkAgent::cachedResourceContent):
1351         * inspector/agents/InspectorPageAgent.cpp:
1352         (WebCore::InspectorPageAgent::sourceMapURLForResource):
1353         (WebCore::InspectorPageAgent::inspectorResourceType):
1354         * loader/ApplicationManifestLoader.cpp:
1355         (WebCore::ApplicationManifestLoader::startLoading):
1356         * loader/ContentFilter.cpp:
1357         (WebCore::ContentFilter::deliverResourceData):
1358         * loader/DocumentLoader.cpp:
1359         (WebCore::DocumentLoader::notifyFinished):
1360         (WebCore::DocumentLoader::willSendRequest):
1361         (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache):
1362         (WebCore::DocumentLoader::subresource const):
1363         (WebCore::DocumentLoader::loadMainResource):
1364         * loader/DocumentThreadableLoader.cpp:
1365         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1366         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1367         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
1368         (WebCore::DocumentThreadableLoader::preflightSuccess):
1369         (WebCore::DocumentThreadableLoader::loadRequest):
1370         * loader/FetchOptions.h:
1371         (WebCore::FetchOptions::FetchOptions):
1372         * loader/FrameLoader.cpp:
1373         (WebCore::FrameLoader::loadFrameRequest):
1374         (WebCore::FrameLoader::loadURL):
1375         (WebCore::FrameLoader::load):
1376         (WebCore::FrameLoader::reloadWithOverrideEncoding):
1377         (WebCore::FrameLoader::reload):
1378         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1379         (WebCore::FrameLoader::addExtraFieldsToRequest):
1380         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
1381         (WebCore::FrameLoader::loadDifferentDocumentItem):
1382         * loader/LinkLoader.cpp:
1383         (WebCore::LinkLoader::resourceTypeFromAsAttribute):
1384         (WebCore::createLinkPreloadResourceClient):
1385         (WebCore::LinkLoader::isSupportedType):
1386         (WebCore::LinkLoader::prefetchIfNeeded):
1387         * loader/MediaResourceLoader.cpp:
1388         (WebCore::MediaResourceLoader::requestResource):
1389         * loader/NavigationScheduler.cpp:
1390         (WebCore::NavigationScheduler::scheduleLocationChange):
1391         * loader/NetscapePlugInStreamLoader.cpp:
1392         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
1393         * loader/ResourceLoadInfo.cpp:
1394         (WebCore::toResourceType):
1395         * loader/ResourceLoader.cpp:
1396         (WebCore::ResourceLoader::init):
1397         (WebCore::ResourceLoader::start):
1398         (WebCore::ResourceLoader::setDataBufferingPolicy):
1399         (WebCore::ResourceLoader::addDataOrBuffer):
1400         (WebCore::ResourceLoader::willSendRequestInternal):
1401         (WebCore::ResourceLoader::didReceiveResponse):
1402         (WebCore::ResourceLoader::didReceiveDataOrBuffer):
1403         (WebCore::ResourceLoader::didFinishLoadingOnePart):
1404         (WebCore::ResourceLoader::cleanupForError):
1405         * loader/ResourceLoader.h:
1406         (WebCore::ResourceLoader::shouldSendResourceLoadCallbacks const):
1407         (WebCore::ResourceLoader::shouldSniffContent const):
1408         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const):
1409         * loader/ResourceLoaderOptions.h:
1410         * loader/ResourceTimingInformation.cpp:
1411         (WebCore::ResourceTimingInformation::addResourceTiming):
1412         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
1413         * loader/SubresourceLoader.cpp:
1414         (WebCore::SubresourceLoader::SubresourceLoader):
1415         (WebCore::SubresourceLoader::willSendRequestInternal):
1416         (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse const):
1417         (WebCore::SubresourceLoader::didReceiveResponse):
1418         (WebCore::logResourceLoaded):
1419         (WebCore::SubresourceLoader::didFinishLoading):
1420         (WebCore::SubresourceLoader::didFail):
1421         (WebCore::SubresourceLoader::didCancel):
1422         * loader/cache/CachedApplicationManifest.cpp:
1423         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
1424         * loader/cache/CachedApplicationManifest.h:
1425         * loader/cache/CachedCSSStyleSheet.cpp:
1426         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
1427         * loader/cache/CachedCSSStyleSheet.h:
1428         * loader/cache/CachedFont.h:
1429         * loader/cache/CachedImage.cpp:
1430         (WebCore::CachedImage::CachedImage):
1431         (WebCore::CachedImage::updateBuffer):
1432         (WebCore::CachedImage::updateData):
1433         * loader/cache/CachedImage.h:
1434         * loader/cache/CachedRawResource.cpp:
1435         (WebCore::CachedRawResource::updateBuffer):
1436         (WebCore::CachedRawResource::updateData):
1437         (WebCore::CachedRawResource::finishLoading):
1438         (WebCore::CachedRawResource::canReuse const):
1439         * loader/cache/CachedResource.cpp:
1440         (WebCore::CachedResource::defaultPriorityForResourceType):
1441         (WebCore::deadDecodedDataDeletionIntervalForResourceType):
1442         (WebCore::CachedResource::CachedResource):
1443         (WebCore::CachedResource::load):
1444         (WebCore::CachedResource::updateBuffer):
1445         (WebCore::CachedResource::updateData):
1446         (WebCore::CachedResource::isCORSSameOrigin const):
1447         (WebCore::CachedResource::freshnessLifetime const):
1448         (WebCore::CachedResource::setResponse):
1449         (WebCore::CachedResource::addClientToSet):
1450         (WebCore::CachedResource::areAllClientsXMLHttpRequests const):
1451         * loader/cache/CachedResource.h:
1452         (WebCore::CachedResource::isImage const):
1453         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
1454         (WebCore::CachedResource::ignoreForRequestCount const):
1455         (WebCore::CachedResource::shouldSendResourceLoadCallbacks const):
1456         * loader/cache/CachedResourceLoader.cpp:
1457         (WebCore::createResource):
1458         (WebCore::CachedResourceLoader::requestImage):
1459         (WebCore::CachedResourceLoader::requestFont):
1460         (WebCore::CachedResourceLoader::requestTextTrack):
1461         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1462         (WebCore::CachedResourceLoader::requestScript):
1463         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1464         (WebCore::CachedResourceLoader::requestSVGDocument):
1465         (WebCore::CachedResourceLoader::requestLinkResource):
1466         (WebCore::CachedResourceLoader::requestMedia):
1467         (WebCore::CachedResourceLoader::requestIcon):
1468         (WebCore::CachedResourceLoader::requestRawResource):
1469         (WebCore::CachedResourceLoader::requestBeaconResource):
1470         (WebCore::CachedResourceLoader::requestMainResource):
1471         (WebCore::CachedResourceLoader::requestApplicationManifest):
1472         (WebCore::contentTypeFromResourceType):
1473         (WebCore::CachedResourceLoader::checkInsecureContent const):
1474         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
1475         (WebCore::CachedResourceLoader::canRequest):
1476         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox const):
1477         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
1478         (WebCore::isResourceSuitableForDirectReuse):
1479         (WebCore::destinationForType):
1480         (WebCore::CachedResourceLoader::loadResource):
1481         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
1482         (WebCore::CachedResourceLoader::cachePolicy const):
1483         (WebCore::CachedResourceLoader::preload):
1484         (WebCore::CachedResourceLoader::warnUnusedPreloads):
1485         (WebCore::CachedResourceLoader::clearPreloads):
1486         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
1487         * loader/cache/CachedResourceRequest.cpp:
1488         (WebCore::CachedResourceRequest::updateAccordingCacheMode):
1489         * loader/cache/CachedResourceRequest.h:
1490         * loader/cache/CachedSVGDocument.cpp:
1491         (WebCore::CachedSVGDocument::CachedSVGDocument):
1492         * loader/cache/CachedSVGDocument.h:
1493         * loader/cache/CachedSVGFont.cpp:
1494         (WebCore::CachedSVGFont::CachedSVGFont):
1495         * loader/cache/CachedSVGFont.h:
1496         * loader/cache/CachedScript.cpp:
1497         (WebCore::CachedScript::CachedScript):
1498         * loader/cache/CachedScript.h:
1499         * loader/cache/CachedTextTrack.cpp:
1500         (WebCore::CachedTextTrack::CachedTextTrack):
1501         (WebCore::CachedTextTrack::doUpdateBuffer):
1502         * loader/cache/CachedTextTrack.h:
1503         * loader/cache/CachedXSLStyleSheet.cpp:
1504         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
1505         * loader/cache/CachedXSLStyleSheet.h:
1506         * loader/cache/MemoryCache.cpp:
1507         (WebCore::MemoryCache::getStatistics):
1508         * loader/icon/IconLoader.cpp:
1509         (WebCore::IconLoader::startLoading):
1510         * loader/mac/ResourceLoaderMac.mm:
1511         (WebCore::ResourceLoader::willCacheResponseAsync):
1512         * page/DOMWindow.cpp:
1513         (WebCore::DOMWindow::createWindow):
1514         * page/EventSource.cpp:
1515         (WebCore::EventSource::connect):
1516         * platform/ReferrerPolicy.h:
1517         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1518         (WebCore::WebCoreAVFResourceLoader::startLoading):
1519         * platform/ios/QuickLook.mm:
1520         (WebCore::registerQLPreviewConverterIfNeeded):
1521         * platform/network/CacheValidation.cpp:
1522         (WebCore::updateRedirectChainStatus):
1523         (WebCore::redirectChainAllowsReuse):
1524         * platform/network/CacheValidation.h:
1525         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
1526         * platform/network/ResourceErrorBase.h:
1527         * platform/network/ResourceLoadPriority.h:
1528         * platform/network/ResourceRequestBase.cpp:
1529         (WebCore::ResourceRequestBase::httpBody const):
1530         (WebCore::ResourceRequestBase::updatePlatformRequest const):
1531         (WebCore::ResourceRequestBase::updateResourceRequest const):
1532         * platform/network/ResourceRequestBase.h:
1533         * platform/network/ResourceResponseBase.h:
1534         * platform/network/StoredCredentialsPolicy.h:
1535         * platform/network/cf/ResourceRequest.h:
1536         (WebCore::ResourceRequest::ResourceRequest):
1537         * platform/network/cf/ResourceRequestCFNet.cpp:
1538         (WebCore::toPlatformRequestCachePolicy):
1539         (WebCore::fromPlatformRequestCachePolicy):
1540         (WebCore::ResourceRequest::doUpdateResourceRequest):
1541         * platform/network/cocoa/ResourceRequestCocoa.mm:
1542         (WebCore::fromPlatformRequestCachePolicy):
1543         (WebCore::toPlatformRequestCachePolicy):
1544         (WebCore::ResourceRequest::doUpdateResourceRequest):
1545         * platform/network/cocoa/WebCoreNSURLSession.mm:
1546         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
1547         * platform/network/ios/PreviewConverter.mm:
1548         (WebCore::PreviewConverter::safeRequest const):
1549         * platform/network/mac/ResourceHandleMac.mm:
1550         (WebCore::ResourceHandle::createNSURLConnection):
1551         (WebCore::ResourceHandle::start):
1552         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1553         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1554         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1555         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1556         * testing/Internals.cpp:
1557         (WebCore::toResourceRequestCachePolicy):
1558         * workers/WorkerScriptLoader.cpp:
1559         (WebCore::WorkerScriptLoader::loadSynchronously):
1560         (WebCore::WorkerScriptLoader::loadAsynchronously):
1561         * xml/XMLHttpRequest.cpp:
1562         (WebCore::XMLHttpRequest::createRequest):
1563
1564 2018-07-09  Antoine Quint  <graouts@apple.com>
1565
1566         [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
1567         https://bugs.webkit.org/show_bug.cgi?id=186498
1568         <rdar://problem/41000205>
1569         
1570         Reviewed by Dean Jackson.
1571
1572         Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
1573         origin time. To ensure all DocumentTimeline instances report matching current times, we read the
1574         current time from the "main" document timeline, the one created by the Document automatically.
1575
1576         * CMakeLists.txt:
1577         * DerivedSources.make:
1578         * Sources.txt:
1579         * WebCore.xcodeproj/project.pbxproj:
1580         * animation/DocumentTimeline.cpp:
1581         (WebCore::DocumentTimeline::create):
1582         (WebCore::DocumentTimeline::DocumentTimeline):
1583         (WebCore::DocumentTimeline::currentTime):
1584         * animation/DocumentTimeline.h:
1585         * animation/DocumentTimeline.idl:
1586         * animation/DocumentTimelineOptions.h:
1587         * animation/DocumentTimelineOptions.idl:
1588
1589 2018-07-09  Antoine Quint  <graouts@apple.com>
1590
1591         [Web Animations] Support overlapping keyframes
1592         https://bugs.webkit.org/show_bug.cgi?id=187481
1593         <rdar://problem/41988674>
1594
1595         Reviewed by Dean Jackson.
1596
1597         We now support parsing of multiple keyframes for the same offset.
1598
1599         * animation/KeyframeEffectReadOnly.cpp:
1600         (WebCore::computeMissingKeyframeOffsets): Keyframes with a null offset that don't yet have a non-zero
1601         computed offset are keyframes with an offset that needs to be computed.
1602         (WebCore::KeyframeEffectReadOnly::processKeyframes): Only file an exception if an offset is found that
1603         is lower than a previously-parsed one, allowing offsets with the same value.
1604         * rendering/style/KeyframeList.cpp:
1605         (WebCore::KeyframeList::insert): Remove the assertion that prevented an offset to be found more than once.
1606
1607 2018-07-09  Youenn Fablet  <youenn@apple.com>
1608
1609         StringView operator==(char*) should check the length of the string
1610         https://bugs.webkit.org/show_bug.cgi?id=187422
1611
1612         Reviewed by Chris Dumez.
1613
1614         Covered by existing tests.
1615
1616         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1617         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename):
1618
1619 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
1620
1621         Shrink WebCore::Pair
1622         https://bugs.webkit.org/show_bug.cgi?id=187450
1623
1624         Reviewed by Sam Weinig.
1625
1626         Move m_encoding to pack in with m_refCount and remove the virtual destructor,
1627         shrinking the class from 40 to 24 bytes.
1628         Also make the enum take only a byte, in case it gets used elsewhere
1629         
1630         There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.
1631
1632         * css/Pair.h:
1633
1634 2018-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1635
1636         [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible
1637         https://bugs.webkit.org/show_bug.cgi?id=187474
1638
1639         Reviewed by Mark Lam.
1640
1641         When opening cnn.com, debugger says that so many objects in WebCore are allocated
1642         from system allocator. This patch attempts to annotate these found classes with
1643         WTF_MAKE_FAST_ALLOCATED.
1644
1645         We also annotate WebAudio classes with `final` to make WebAudio class hierarchy solid.
1646
1647         No behavior change.
1648
1649         * Modules/indexeddb/IDBIndex.h:
1650         * Modules/indexeddb/IDBObjectStore.h:
1651         * Modules/indexeddb/client/IDBConnectionProxy.h:
1652         * Modules/mediastream/UserMediaController.h:
1653         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1654         * Modules/webaudio/AsyncAudioDecoder.h:
1655         * Modules/webaudio/AudioListener.h:
1656         (WebCore::AudioListener::create): Deleted.
1657         (WebCore::AudioListener::setPosition): Deleted.
1658         (WebCore::AudioListener::position const): Deleted.
1659         (WebCore::AudioListener::setOrientation): Deleted.
1660         (WebCore::AudioListener::orientation const): Deleted.
1661         (WebCore::AudioListener::setUpVector): Deleted.
1662         (WebCore::AudioListener::upVector const): Deleted.
1663         (WebCore::AudioListener::setVelocity): Deleted.
1664         (WebCore::AudioListener::velocity const): Deleted.
1665         (WebCore::AudioListener::setDopplerFactor): Deleted.
1666         (WebCore::AudioListener::dopplerFactor const): Deleted.
1667         (WebCore::AudioListener::setSpeedOfSound): Deleted.
1668         (WebCore::AudioListener::speedOfSound const): Deleted.
1669         * Modules/webaudio/AudioNode.h:
1670         * Modules/webaudio/AudioNodeInput.h:
1671         (WebCore::AudioNodeInput::node const): Deleted.
1672         * Modules/webaudio/AudioNodeOutput.h:
1673         * Modules/webaudio/AudioParam.h:
1674         (WebCore::AudioParam::create): Deleted.
1675         (WebCore::AudioParam::name const): Deleted.
1676         (WebCore::AudioParam::minValue const): Deleted.
1677         (WebCore::AudioParam::maxValue const): Deleted.
1678         (WebCore::AudioParam::defaultValue const): Deleted.
1679         (WebCore::AudioParam::units const): Deleted.
1680         (WebCore::AudioParam::resetSmoothedValue): Deleted.
1681         (WebCore::AudioParam::setSmoothingConstant): Deleted.
1682         (WebCore::AudioParam::setValueAtTime): Deleted.
1683         (WebCore::AudioParam::linearRampToValueAtTime): Deleted.
1684         (WebCore::AudioParam::exponentialRampToValueAtTime): Deleted.
1685         (WebCore::AudioParam::setTargetAtTime): Deleted.
1686         (WebCore::AudioParam::setValueCurveAtTime): Deleted.
1687         (WebCore::AudioParam::cancelScheduledValues): Deleted.
1688         (WebCore::AudioParam::hasSampleAccurateValues): Deleted.
1689         (WebCore::AudioParam::AudioParam): Deleted.
1690         * Modules/webaudio/AudioParamTimeline.h:
1691         * Modules/webaudio/AudioProcessingEvent.h:
1692         (WebCore::AudioProcessingEvent::create): Deleted.
1693         (WebCore::AudioProcessingEvent::createForBindings): Deleted.
1694         (WebCore::AudioProcessingEvent::inputBuffer): Deleted.
1695         (WebCore::AudioProcessingEvent::outputBuffer): Deleted.
1696         (WebCore::AudioProcessingEvent::playbackTime const): Deleted.
1697         * Modules/webaudio/BiquadDSPKernel.h:
1698         (WebCore::BiquadDSPKernel::BiquadDSPKernel): Deleted.
1699         (WebCore::BiquadDSPKernel::biquadProcessor): Deleted.
1700         * Modules/webaudio/BiquadFilterNode.h:
1701         (WebCore::BiquadFilterNode::create): Deleted.
1702         (WebCore::BiquadFilterNode::frequency): Deleted.
1703         (WebCore::BiquadFilterNode::q): Deleted.
1704         (WebCore::BiquadFilterNode::gain): Deleted.
1705         (WebCore::BiquadFilterNode::detune): Deleted.
1706         (WebCore::BiquadFilterNode::biquadProcessor): Deleted.
1707         * Modules/webaudio/BiquadProcessor.h:
1708         (WebCore::BiquadProcessor::filterCoefficientsDirty const): Deleted.
1709         (WebCore::BiquadProcessor::hasSampleAccurateValues const): Deleted.
1710         (WebCore::BiquadProcessor::parameter1): Deleted.
1711         (WebCore::BiquadProcessor::parameter2): Deleted.
1712         (WebCore::BiquadProcessor::parameter3): Deleted.
1713         (WebCore::BiquadProcessor::parameter4): Deleted.
1714         (WebCore::BiquadProcessor::type const): Deleted.
1715         * Modules/webaudio/ChannelMergerNode.h:
1716         * Modules/webaudio/ChannelSplitterNode.h:
1717         * Modules/webaudio/DelayDSPKernel.h:
1718         (WebCore::DelayDSPKernel::maxDelayTime const): Deleted.
1719         (WebCore::DelayDSPKernel::setDelayFrames): Deleted.
1720         (WebCore::DelayDSPKernel::delayProcessor): Deleted.
1721         * Modules/webaudio/DelayNode.h:
1722         * Modules/webaudio/DelayProcessor.h:
1723         (WebCore::DelayProcessor::delayTime const): Deleted.
1724         (WebCore::DelayProcessor::maxDelayTime): Deleted.
1725         * Modules/webaudio/DynamicsCompressorNode.h:
1726         (WebCore::DynamicsCompressorNode::create): Deleted.
1727         (WebCore::DynamicsCompressorNode::threshold): Deleted.
1728         (WebCore::DynamicsCompressorNode::knee): Deleted.
1729         (WebCore::DynamicsCompressorNode::ratio): Deleted.
1730         (WebCore::DynamicsCompressorNode::attack): Deleted.
1731         (WebCore::DynamicsCompressorNode::release): Deleted.
1732         (WebCore::DynamicsCompressorNode::reduction): Deleted.
1733         * Modules/webaudio/GainNode.h:
1734         (WebCore::GainNode::create): Deleted.
1735         (WebCore::GainNode::gain): Deleted.
1736         * Modules/webaudio/MediaElementAudioSourceNode.h:
1737         (WebCore::MediaElementAudioSourceNode::mediaElement): Deleted.
1738         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
1739         (WebCore::MediaStreamAudioDestinationNode::stream): Deleted.
1740         * Modules/webaudio/MediaStreamAudioSourceNode.h:
1741         (WebCore::MediaStreamAudioSourceNode::mediaStream): Deleted.
1742         * Modules/webaudio/OfflineAudioCompletionEvent.h:
1743         (WebCore::OfflineAudioCompletionEvent::renderedBuffer): Deleted.
1744         * Modules/webaudio/OfflineAudioDestinationNode.h:
1745         (WebCore::OfflineAudioDestinationNode::create): Deleted.
1746         * Modules/webaudio/PannerNode.h:
1747         (WebCore::PannerNode::create): Deleted.
1748         (WebCore::PannerNode::panningModel const): Deleted.
1749         (WebCore::PannerNode::position const): Deleted.
1750         (WebCore::PannerNode::setPosition): Deleted.
1751         (WebCore::PannerNode::orientation const): Deleted.
1752         (WebCore::PannerNode::setOrientation): Deleted.
1753         (WebCore::PannerNode::velocity const): Deleted.
1754         (WebCore::PannerNode::setVelocity): Deleted.
1755         (WebCore::PannerNode::refDistance): Deleted.
1756         (WebCore::PannerNode::setRefDistance): Deleted.
1757         (WebCore::PannerNode::maxDistance): Deleted.
1758         (WebCore::PannerNode::setMaxDistance): Deleted.
1759         (WebCore::PannerNode::rolloffFactor): Deleted.
1760         (WebCore::PannerNode::setRolloffFactor): Deleted.
1761         (WebCore::PannerNode::coneInnerAngle const): Deleted.
1762         (WebCore::PannerNode::setConeInnerAngle): Deleted.
1763         (WebCore::PannerNode::coneOuterAngle const): Deleted.
1764         (WebCore::PannerNode::setConeOuterAngle): Deleted.
1765         (WebCore::PannerNode::coneOuterGain const): Deleted.
1766         (WebCore::PannerNode::setConeOuterGain): Deleted.
1767         (WebCore::PannerNode::distanceGain): Deleted.
1768         (WebCore::PannerNode::coneGain): Deleted.
1769         * Modules/webaudio/PeriodicWave.h:
1770         (WebCore::PeriodicWave::rateScale const): Deleted.
1771         (WebCore::PeriodicWave::periodicWaveSize const): Deleted.
1772         (WebCore::PeriodicWave::sampleRate const): Deleted.
1773         (WebCore::PeriodicWave::numberOfRanges const): Deleted.
1774         * Modules/webaudio/RealtimeAnalyser.h:
1775         * Modules/webaudio/ScriptProcessorNode.h:
1776         (WebCore::ScriptProcessorNode::bufferSize const): Deleted.
1777         (WebCore::ScriptProcessorNode::doubleBufferIndex const): Deleted.
1778         (WebCore::ScriptProcessorNode::swapBuffers): Deleted.
1779         * Modules/webaudio/WaveShaperDSPKernel.h:
1780         (WebCore::WaveShaperDSPKernel::waveShaperProcessor): Deleted.
1781         * Modules/webaudio/WaveShaperProcessor.h:
1782         (WebCore::WaveShaperProcessor::curve): Deleted.
1783         (WebCore::WaveShaperProcessor::oversample const): Deleted.
1784         * dom/MessagePort.h:
1785         * html/FormAssociatedElement.h:
1786         * loader/LinkPreloadResourceClients.h:
1787         * page/WheelEventDeltaFilter.h:
1788         * page/mac/WheelEventDeltaFilterMac.h:
1789         * platform/RemoteCommandListener.h:
1790         * platform/audio/AudioDSPKernel.h:
1791         * platform/audio/AudioProcessor.h:
1792         * platform/audio/PlatformMediaSession.h:
1793         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
1794         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
1795         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
1796         * workers/service/ServiceWorkerContainer.h:
1797
1798 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
1799
1800         Shrink RenderSVGShape
1801         https://bugs.webkit.org/show_bug.cgi?id=187459
1802
1803         Reviewed by Zalan Bujtas.
1804
1805         Shrink RenderSVGShape from 328 to 320 bytes by moving the bits before the AffineTransform,
1806         which is 16-byte aligned. This saves 9.6KB on nytimes.com.
1807
1808         * rendering/svg/RenderSVGShape.h:
1809
1810 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
1811
1812         Shrink CSSFontFace
1813         https://bugs.webkit.org/show_bug.cgi?id=187456
1814
1815         Reviewed by Anders Carlsson.
1816
1817         Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
1818         but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
1819         so this saves about 22KB.
1820
1821         * css/CSSFontFace.cpp:
1822         (WebCore::CSSFontFace::CSSFontFace):
1823         * css/CSSFontFace.h:
1824         * platform/text/TextFlags.h:
1825         * rendering/style/RenderStyleConstants.h:
1826
1827 2018-07-09  Commit Queue  <commit-queue@webkit.org>
1828
1829         Unreviewed, rolling out r233612.
1830         https://bugs.webkit.org/show_bug.cgi?id=187475
1831
1832         Revision caused the api test LinkColorWithSystemAppearance to
1833         fail on all systems. (Requested by Truitt on #webkit).
1834
1835         Reverted changeset:
1836
1837         "Semantic colors don't update when accessibility Increase
1838         Contrast mode is enabled."
1839         https://bugs.webkit.org/show_bug.cgi?id=187425
1840         https://trac.webkit.org/changeset/233612
1841
1842 2018-07-09  Philippe Normand  <pnormand@igalia.com>
1843
1844         [GStreamer] Remove useless workaround
1845         https://bugs.webkit.org/show_bug.cgi?id=186921
1846
1847         Reviewed by Xabier Rodriguez-Calvar.
1848
1849         In bug 67407 a workaround was added for GStreamer 0.10. With 1.x
1850         the media/video-reverse-play-duration.html test passes without any
1851         workaround needed. The other test mentioned in that bug was
1852         removed, it seems.
1853
1854         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1855         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
1856         Removed early return, position queries shouldn't be avoided on EOS
1857         because the pipeline is in READY state, not NULL.
1858         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
1859
1860 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1861
1862         Optimize packing of RenderSVGViewportContainer
1863         https://bugs.webkit.org/show_bug.cgi?id=187458
1864
1865         Reviewed by Zalan Bujtas.
1866
1867         Shrink RenderSVGViewportContainer from 296 bytes to 280 bytes, saving about 6KB on nytimes.com.
1868
1869         * rendering/svg/RenderSVGContainer.cpp:
1870         (WebCore::RenderSVGContainer::RenderSVGContainer):
1871         * rendering/svg/RenderSVGContainer.h:
1872         * rendering/svg/RenderSVGViewportContainer.h:
1873
1874 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1875
1876         Shrink RenderTableSection
1877         https://bugs.webkit.org/show_bug.cgi?id=187457
1878
1879         Reviewed by Zalan Bujtas.
1880
1881         Shrink RenderTableSection from 344 to 336 bytes, saving about 3.6KB on nytimes.com.
1882
1883         * rendering/RenderTableSection.h:
1884
1885 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1886
1887         Optimize packing of RootInlineBox
1888         https://bugs.webkit.org/show_bug.cgi?id=187430
1889
1890         Reviewed by Zalan Bujtas.
1891
1892         In InlineBox, move the m_logicalWidth float up next to the m_expansion float with m_topLeft next; this
1893         avoids padding of 4 bytes after this float.
1894         
1895         In InlineFlowBox, move the bitfields before the pointers so they can snug up into the
1896         4 bytes after m_expansion in the base class.
1897         
1898         The comment about m_lineBreakPos's padding in RootInlineBox is wrong; just move it to the end
1899         to avoid padding before the m_lineBreakObj pointer.
1900         
1901         Make m_logicalWidth private and have derived classes use the accessor.
1902         
1903         Make EllipsisBox 4 bytes smaller too.
1904
1905         * rendering/EllipsisBox.cpp:
1906         (WebCore::EllipsisBox::EllipsisBox):
1907         (WebCore::EllipsisBox::paintMarkupBox):
1908         (WebCore::EllipsisBox::nodeAtPoint):
1909         * rendering/EllipsisBox.h:
1910         * rendering/InlineBox.h:
1911         (WebCore::InlineBox::InlineBox):
1912         * rendering/InlineFlowBox.cpp:
1913         * rendering/InlineFlowBox.h:
1914         (WebCore::InlineFlowBox::InlineFlowBox):
1915         (WebCore::InlineFlowBox::frameRectIncludingLineHeight const):
1916         * rendering/InlineTextBox.cpp:
1917         (WebCore::InlineTextBox::localSelectionRect const):
1918         (WebCore::InlineTextBox::paint):
1919         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
1920         (WebCore::InlineTextBox::paintMarkedTextBackground):
1921         (WebCore::InlineTextBox::paintCompositionUnderline const):
1922         * rendering/RootInlineBox.cpp:
1923         (WebCore::RootInlineBox::RootInlineBox):
1924         * rendering/RootInlineBox.h:
1925
1926 2018-07-08  Antoine Quint  <graouts@apple.com>
1927
1928         [Web Animations] A number of tests report an incorrect computed offset
1929         https://bugs.webkit.org/show_bug.cgi?id=187410
1930         <rdar://problem/41905790>
1931
1932         Reviewed by Dean Jackson.
1933
1934         While we would correctly avoid computing missing offsets when processing the first keyframe following the last
1935         keyframes with a specified offset, we were forgetting to update the index of the last keyframe with a specified
1936         offset which meant we would accidentally override a specified offset with an automically-computed one.
1937
1938         * animation/KeyframeEffectReadOnly.cpp:
1939         (WebCore::computeMissingKeyframeOffsets):
1940
1941 2018-07-08  David Kilzer  <ddkilzer@apple.com>
1942
1943         DOMMatrix.invertSelf() returns garbage values for a non-invertible matrix
1944         <https://webkit.org/b/187446>
1945         <rdar://problem/41853187>
1946
1947         Reviewed by Daniel Bates.
1948
1949         Test: http/wpt/css/geometry/DOMMatrix-invertSelf.html
1950
1951         * css/DOMMatrix.cpp:
1952         (WebCore::DOMMatrix::invertSelf): Add missing `else`, and
1953         restructure to use positive logic.
1954
1955 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1956
1957         Introduce a layout milestone to track when the document contains a large number of rendered characters
1958         https://bugs.webkit.org/show_bug.cgi?id=187412
1959         <rdar://problem/41744338>
1960
1961         Reviewed by Ryosuke Niwa.
1962
1963         Implements a new layout milestone: `DidRenderSignificantAmountOfText`. This is similar to the existing
1964         `DidFirstVisuallyNonEmptyLayout` milestone, but with a few important additional constraints:
1965
1966         • The minimum threshold of rendered characters is much larger (3000 instead of 200).
1967         • The mean length of a text node must be large (at least 50).
1968
1969         This is a (computationally) lightweight heuristic intended to estimate the likelihood that a page is capable of
1970         being presented in Reader mode. In many article-like pages, the average length of a text node is significantly
1971         longer than other types of pages; thus, on pages where the average length of a text node is very large *and*
1972         there is a large quantity of text, we can use this as a cue to opportunistically detect and enter Safari reader
1973         mode on watchOS.
1974
1975         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
1976
1977         * page/FrameView.cpp:
1978         (WebCore::FrameView::reset):
1979
1980         Clear out new state members that keep track of whether the significant rendered text milestone has been met.
1981
1982         (WebCore::elementOverflowRectIsLargerThanThreshold):
1983
1984         Factor out logic to grab the overflow height of an element into a separate helper function.
1985
1986         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
1987         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
1988
1989         Determines whether to fire this new milestone after the next layout pass is finished. The logic here is similar
1990         to the logic in qualifiesAsVisuallyNonEmpty, requiring that there are not still pending stylesheets in the head
1991         and that the document height is at least a minimum threshold. However, unlike the first visually non-empty
1992         layout, this milestone is never guaranteed to fire.
1993
1994         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1995         * page/FrameView.h:
1996         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
1997         * page/LayoutMilestones.h:
1998
1999 2018-07-06  Timothy Hatcher  <timothy@apple.com>
2000
2001         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
2002         https://bugs.webkit.org/show_bug.cgi?id=187425
2003         rdar://problem/39948240
2004
2005         Reviewed by Tim Horton.
2006
2007         Added a listener for the accessibility change notification to invalidate our color caches.
2008
2009         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
2010         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
2011         Instead, changed the functions to use the new instance version instead.
2012
2013         * page/Page.cpp:
2014         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
2015         per instance instead of on all pages (since appearance can be difference per view).
2016         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
2017         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
2018         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
2019         * page/Page.h:
2020         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
2021         * platform/mac/LocalDefaultSystemAppearance.mm:
2022         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
2023         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
2024         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
2025         * rendering/RenderThemeMac.mm:
2026         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
2027         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
2028
2029 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
2030
2031         Make ReasonForSuspension enum class
2032         https://bugs.webkit.org/show_bug.cgi?id=187405
2033
2034         Reviewed by Zalan Bujtas.
2035
2036         Made ReasonForSuspension an enum class instead of enum and moved out of ActiveDOMObject.
2037
2038         * Modules/geolocation/Geolocation.cpp:
2039         (WebCore::Geolocation::suspend):
2040         * Modules/websockets/WebSocket.cpp:
2041         (WebCore::WebSocket::suspend):
2042         * dom/ActiveDOMObject.h:
2043         * dom/Document.cpp:
2044         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2045         (WebCore::Document::suspendActiveDOMObjects):
2046         (WebCore::Document::resumeActiveDOMObjects):
2047         (WebCore::Document::suspend):
2048         (WebCore::Document::resume):
2049         (WebCore::Document::suspendScheduledTasks):
2050         (WebCore::Document::resumeScheduledTasks):
2051         * dom/Document.h:
2052         * dom/ScriptExecutionContext.cpp:
2053         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
2054         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2055         * dom/ScriptExecutionContext.h:
2056         (WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const):
2057         * history/CachedFrame.cpp:
2058         (WebCore::CachedFrameBase::restore):
2059         (WebCore::CachedFrame::CachedFrame):
2060         * html/HTMLMediaElement.cpp:
2061         (WebCore::HTMLMediaElement::suspend):
2062         * html/HTMLSourceElement.cpp:
2063         (WebCore::HTMLSourceElement::suspend):
2064         * inspector/PageScriptDebugServer.cpp:
2065         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
2066         * loader/FrameLoader.cpp:
2067         (WebCore::FrameLoader::commitProvisionalLoad):
2068         * page/Frame.cpp:
2069         (WebCore::Frame::suspendActiveDOMObjectsAndAnimations):
2070         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
2071         * page/PageGroupLoadDeferrer.cpp:
2072         (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
2073         (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
2074         * xml/XMLHttpRequest.cpp:
2075         (WebCore::XMLHttpRequest::suspend):
2076
2077 2018-07-06  Nan Wang  <n_wang@apple.com>
2078
2079         AX: add a subrole for meter elements on macOS
2080         https://bugs.webkit.org/show_bug.cgi?id=187409
2081         <rdar://problem/41905702>
2082
2083         Reviewed by Chris Fleizach.
2084
2085         Test: accessibility/mac/meter-subrole.html
2086
2087         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2088         (-[WebAccessibilityObjectWrapper subrole]):
2089
2090 2018-07-06  Jeremy Jones  <jeremyj@apple.com>
2091
2092         For <video> element, use video fullscreen instead of element fullscreen.
2093         https://bugs.webkit.org/show_bug.cgi?id=186093
2094         rdar://problem/40144751
2095
2096         Reviewed by Jer Noble.
2097
2098         Some pages use webkitRequestFullscreen directly on the video element, without any custom controls.
2099         This will prevent native fullscreeen presentation mode conrols from being used.
2100
2101         This change makes webkitRequestFullscreen on a video element call webKitSetPresentationMode.
2102
2103         * dom/Element.h:
2104         * html/HTMLVideoElement.cpp:
2105         (WebCore::HTMLVideoElement::webkitRequestFullscreen):
2106         * html/HTMLVideoElement.h:
2107
2108 2018-07-06  Youenn Fablet  <youenn@apple.com>
2109
2110         WebRTC MediaStreamTrack Enable / Disable causes video delay / lag
2111         https://bugs.webkit.org/show_bug.cgi?id=186889
2112         <rdar://problem/41370285>
2113
2114         Reviewed by Eric Carlson.
2115
2116         Libwebrtc expects a continuous flow of calls for audio data since the API
2117         does not provide any possiblity to give timestamps.
2118
2119         We were optimizing previously when a source is muted so that we would not transmit audio data.
2120         This breaks synchronization between audio and video frames (which are timestamped).
2121
2122         This patch reverts the optimization and instead makes sure to send zeros for silenced audio tracks.
2123
2124         This requires MediaStreamTrackPrivate to send audio data even if disabled,
2125         so that RealtimeOutgoingAudioSource will continue sending zeros at the correct pace.
2126         This also requires WebAudioSourceProviderAVFObjC to exit early if its track is disabled.
2127
2128         Covered by existing tests.
2129         Manual testing shows that synchronization is kept.
2130
2131         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2132         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
2133         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
2134         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
2135         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
2136         (WebCore::RealtimeOutgoingAudioSource::stop):
2137         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
2138         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
2139         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded): Deleted.
2140         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2141         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2142         (WebCore::RealtimeOutgoingAudioSource::isSilenced const):
2143         (WebCore::RealtimeOutgoingAudioSource::sendSilence): Deleted.
2144         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
2145         (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData):
2146         (WebCore::RealtimeOutgoingAudioSourceCocoa::handleMutedIfNeeded): Deleted.
2147         (WebCore::RealtimeOutgoingAudioSourceCocoa::sendSilence): Deleted.
2148         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
2149         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2150         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
2151
2152 2018-07-06  Youenn Fablet  <youenn@apple.com>
2153
2154         Make RealtimeOutgoingVideoSource use DestructionThread::Main
2155         https://bugs.webkit.org/show_bug.cgi?id=187402
2156
2157         Reviewed by Chris Dumez.
2158
2159         No change of behavior.
2160
2161         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2162
2163 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
2164
2165         Make HTMLMediaElement::remove*Track take a Ref<>&&
2166         https://bugs.webkit.org/show_bug.cgi?id=187407
2167
2168         Reviewed by Zalan Bujtas.
2169
2170         Make these functions take Ref<>&& since they can delete track objects.
2171
2172         * html/HTMLMediaElement.cpp:
2173         (WebCore::HTMLMediaElement::removeAudioTrack):
2174         (WebCore::HTMLMediaElement::removeTextTrack):
2175         (WebCore::HTMLMediaElement::removeVideoTrack):
2176         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks):
2177         * html/HTMLMediaElement.h:
2178
2179 2018-07-06  Antoine Quint  <graouts@apple.com>
2180
2181         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html pass reliably
2182         https://bugs.webkit.org/show_bug.cgi?id=186502
2183         <rdar://problem/41000229>l
2184
2185         Reviewed by Dean Jackson.
2186
2187         Ensure we only attempt to convert defined objects or we risk to throw errors in valid situations.
2188
2189         * animation/KeyframeEffectReadOnly.cpp:
2190         (WebCore::processKeyframeLikeObject):
2191
2192 2018-07-05  Antoine Quint  <graouts@apple.com>
2193
2194         [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
2195         https://bugs.webkit.org/show_bug.cgi?id=186496
2196         <rdar://problem/41000179>
2197
2198         Reviewed by Dean Jackson.
2199
2200         We used to only resolve animations that had a target element, but animations need not have a target and their
2201         current time should still advance so that their finished promise may resolve. We now maintain a list of animations
2202         without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().
2203
2204         * animation/AnimationTimeline.cpp:
2205         (WebCore::AnimationTimeline::addAnimation):
2206         (WebCore::AnimationTimeline::removeAnimation):
2207         (WebCore::AnimationTimeline::animationWasAddedToElement):
2208         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
2209         * animation/AnimationTimeline.h:
2210         (WebCore::AnimationTimeline:: const):
2211         * animation/DocumentTimeline.cpp:
2212         (WebCore::DocumentTimeline::updateAnimations):
2213         * animation/WebAnimation.cpp:
2214         (WebCore::WebAnimation::resolve):
2215         * animation/WebAnimation.h:
2216
2217 2018-07-05  Antoine Quint  <graouts@apple.com>
2218
2219         [Web Animations] Make WPT test at interfaces/Animation/finished.html pass reliably
2220         https://bugs.webkit.org/show_bug.cgi?id=186497
2221         <rdar://problem/41000193>
2222
2223         Reviewed by Dean Jackson.
2224
2225         We need to ensure the finished state is updated as a result of any timing property changing.
2226
2227         * animation/AnimationEffectReadOnly.cpp:
2228         (WebCore::AnimationEffectReadOnly::timingDidChange):
2229         * animation/WebAnimation.cpp:
2230         (WebCore::WebAnimation::effectTimingPropertiesDidChange):
2231         * animation/WebAnimation.h:
2232
2233 2018-07-06  Antoine Quint  <graouts@apple.com>
2234
2235         [Web Animations] Using a Web Animation leaks the Document
2236         https://bugs.webkit.org/show_bug.cgi?id=187088
2237         <rdar://problem/41392046>
2238
2239         Reviewed by Darin Adler.
2240
2241         Test: webanimations/leak-document-with-web-animation.html
2242
2243         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
2244         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
2245         the animation from its timeline.
2246
2247         An earlier version of this patch (r233349) was rolled out due to crashes caught in the ASan configuration. The following
2248         changes were made to make it safe:
2249
2250         - We protect the DocumentAnimationScheduler instance in displayRefreshFired() against code that might run in a
2251         requestAnimationFrame() callback that would trigger the object to be deleted.
2252
2253         - We protect the WebAnimation instance in remove() against setEffectInternal() or setTimelineInternal() potentially
2254         causing the object to be deleted. Similar protections were addede to setEffect() and setTimeline().
2255
2256         - We changed ~DocumentTimeline() to a default implementation to ensure it calls ~DisplayRefreshMonitorClient()
2257         to avoid callbacks after the object has been marked for deletion.
2258
2259
2260         * animation/AnimationTimeline.cpp:
2261         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
2262         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
2263         removeAnimation() on the disassociated timeline.
2264         * animation/DeclarativeAnimation.cpp:
2265         (WebCore::DeclarativeAnimation::remove):
2266         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
2267         * animation/DeclarativeAnimation.h:
2268         * animation/DocumentAnimationScheduler.cpp:
2269         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
2270         * animation/DocumentTimeline.cpp:
2271         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
2272         (WebCore::DocumentTimeline::~DocumentTimeline): Deleted.
2273         * animation/WebAnimation.cpp:
2274         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
2275         (WebCore::WebAnimation::setEffect):
2276         (WebCore::WebAnimation::setEffectInternal):
2277         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
2278         that we can call this code without any JS-facing implications.
2279         (WebCore::WebAnimation::setTimelineInternal):
2280         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
2281         * animation/WebAnimation.h:
2282
2283 2018-07-06  Daniel Bates  <dabates@apple.com>
2284
2285         Remove Strong Confirmation Password button
2286         https://bugs.webkit.org/show_bug.cgi?id=187306
2287         <rdar://problem/41795185>
2288
2289         Reviewed by Sam Weinig.
2290
2291         Remove support for the Strong Confirmation Password button because we never made use of it.
2292
2293         * English.lproj/Localizable.strings:
2294         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2295         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
2296         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2297         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2298         * html/HTMLInputElement.h:
2299         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const):
2300         * html/HTMLTextFormControlElement.h:
2301         * html/TextFieldInputType.cpp:
2302         (WebCore::autoFillButtonTypeToAccessibilityLabel):
2303         (WebCore::autoFillButtonTypeToAutoFillButtonText):
2304         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
2305         (WebCore::isAutoFillButtonTypeChanged):
2306         * platform/LocalizedStrings.cpp:
2307         (WebCore::AXAutoFillStrongConfirmationPasswordLabel): Deleted.
2308         * platform/LocalizedStrings.h:
2309         * rendering/RenderTextControlSingleLine.cpp:
2310         (WebCore::RenderTextControlSingleLine::layout):
2311         * testing/Internals.cpp:
2312         (WebCore::toAutoFillButtonType):
2313         (WebCore::toInternalsAutoFillButtonType):
2314         * testing/Internals.h:
2315         * testing/Internals.idl:
2316
2317 2018-07-06  Carlos Garcia Campos  <cgarcia@igalia.com>
2318
2319         [GTK][WPE] REGRESSION(r233239): proxy settings not applied after r233239
2320         https://bugs.webkit.org/show_bug.cgi?id=187381
2321
2322         Reviewed by Yusuke Suzuki.
2323
2324         This is because the static variable for proxy settings was replaced by a NeverDestroyed, but the function is not
2325         returning a reference, but a copy. This is causing several unit tests to fail.
2326
2327         * platform/network/soup/SoupNetworkSession.cpp:
2328         (WebCore::proxySettings):
2329
2330 2018-07-06  Frederic Wang  <fwang@igalia.com>
2331
2332         [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
2333         https://bugs.webkit.org/show_bug.cgi?id=187382
2334
2335         Reviewed by Carlos Garcia Campos.
2336
2337         WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
2338         uninitialized std:optional value is possible and one of them is hit when using Google drive.
2339         Since that old animation code is going to be removed soon, we just quickly patch this issue
2340         via value_or() so that we can restore the ASSERT added in bug 186536.
2341
2342         No new tests, code is going to be removed soon.
2343
2344         * page/animation/AnimationBase.cpp:
2345         (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.
2346
2347 2018-07-06  Frederic Wang  <fwang@igalia.com>
2348
2349         Rename HTMLTreeBuilder::didCreateCustomOrCallbackElement
2350         https://bugs.webkit.org/show_bug.cgi?id=187317
2351
2352         Reviewed by Ryosuke Niwa.
2353
2354         This function is called with a new custom element or the fallback HTMLUnknownElement element
2355         so we rename it didCreateCustomOrFallbackElement.
2356
2357         No new tests, behavior unchanged.
2358
2359         * html/parser/HTMLDocumentParser.cpp:
2360         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
2361         * html/parser/HTMLTreeBuilder.cpp:
2362         (WebCore::HTMLTreeBuilder::didCreateCustomOrFallbackElement):
2363         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): Deleted.
2364         * html/parser/HTMLTreeBuilder.h:
2365
2366 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
2367
2368         REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend
2369         https://bugs.webkit.org/show_bug.cgi?id=187378
2370         <rdar://problem/41878885>
2371
2372         Reviewed by Eric Carlson.
2373
2374         These assertions were wrong since inline debugger, alert, etc... can suspend active DOM objects without
2375         calling canSuspendForDocumentSuspension. Fixed the bug by removing the assertion and instead suspending
2376         and resuming the generic event queue.
2377
2378         * Modules/mediasource/MediaSource.cpp:
2379         (WebCore::MediaSource::suspend):
2380         (WebCore::MediaSource::resume):
2381         * Modules/mediasource/SourceBuffer.cpp:
2382         (WebCore::SourceBuffer::suspend):
2383         (WebCore::SourceBuffer::resume):
2384         * Modules/mediasource/SourceBufferList.cpp:
2385         (WebCore::SourceBufferList::suspend):
2386         (WebCore::SourceBufferList::resume):
2387         * html/track/TrackListBase.cpp:
2388         (WebCore::TrackListBase::suspend):
2389         (WebCore::TrackListBase::resume):
2390
2391 2018-07-05  Youenn Fablet  <youenn@apple.com>
2392
2393         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
2394         https://bugs.webkit.org/show_bug.cgi?id=187346
2395         <rdar://problem/41773974>
2396
2397         Reviewed by Ryosuke Niwa.
2398
2399         Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
2400         Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
2401
2402         Test: http/tests/plugins/plugin-allow-then-reload.html
2403
2404         * plugins/PluginData.h:
2405         * plugins/PluginInfoProvider.cpp:
2406         (WebCore::PluginInfoProvider::clearPagesPluginData):
2407         * plugins/PluginInfoProvider.h:
2408         * testing/Internals.cpp:
2409         (WebCore::Internals::pluginCount):
2410         * testing/Internals.h:
2411         * testing/Internals.idl:
2412
2413 2018-07-05  Brady Eidson  <beidson@apple.com>
2414
2415         IndexedDB operations in a Page fail after a StorageProcess crash.
2416         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
2417
2418         Reviewed by Alex Christensen.
2419
2420         Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html
2421
2422         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
2423         in the WebProcess about it.
2424         
2425         This puts Documents/Workers in an error mode where requests fail instead of timeout.
2426         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
2427         new connection that works.
2428         
2429         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2430         (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
2431         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
2432         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
2433         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
2434         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
2435         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
2436         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
2437         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
2438         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
2439         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
2440         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2441         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
2442         (WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
2443         (WebCore::IDBClient::IDBConnectionToServer::getCount):
2444         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
2445         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
2446         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
2447         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
2448         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
2449         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
2450         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
2451         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
2452         (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
2453         (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
2454         (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
2455         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
2456         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
2457         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
2458         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
2459         * Modules/indexeddb/client/IDBConnectionToServer.h:
2460
2461         * Modules/indexeddb/shared/IDBError.h:
2462         (WebCore::IDBError::serverConnectionLostError):
2463
2464         * page/Page.cpp:
2465         (WebCore::Page::setSessionID):
2466         (WebCore::Page::idbConnection):
2467         (WebCore::Page::optionalIDBConnection):
2468         (WebCore::Page::clearIDBConnection):
2469         * page/Page.h:
2470
2471 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
2472
2473         Youtube video pages crash after a couple of minutes
2474         https://bugs.webkit.org/show_bug.cgi?id=187316
2475
2476         Reviewed by Antti Koivisto.
2477
2478         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
2479         which traverses all media players across different documents including the one in the main frame while its iframe
2480         is getting removed (to update the Touch Bar's media control).
2481
2482         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
2483         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
2484         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
2485
2486         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
2487         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
2488         a timer via scheduleUpdateNowPlayingInfo instead.
2489
2490         Test: media/remove-video-best-media-element-in-main-frame-crash.html
2491
2492         * html/HTMLMediaElement.cpp:
2493         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
2494         moved to Page.
2495         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
2496         a raw pointer while we're at it.
2497         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
2498         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
2499         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
2500         (WebCore::HTMLMediaElement::contextDestroyed):
2501         (WebCore::HTMLMediaElement::stop):
2502         (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager.
2503         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired.
2504         * html/HTMLMediaElement.h:
2505         * page/Page.cpp:
2506         (WebCore::Page::Page):
2507         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
2508         (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager.
2509         * page/Page.h:
2510         * testing/Internals.cpp:
2511         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
2512         * testing/Internals.h:
2513
2514 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
2515
2516         REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient()
2517         https://bugs.webkit.org/show_bug.cgi?id=187377
2518
2519         Reviewed by Simon Fraser.
2520
2521         Clear m_client of an audio track or a video track before removing it from the list
2522         since TrackListBase::m_inbandTracks may hold the last ref to the track.
2523
2524         * html/HTMLMediaElement.cpp:
2525         (WebCore::HTMLMediaElement::removeAudioTrack):
2526         (WebCore::HTMLMediaElement::removeVideoTrack):
2527
2528 2018-07-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2529
2530         REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius
2531         https://bugs.webkit.org/show_bug.cgi?id=187336
2532
2533         Reviewed by Carlos Garcia Campos.
2534
2535         drawGlyphsShadow has a fast path to draw a shadow without a shadow
2536         layer. Since r233495, it is not used for zero blur-radius shadow.
2537
2538         In Bug 187244, I changed ShadowState::isRequired not to check
2539         blur-radius is zero. This is not a right fix.
2540
2541         This change reverts r233495.
2542
2543         No new tests (Covered by existing tests).
2544
2545         * platform/graphics/cairo/CairoOperations.cpp:
2546         (WebCore::Cairo::ShadowState::isRequired const): Return false if
2547         'blur' is zero.
2548         (WebCore::Cairo::fillRectWithRoundedHole): Use
2549         ShadowState::isVisible instead of ShadowState::isRequired to check
2550         a shadow should be drawn.
2551
2552 2018-07-05  Timothy Hatcher  <timothy@apple.com>
2553
2554         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
2555         https://bugs.webkit.org/show_bug.cgi?id=187369
2556         rdar://problem/41870420
2557
2558         Reviewed by Tim Horton.
2559
2560         * Modules/mediasession/WebMediaSessionManager.cpp:
2561         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
2562         * css/MediaQueryEvaluator.cpp:
2563         (WebCore::prefersDarkInterfaceEvaluate):
2564         * css/StyleColor.h:
2565         * dom/Document.cpp:
2566         (WebCore::Document::useDarkAppearance const):
2567         (WebCore::Document::styleColorOptions const):
2568         (WebCore::Document::useDefaultAppearance const): Deleted.
2569         * dom/Document.h:
2570         * inspector/InspectorOverlay.cpp:
2571         (WebCore::InspectorOverlay::paint):
2572         * page/Page.cpp:
2573         (WebCore::Page::useDarkAppearance const):
2574         (WebCore::Page::defaultAppearance const): Deleted.
2575         * page/Page.h:
2576         (WebCore::Page::setUseDarkAppearance):
2577         (WebCore::Page::setDefaultAppearance): Deleted.
2578         * platform/Theme.h:
2579         * platform/graphics/MediaPlaybackTargetPicker.h:
2580         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
2581         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2582         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
2583         * platform/mac/DragImageMac.mm:
2584         (WebCore::createDragImageForLink):
2585         * platform/mac/LocalDefaultSystemAppearance.h:
2586         * platform/mac/LocalDefaultSystemAppearance.mm:
2587         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2588         * platform/mac/ThemeMac.h:
2589         * platform/mac/ThemeMac.mm:
2590         (WebCore::ThemeMac::paint):
2591         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
2592         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
2593         * platform/mock/MediaPlaybackTargetPickerMock.h:
2594         * rendering/InlineTextBox.cpp:
2595         (WebCore::InlineTextBox::resolveStyleForMarkedText):
2596         * rendering/RenderLayerBacking.cpp:
2597         (WebCore::RenderLayerBacking::paintContents):
2598         * rendering/RenderLayerCompositor.cpp:
2599         (WebCore::RenderLayerCompositor::paintContents):
2600         * rendering/RenderTheme.cpp:
2601         (WebCore::RenderTheme::paint):
2602         * rendering/RenderThemeMac.mm:
2603         (WebCore::RenderThemeMac::documentViewFor const):
2604         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
2605         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
2606         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
2607         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
2608         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
2609         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
2610         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
2611         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
2612         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
2613         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
2614         (WebCore::RenderThemeMac::colorCache const):
2615         (WebCore::RenderThemeMac::systemColor const):
2616         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
2617         (WebCore::RenderThemeMac::paintSliderThumb):
2618         * svg/graphics/SVGImage.cpp:
2619         (WebCore::SVGImage::draw):
2620
2621 2018-07-05  Commit Queue  <commit-queue@webkit.org>
2622
2623         Unreviewed, rolling out r233539.
2624         https://bugs.webkit.org/show_bug.cgi?id=187368
2625
2626         Changes made for youtube crashes has caused 15 api failures
2627         (Requested by Truitt on #webkit).
2628
2629         Reverted changeset:
2630
2631         "Youtube video pages crash after a couple of minutes"
2632         https://bugs.webkit.org/show_bug.cgi?id=187316
2633         https://trac.webkit.org/changeset/233539
2634
2635 2018-07-05  Chris Dumez  <cdumez@apple.com>
2636
2637         Update Element API to use qualifiedName instead of name/localName where applicable
2638         https://bugs.webkit.org/show_bug.cgi?id=187347
2639
2640         Reviewed by Darin Adler.
2641
2642         Update Element API to use qualifiedName instead of name/localName where applicable. Naming
2643         is now consistent with the IDL and the specification:
2644         - https://dom.spec.whatwg.org/#element
2645
2646         Our implementation properly deals with qualified names already, even though the parameters
2647         were named localName.
2648
2649         * dom/Element.cpp:
2650         (WebCore::Element::getAttribute const):
2651         (WebCore::Element::toggleAttribute):
2652         (WebCore::Element::setAttribute):
2653         (WebCore::Element::removeAttribute):
2654         (WebCore::Element::getAttributeNode):
2655         (WebCore::Element::hasAttribute const):
2656         * dom/Element.h:
2657
2658 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
2659
2660         Youtube video pages crash after a couple of minutes
2661         https://bugs.webkit.org/show_bug.cgi?id=187316
2662
2663         Reviewed by Antti Koivisto.
2664
2665         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
2666         which traverses all media players across different documents including the one in the main frame while its iframe
2667         is getting removed (to update the Touch Bar's media control).
2668
2669         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
2670         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
2671         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
2672
2673         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
2674         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
2675         a timer via scheduleUpdateNowPlayingInfo instead.
2676
2677         Test: media/remove-video-best-media-element-in-main-frame-crash.html
2678
2679         * html/HTMLMediaElement.cpp:
2680         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
2681         moved to Page.
2682         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
2683         a raw pointer while we're at it.
2684         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
2685         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
2686         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
2687         (WebCore::HTMLMediaElement::contextDestroyed):
2688         (WebCore::HTMLMediaElement::stop):
2689         (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
2690         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate.
2691         * html/HTMLMediaElement.h:
2692         * page/Page.cpp:
2693         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
2694         * page/Page.h:
2695         * testing/Internals.cpp:
2696         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
2697         * testing/Internals.h:
2698
2699 2018-07-05  Zalan Bujtas  <zalan@apple.com>
2700
2701         Do not assume that hypen's width can be computed using the simplified text measure codepath.
2702         https://bugs.webkit.org/show_bug.cgi?id=187352
2703         <rdar://problem/40821283>
2704
2705         Reviewed by Simon Fraser.
2706
2707         Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
2708
2709         Test: fast/text/hyphen-is-complex-crash.html
2710
2711         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2712         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2713         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
2714         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2715
2716 2018-07-05  Eric Carlson  <eric.carlson@apple.com>
2717
2718         Video sometimes flickers when playing to AppleTV
2719         https://bugs.webkit.org/show_bug.cgi?id=187193
2720         <rdar://problem/40153865>
2721
2722         Unreviewed, fix a broken API test.
2723
2724         * platform/audio/ios/AudioSessionIOS.mm:
2725         (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, 
2726         because it signals that WebKit is not playing audio so we want allow other apps to play.
2727
2728 2018-07-05  Per Arne Vollan  <pvollan@apple.com>
2729
2730         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm
2731         https://bugs.webkit.org/show_bug.cgi?id=187334
2732
2733         Reviewed by Alex Christensen.
2734
2735         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding
2736         to use NSTimer or NSAnimation for scrollbar animation.
2737
2738         No new tests. No change in behavior.
2739
2740         * platform/mac/ScrollAnimatorMac.mm:
2741         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
2742         (-[WebScrollbarPartAnimation startAnimation]):
2743         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
2744
2745 2018-07-05  Timothy Hatcher  <timothy@apple.com>
2746
2747         Don't invert text color for selections in light mode.
2748         https://bugs.webkit.org/show_bug.cgi?id=187349
2749         rdar://problem/41297946
2750
2751         Reviewed by Tim Horton.
2752
2753         Fix color caching in RenderTheme so we don't cache a dark mode color
2754         for a light appearance, or vise versa. Use the new color caching
2755         in RenderThemeMac, and clear the color caches in purgeCaches.
2756
2757         Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options.
2758         Return true only in dark mode.
2759
2760         * rendering/RenderTheme.cpp:
2761         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
2762         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
2763         (WebCore::RenderTheme::activeSelectionForegroundColor const):
2764         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
2765         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
2766         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
2767         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
2768         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
2769         (WebCore::RenderTheme::purgeCaches):
2770         (WebCore::RenderTheme::platformColorsDidChange):
2771         (WebCore::RenderTheme::activeTextSearchHighlightColor const):
2772         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const):
2773         * rendering/RenderTheme.h:
2774         (WebCore::RenderTheme::supportsSelectionForegroundColors const):
2775         (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const):
2776         (WebCore::RenderTheme::colorCache const):
2777         (WebCore::RenderTheme::purgeCaches): Deleted.
2778         * rendering/RenderThemeMac.h:
2779         * rendering/RenderThemeMac.mm:
2780         (WebCore::RenderThemeMac::purgeCaches):
2781         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
2782         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
2783         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
2784         (WebCore::RenderThemeMac::platformColorsDidChange):
2785         (WebCore::RenderThemeMac::colorCache const):
2786         (WebCore::RenderThemeMac::systemColor const):
2787
2788 2018-07-05  Zalan Bujtas  <zalan@apple.com>
2789
2790         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
2791         https://bugs.webkit.org/show_bug.cgi?id=186709
2792         <rdar://problem/41173793>
2793
2794         Reviewed by Simon Fraser.
2795
2796         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
2797
2798         Not testable.
2799
2800         * rendering/SimpleLineLayoutFlowContents.h:
2801
2802 2018-07-05  Nan Wang  <n_wang@apple.com>
2803
2804         AX: setValue on text controls should send out key events
2805         https://bugs.webkit.org/show_bug.cgi?id=186690
2806         <rdar://problem/41169985>
2807
2808         Reviewed by Chris Fleizach.
2809
2810         Use Editor's insertText function when the text control element is being
2811         focused, so that the InputEvent will be dispatched properly.
2812
2813         Test: accessibility/mac/set-value-editable-dispatch-events.html
2814
2815         * accessibility/AccessibilityRenderObject.cpp:
2816         (WebCore::AccessibilityRenderObject::setValue):
2817
2818 2018-07-05  Chris Dumez  <cdumez@apple.com>
2819
2820         ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails
2821         https://bugs.webkit.org/show_bug.cgi?id=187152
2822
2823         Reviewed by Brent Fulgham.
2824
2825         Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it
2826         appends an item to m_dictionaryStack which is expected to get popped later on via
2827         a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1)
2828         assertion in the destructor protects against a begin / end mismatch.
2829
2830         However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early
2831         after a call to beginArrayElement() when the lambda function call returns false, causing us
2832         not to call the matching endArrayElement() in this case. This patch addresses the issue by
2833         calling endArrayElement() before returning early.
2834
2835         This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format.
2836         Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old
2837         data fails and we hit the buggy code path.
2838
2839         * platform/KeyedCoding.h:
2840         (WebCore::KeyedDecoder::decodeObjects):
2841
2842 2018-07-05  Antti Koivisto  <antti@apple.com>
2843
2844         Move CSSParserContext to a file of its own
2845         https://bugs.webkit.org/show_bug.cgi?id=187342
2846
2847         Reviewed by Zalan Bujtas.
2848
2849         Move it out from CSSParserMode.h and CSSParser.cpp.
2850
2851         * Sources.txt:
2852         * WebCore.xcodeproj/project.pbxproj:
2853         * contentextensions/ContentExtensionParser.cpp:
2854         * css/PropertySetCSSStyleDeclaration.h:
2855         * css/StyleProperties.h:
2856         * css/StyleSheetContents.h:
2857         * css/parser/CSSDeferredParser.h:
2858         * css/parser/CSSParser.cpp:
2859         (WebCore::strictCSSParserContext): Deleted.
2860         (WebCore::CSSParserContext::CSSParserContext): Deleted.
2861         (WebCore::operator==): Deleted.
2862         * css/parser/CSSParser.h:
2863         * css/parser/CSSParserContext.cpp: Added.
2864         (WebCore::strictCSSParserContext):
2865         (WebCore::CSSParserContext::CSSParserContext):
2866         (WebCore::operator==):
2867
2868         Also add the missing textAutosizingEnabled bit.
2869
2870         * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h.
2871         (WebCore::CSSParserContextHash::hash):
2872
2873         Also add the missing bits to the hash function.
2874         
2875         (WebCore::isQuirksModeBehavior): Deleted.
2876         (WebCore::isUASheetBehavior): Deleted.
2877         (WebCore::isUnitLessValueParsingEnabledForMode): Deleted.
2878         (WebCore::isCSSViewportParsingEnabledForMode): Deleted.
2879         (WebCore::strictToCSSParserMode): Deleted.
2880         (WebCore::isStrictParserMode): Deleted.
2881         * css/parser/CSSParserIdioms.h:
2882         * css/parser/CSSParserImpl.h:
2883         * css/parser/CSSParserMode.h:
2884         (WebCore::CSSParserContext::completeURL const): Deleted.
2885         (WebCore::operator!=): Deleted.
2886         (WebCore::CSSParserContextHash::hash): Deleted.
2887         (WebCore::CSSParserContextHash::equal): Deleted.
2888         (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted.
2889         (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted.
2890         (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted.
2891         * css/parser/CSSPropertyParserHelpers.h:
2892         * css/parser/CSSSelectorParser.cpp:
2893         * css/parser/CSSVariableParser.cpp:
2894
2895 2018-07-05  Antoine Quint  <graouts@apple.com>
2896
2897         [Web Animations] The ready promise should initially be resolved
2898         https://bugs.webkit.org/show_bug.cgi?id=187341
2899         <rdar://problem/41844711>
2900
2901         Reviewed by Dean Jackson.
2902
2903         The Web Animations spec mandates that the ready promise is initially resolved.
2904
2905         * animation/WebAnimation.cpp:
2906         (WebCore::WebAnimation::WebAnimation):
2907
2908 2018-07-05  Sergio Villar Senin  <svillar@igalia.com>
2909
2910         [WebVR] Fix VRDisplayEvent implementation
2911         https://bugs.webkit.org/show_bug.cgi?id=187337
2912
2913         Reviewed by Žan Doberšek.
2914
2915         VRDisplayEvent implementation had two issues. First there were no attributes storing the
2916         VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
2917         should be handled via an optional.
2918
2919         * Modules/webvr/VRDisplayEvent.cpp:
2920         (WebCore::VRDisplayEvent::VRDisplayEvent):
2921         (WebCore::VRDisplayEvent::display const): Deleted.
2922         (WebCore::VRDisplayEvent::reason const): Deleted.
2923         * Modules/webvr/VRDisplayEvent.h:
2924
2925 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2926
2927         REGRESSION(r233325): [GTK] Broke 40 animations tests
2928         https://bugs.webkit.org/show_bug.cgi?id=187264
2929
2930         Reviewed by Žan Doberšek.
2931
2932         This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when
2933         accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default.
2934
2935         * PlatformGTK.cmake: Add new file to compilation.
2936         * platform/graphics/DisplayRefreshMonitor.cpp:
2937         (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK.
2938         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added.
2939         (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk):
2940         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
2941         (WebCore::onFrameClockUpdate):
2942         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback):
2943         (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
2944         * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added.
2945         (WebCore::DisplayRefreshMonitorGtk::create):
2946
2947 2018-07-04  Antti Koivisto  <antti@apple.com>
2948
2949         Reparse user stylesheets when _useSystemAppearance changes
2950         https://bugs.webkit.org/show_bug.cgi?id=187312
2951         <rdar://problem/38565834>
2952
2953         Reviewed by Tim Horton.
2954
2955         This setting may affect user stylesheet parsing. Reparse if it changes.
2956
2957         Test: fast/media/use-system-appearance-user-stylesheet-parsing.html
2958
2959         * page/Page.cpp:
2960         (WebCore::Page::setUseSystemAppearance):
2961         * page/Page.h:
2962         (WebCore::Page::setUseSystemAppearance): Deleted.
2963         * testing/Internals.cpp:
2964         (WebCore::Internals::setUseSystemAppearance):
2965         * testing/Internals.h:
2966         * testing/Internals.idl:
2967
2968 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
2969
2970         RealtimeIncomingVideoSources: Call stop() directly in the destructor
2971         https://bugs.webkit.org/show_bug.cgi?id=187303
2972
2973         Reviewed by Youenn Fablet.
2974
2975         Avoiding to call stopProducingData when we are not actually producing data.
2976
2977         This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged.
2978
2979         * platform/mediastream/RealtimeIncomingVideoSource.h:
2980         (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource):
2981
2982 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
2983
2984         [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource
2985         https://bugs.webkit.org/show_bug.cgi?id=187304
2986
2987         Reviewed by Philippe Normand.
2988
2989         We let parsebin build the StreamCollection for us and pass extra metadata through the
2990         `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the
2991         MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason.
2992
2993         MediaStream layout tests already test that code path.
2994
2995         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2996         (WebCore::webkitMediaStreamSrcPadProbeCb):
2997
2998 2018-07-04  Frederic Wang  <fwang@igalia.com>
2999
3000         [WebIDL] Remove custom bindings for HTMLDocument
3001         https://bugs.webkit.org/show_bug.cgi?id=173444
3002
3003         Unreviewed, add missing bugzilla link for FIXME comments.
3004
3005         * dom/Document.cpp:
3006         (WebCore::Document::closeForBindings):
3007         (WebCore::Document::write):
3008         (WebCore::Document::writeln):
3009
3010 2018-07-04  Tim Horton  <timothy_horton@apple.com>
3011
3012         Introduce PLATFORM(IOSMAC)
3013         https://bugs.webkit.org/show_bug.cgi?id=187315
3014
3015         Reviewed by Dan Bernstein.
3016
3017         * Configurations/Base.xcconfig:
3018         * Configurations/FeatureDefines.xcconfig:
3019         * Configurations/WebCore.xcconfig:
3020         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
3021         (WebCore::GeolocationPosition::GeolocationPosition):
3022         * page/cocoa/MemoryReleaseCocoa.mm:
3023         (WebCore::platformReleaseMemory):
3024         * platform/audio/ios/AudioSessionIOS.mm:
3025         (WebCore::AudioSession::setCategory):
3026         (WebCore::AudioSession::routingContextUID const):
3027         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3028         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
3029         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
3030         * platform/ios/PlatformPasteboardIOS.mm:
3031         (WebCore::registerItemToPasteboard):
3032         * platform/ios/WebItemProviderPasteboard.mm:
3033         (-[WebItemProviderRegistrationInfoList itemProvider]):
3034
3035 2018-07-03  Antoine Quint  <graouts@apple.com>
3036
3037         [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably
3038         https://bugs.webkit.org/show_bug.cgi?id=186508
3039         <rdar://problem/41000260>
3040
3041         Reviewed by Dean Jackson.
3042
3043         The remaining failing assertion in this test assumes that the ready promise for an animation is fired
3044         prior to requestAnimationFrame callbacks being fired in the current event loop such that registering
3045         the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline
3046         time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending
3047         tasks, which will resolve the ready promise for any play-pending animations.
3048
3049         * animation/DocumentTimeline.cpp:
3050         (WebCore::DocumentTimeline::updateAnimations):
3051
3052 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
3053
3054         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
3055         https://bugs.webkit.org/show_bug.cgi?id=187284
3056
3057         Reviewed by Eric Carlson.
3058
3059         The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document,
3060         which does not have a valid script execution context because some uses of GenericEventQueue in media code
3061         was not closing the queue upon stopping of all active DOM objects.
3062
3063         Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects.
3064         Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList)
3065         inherit from ActiveDOMObject instead of ContextDestructionObserver to do this.
3066
3067         Also fixed a bug that media elements inside a template element (and other cases where the document doesn't
3068         have a browsing context) were scheduling events since this would hit the newly added debug assertion in
3069         GenericEventQueue::dispatchOneEvent.
3070
3071         Test: media/track/video-track-addition-and-frame-removal.html
3072
3073         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3074         (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has
3075         this object alive since canSuspendForDocumentSuspension always returns false.
3076         (WebCore::WebKitMediaKeySession::resume): Ditto.
3077         (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash.
3078         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
3079         * Modules/mediasource/MediaSource.cpp:
3080         (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM
3081         objects are stopped since this MediaSource and the related media objects are about to be destructed.
3082         (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension
3083         returns false whenever the queue is not empty.
3084         (WebCore::MediaSource::resume): Ditto.
3085         * Modules/mediasource/MediaSource.h:
3086         * Modules/mediasource/SourceBuffer.cpp:
3087         (WebCore::SourceBuffer::suspend): Ditto.
3088         (WebCore::SourceBuffer::resume): Ditto.
3089         (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash.
3090         * Modules/mediasource/SourceBuffer.h:
3091         * Modules/mediasource/SourceBufferList.cpp:
3092         (WebCore::SourceBufferList): Made this an active DOM object.
3093         (WebCore::SourceBufferList::SourceBufferList):
3094         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are
3095         pending events to match other media code.
3096         (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here.
3097         (WebCore::SourceBufferList::resume): Ditto.
3098         (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash.
3099         (WebCore::SourceBufferList::activeDOMObjectName const): Added.
3100         * Modules/mediasource/SourceBufferList.h:
3101         (WebCore::SourceBufferList): Made this an active DOM object.
3102         * Modules/mediasource/SourceBufferList.idl:
3103         * dom/Document.h:
3104         (WebCore::Document::hasBrowsingContext const): Added.
3105         * dom/GenericEventQueue.cpp:
3106         (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched
3107         inside a stopped document, which is never correct and causes this crash down the line.
3108         * html/HTMLMediaElement.cpp:
3109         (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context;
3110         e.g. when the media element is inside a template element.
3111         (WebCore::HTMLMediaElement::pauseInternal): Ditto.
3112         (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
3113         * html/track/AudioTrackList.cpp:
3114         (AudioTrackList::activeDOMObjectName const): Added.
3115         * html/track/AudioTrackList.h:
3116         * html/track/AudioTrackList.idl:
3117         * html/track/TextTrackList.cpp::
3118         (TextTrackList::activeDOMObjectName const): Added.
3119         * html/track/TextTrackList.h:
3120         * html/track/TextTrackList.idl:
3121         * html/track/TrackListBase.cpp:
3122         (WebCore::TrackListBase): Made this an active DOM object.
3123         (WebCore::TrackListBase::TrackListBase): 
3124         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events
3125         to match other media code.
3126         (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here.
3127         (WebCore::TrackListBase::resume): Ditto.
3128         (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash.
3129         * html/track/TrackListBase.h:
3130         * html/track/VideoTrackList.cpp:
3131         (VideoTrackList::activeDOMObjectName const): Added.
3132         * html/track/VideoTrackList.h:
3133         * html/track/VideoTrackList.idl:
3134
3135 2018-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
3136
3137         [cairo] Doesn't paint box-shadow with zero blur-radius
3138         https://bugs.webkit.org/show_bug.cgi?id=187244
3139
3140         Reviewed by Žan Doberšek.
3141
3142         Cairo::ShadowState::isRequired() returned false if blur-radius is
3143         zero.
3144
3145         No new tests (Covered by existing tests).
3146
3147         * platform/graphics/cairo/CairoOperations.cpp:
3148         (WebCore::Cairo::ShadowState::isRequired const): Do not check blur
3149         is zero.
3150
3151 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
3152
3153         Add a release assert to diagnose infinite recursions in removeAllEventListeners()
3154         https://bugs.webkit.org/show_bug.cgi?id=187287
3155
3156         Reviewed by Keith Miller.
3157
3158         Assert that we never re-enter removeAllEventListeners per thread.
3159
3160         * dom/EventTarget.cpp:
3161         (WebCore::EventTarget::removeAllEventListeners):
3162         * platform/ThreadGlobalData.h:
3163         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
3164         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
3165
3166 2018-07-03  Chris Dumez  <cdumez@apple.com>
3167
3168         performance-api/performance-observer-no-document-leak.html is flaky
3169         https://bugs.webkit.org/show_bug.cgi?id=186938
3170         <rdar://problem/41379336>
3171
3172         Reviewed by Simon Fraser.
3173
3174         Add internals API to get the identifier of a document and to ask if the document with
3175         a given identifier is still alive. This is helpful to write tests for document leaking
3176         fixes.
3177
3178         * testing/Internals.cpp:
3179         (WebCore::Internals::documentIdentifier const):
3180         (WebCore::Internals::isDocumentAlive const):
3181         * testing/Internals.h:
3182         * testing/Internals.idl:
3183
3184 2018-07-03  Chris Dumez  <cdumez@apple.com>
3185
3186         Improve window.event compliance: Should not be set when target is in shadow tree
3187         https://bugs.webkit.org/show_bug.cgi?id=186266
3188
3189         Reviewed by Ryosuke Niwa.
3190
3191         Stop exposing window.event to Shadow DOM by not setting window.event if the event's target
3192         is a Node inside a shadow tree. This is as per the latest DOM specification:
3193         - https://github.com/whatwg/dom/pull/407
3194
3195         This aligns our behavior with Blink as well:
3196         - https://bugs.chromium.org/p/chromium/issues/detail?id=779461
3197
3198         Tests: imported/w3c/web-platform-tests/dom/events/event-global.html
3199                imported/w3c/web-platform-tests/dom/events/event-global.worker.html
3200
3201         * bindings/js/JSEventListener.cpp:
3202         (WebCore::JSEventListener::handleEvent):
3203
3204 2018-07-03  Chris Dumez  <cdumez@apple.com>
3205
3206         [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
3207         https://bugs.webkit.org/show_bug.cgi?id=187270
3208         <rdar://problem/40674034>
3209
3210         Reviewed by Geoffrey Garen.
3211
3212         Disable vnode guard related simulated crashes for WebSQL by setting the expected
3213         environment variable, if not already set by WKTR / DRT.
3214
3215         * Modules/webdatabase/DatabaseManager.cpp:
3216         (WebCore::DatabaseManager::initialize):
3217         (WebCore::DatabaseManager::platformInitialize):
3218         * Modules/webdatabase/DatabaseManager.h:
3219         * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
3220         (WebCore::DatabaseManager::paltformInitialize):
3221         * SourcesCocoa.txt:
3222         * WebCore.xcodeproj/project.pbxproj:
3223         * platform/FileSystem.h:
3224         * platform/posix/FileSystemPOSIX.cpp:
3225         (WebCore::FileSystem::realPath):
3226         * platform/win/FileSystemWin.cpp:
3227         (WebCore::FileSystem::realPath):
3228
3229 2018-07-03  Eric Carlson  <eric.carlson@apple.com>
3230
3231         Don't allow autoplay when the element is suspended
3232         https://bugs.webkit.org/show_bug.cgi?id=187299
3233         <rdar://problem/41044691>
3234
3235         Reviewed by Youenn Fablet.
3236         
3237         Block autoplay when a media element is suspended. Add more release logging to the methods
3238         that handle autoplay attempts to help diagnose future media playback problems.
3239
3240         * html/HTMLMediaElement.cpp:
3241         (WebCore::convertEnumerationToString): Convert PlaybackWithoutUserGesture to a string.
3242         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): Add logging.
3243         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): Ditto.
3244         (WebCore::HTMLMediaElement::handleAutoplayEvent): Ditto.
3245         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Ditto.
3246         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Ditto.
3247         * html/HTMLMediaElement.h:
3248         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
3249
3250         * html/MediaElementSession.cpp:
3251         (WebCore::MediaElementSession::playbackPermitted const): Playback is not permitted when the
3252         element is suspended.
3253         * html/MediaElementSession.h:
3254
3255 2018-07-03  Zalan Bujtas  <zalan@apple.com>
3256
3257         [LFC] Generate anonymous inline box for text content.
3258         https://bugs.webkit.org/show_bug.cgi?id=187301
3259
3260         Reviewed by Antti Koivisto.
3261
3262         Always have a inline container for text content (and no dedicated text renderer).
3263
3264         * layout/layouttree/LayoutInlineBox.cpp:
3265         (WebCore::Layout::InlineBox::InlineBox):
3266         * layout/layouttree/LayoutInlineBox.h:
3267         (WebCore::Layout::InlineBox::setContent):
3268         * layout/layouttree/LayoutTreeBuilder.cpp:
3269         (WebCore::Layout::TreeBuilder::createSubTree):
3270
3271 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3272
3273         [Curl] Embed certificate information into ResourceResponse.
3274         https://bugs.webkit.org/show_bug.cgi?id=187102
3275
3276         Reviewed by Youenn Fablet.
3277
3278         No new tests but tested internally.
3279
3280         Collect certificate information from the communication and put them into
3281         ResourceResponse for the sake of advanced security checking and information
3282         providing to the user.
3283
3284         * platform/Curl.cmake:
3285         * platform/network/curl/CertificateInfo.cpp: Copied from Source/WebCore/platform/network/curl/CertificateInfo.h.
3286         (WebCore::CertificateInfo::CertificateInfo):
3287         (WebCore::CertificateInfo::isolatedCopy const):
3288         (WebCore::CertificateInfo::makeCertificate):
3289         * platform/network/curl/CertificateInfo.h:
3290         (WebCore::CertificateInfo::verificationError const):
3291         (WebCore::CertificateInfo::certificateChain const):
3292         (WebCore::operator==):
3293         (WebCore::CertificateInfo::CertificateInfo): Deleted.
3294         * platform/network/curl/CurlRequest.cpp:
3295         (WebCore::CurlRequest::didReceiveHeader):
3296         (WebCore::CurlRequest::didCompleteTransfer):
3297         * platform/network/curl/CurlRequest.h:
3298         (WebCore::CurlRequest::getCertificateInfo const):
3299         (WebCore::CurlRequest::getNetworkLoadMetrics const):
3300         (WebCore::CurlRequest::getNetworkLoadMetrics): Deleted.
3301         * platform/network/curl/CurlResourceHandleDelegate.cpp:
3302         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
3303         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
3304         * platform/network/curl/CurlSSLHandle.cpp:
3305         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
3306         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
3307         * platform/network/curl/CurlSSLHandle.h:
3308         * platform/network/curl/CurlSSLVerifier.cpp:
3309         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
3310         (WebCore::CurlSSLVerifier::verifyCallback):
3311         (WebCore::StackOfX509::StackOfX509): For RAII. Used in pemDataFromCtx().
3312         (WebCore::StackOfX509::~StackOfX509): Ditto.
3313         (WebCore::StackOfX509::count): Ditto.
3314         (WebCore::StackOfX509::item): Ditto.
3315         (WebCore::BIOHolder::BIOHolder): Ditto.
3316         (WebCore::BIOHolder::~BIOHolder): Ditto.
3317         (WebCore::BIOHolder::write): Ditto.
3318         (WebCore::BIOHolder::asCertificate): Ditto.
3319         (WebCore::pemDataFromCtx): Become simple static function.
3320         (WebCore::convertToSSLCertificateFlags): Ditto.
3321         (WebCore::CurlSSLVerifier::certVerifyCallback): Deleted.
3322         (WebCore::CurlSSLVerifier::getPemDataFromCtx): Deleted.
3323         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags): Deleted.
3324         * platform/network/curl/CurlSSLVerifier.h:
3325         (WebCore::CurlSSLVerifier::verificationError):
3326         (WebCore::CurlSSLVerifier::certificateChain const):
3327         * platform/network/curl/ResourceError.h:
3328         * platform/network/curl/ResourceErrorCurl.cpp:
3329         (WebCore::ResourceError::isSSLConnectError const):
3330         (WebCore::ResourceError::isSSLCertVerificationError const):
3331         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
3332         * platform/network/curl/ResourceResponse.h:
3333         * platform/network/curl/ResourceResponseCurl.cpp:
3334         (WebCore::ResourceResponse::setCertificateInfo):
3335         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
3336
3337 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
3338
3339         Clean up the layer volatility code and logging
3340         https://bugs.webkit.org/show_bug.cgi?id=187286
3341
3342         Reviewed by Tim Horton.
3343
3344         Export a function.
3345
3346         * platform/graphics/cocoa/IOSurface.h:
3347
3348 2018-07-03  Commit Queue  <commit-queue@webkit.org>
3349
3350         Unreviewed, rolling out r233112.
3351         https://bugs.webkit.org/show_bug.cgi?id=187300
3352
3353         this revision is causing crashes on iOS 11 simulator
3354         (Requested by Truitt on #webkit).
3355
3356         Reverted changeset:
3357
3358         "[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit
3359         fullscreen handler after r231924"
3360         https://bugs.webkit.org/show_bug.cgi?id=186945
3361         https://trac.webkit.org/changeset/233112
3362
3363 2018-07-03  Chris Dumez  <cdumez@apple.com>
3364
3365         Implement support for Element.toggleAttribute
3366         https://bugs.webkit.org/show_bug.cgi?id=186883
3367
3368         Reviewed by Sam Weinig.
3369
3370         Implement support for Element.toggleAttribute as per:
3371         - https://github.com/whatwg/dom/issues/461
3372         - https://dom.spec.whatwg.org/#dom-element-toggleattribute
3373
3374         This was already implemented in Blink:
3375         - https://bugs.chromium.org/p/chromium/issues/detail?id=854960
3376
3377         Edge expressed public support:
3378         - https://github.com/whatwg/dom/issues/461#issuecomment-398206390
3379
3380         Gecko is working on it:
3381         - https://bugzilla.mozilla.org/show_bug.cgi?id=1469592
3382
3383         * dom/Element.cpp:
3384         (WebCore::Element::toggleAttribute):
3385         * dom/Element.h:
3386         * dom/Element.idl:
3387
3388 2018-07-03  Zalan Bujtas  <zalan@apple.com>
3389
3390         [LFC] Implement minimum/maximum content width logic.
3391         https://bugs.webkit.org/show_bug.cgi?id=187241
3392
3393         Reviewed by Antti Koivisto.
3394
3395         Compute the minimum/maximum content width if needed and cache the values on the formatting state.
3396
3397         * layout/FormattingContext.cpp:
3398         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
3399         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3400         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3401         * layout/FormattingContext.h:
3402         * layout/FormattingContextGeometry.cpp:
3403         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3404         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3405         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3406         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
3407         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
3408         (WebCore::Layout::shrinkToFitWidth): Deleted.
3409         * layout/FormattingState.cpp:
3410         (WebCore::Layout::FormattingState::FormattingState):
3411         * layout/FormattingState.h:
3412         (WebCore::Layout::FormattingState::setMinimumMaximumContentWidth):
3413         (WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth):
3414         (WebCore::Layout::FormattingState::minimumMaximumContentWidth const):
3415         * layout/LayoutContext.cpp:
3416         (WebCore::Layout::LayoutContext::establishedFormattingState):
3417         * layout/LayoutContext.h:
3418         * layout/Verification.cpp:
3419         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
3420         * layout/blockformatting/BlockFormattingContext.cpp:
3421         (WebCore::Layout::BlockFormattingContext::createFormattingState const):