Update CSSFontSelector's matching algorithm to understand ranges
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-04  Myles C. Maxfield  <mmaxfield@apple.com>
2
3         Update CSSFontSelector's matching algorithm to understand ranges
4         https://bugs.webkit.org/show_bug.cgi?id=168892
5
6         Reviewed by Jon Lee.
7
8         This patch migrates the font selection algorithm out of FontCacheCoreText and into its own file which can be shared
9         among all ports. It then migrates our web font selection algorithm to use it.
10
11         This patch doesn't actually change the parsing rules; it just changes the internal machinery for how fonts get
12         selected. Therefore, this patch simply makes zero-length ranges from the discrete values the parser emits, and passes
13         those zero-length ranges to the range-based font selection routine. This means that this patch doesn't actually
14         change the results of the font selection algorithm.
15
16         One of the inputs to the new font selection algorithm is font-stretch, which previously was not parsed inside
17         @font-face blocks or the CSS Font Loading API. This patch therefore adds parsing support and modifies the existing
18         tests for these pieces to expect parsing to work. Because the font selection algorithm itself is shared between
19         installed fonts and webfonts, this patch doesn't add any additional tests for it (because it is already covered under
20         existing tests).
21
22         No new tests because there is no behavior change.
23
24         * CMakeLists.txt:
25         * WebCore.xcodeproj/project.pbxproj: Add new file for the font selection algorithm.
26         * css/CSSFontFace.cpp:
27         (WebCore::CSSFontFace::calculateStretch): Used on @font-face blocks and the CSS Font Loading API.
28         (WebCore::CSSFontFace::setStretch): Fill out the previously stubbed function.
29         * css/CSSFontFace.h: Add the range member variable to CSSFontFaces.
30         * css/CSSFontFaceSet.cpp:
31         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): Now that we care about font-stretch, we need to
32         look it up for local fonts too. This current approach of an extra FontSelectionValue hanging around with a
33         FontTraitsMask is very ugly and will be removed soon (https://bugs.webkit.org/show_bug.cgi?id=168889 and
34         https://bugs.webkit.org/show_bug.cgi?id=168890).
35         (WebCore::computeFontStretch): Used on @font-face blocks and the CSS Font Loading API.
36         (WebCore::CSSFontFaceSet::matchingFaces): Educate about font-stretch.
37         (WebCore::CSSFontFaceSet::fontFace): Migrate to the new font-selection algorithm.
38         (WebCore::fontFaceComparator): Deleted.
39         * css/CSSFontFaceSet.h:
40         * css/CSSFontSelector.cpp:
41         (WebCore::CSSFontSelector::addFontFaceRule): Educate about font-stretch.
42         (WebCore::CSSFontSelector::fontRangesForFamily): Ditto.
43         * css/FontFace.cpp:
44         (WebCore::FontFace::setStretch): Ditto.
45         (WebCore::FontFace::stretch): Ditto.
46         * css/parser/CSSPropertyParser.cpp:
47         (WebCore::CSSPropertyParser::parseFontFaceDescriptor): Ditto.
48         * platform/graphics/FontCache.h: Ditto.
49         * platform/graphics/FontDescription.h:
50         * platform/graphics/FontSelectionAlgorithm.cpp: Added.
51         (WebCore::FontSelectionAlgorithm::filterCapability):
52         (WebCore::FontSelectionAlgorithm::indexOfBestCapabilities):
53         (WebCore::fontSelectionRequestForTraitsMask):
54         (WebCore::initialFontSelectionCapabilitiesForTraitsMask):
55         (WebCore::fontSelectionCapabilitiesForTraitsMask):
56         * platform/graphics/FontSelectionAlgorithm.h: Added. Taken from FontCacheCoreText.cpp.
57         (WebCore::FontSelectionValue::FontSelectionValue):
58         (WebCore::FontSelectionValue::operator float):
59         (WebCore::FontSelectionValue::rawValue):
60         (WebCore::FontSelectionValue::maximumValue):
61         (WebCore::FontSelectionValue::minimumValue):
62         (WebCore::FontSelectionValue::operator+):
63         (WebCore::FontSelectionValue::operator-):
64         (WebCore::FontSelectionValue::operator*):
65         (WebCore::FontSelectionValue::operator/):
66         (WebCore::FontSelectionValue::operator==):
67         (WebCore::FontSelectionValue::operator!=):
68         (WebCore::FontSelectionValue::operator<):
69         (WebCore::FontSelectionValue::operator<=):
70         (WebCore::FontSelectionValue::operator>):
71         (WebCore::FontSelectionValue::operator>=):
72         (WebCore::FontSelectionRange::isValid):
73         (WebCore::FontSelectionRange::expand):
74         (WebCore::FontSelectionRange::includes):
75         (WebCore::FontSelectionRequest::operator==):
76         (WebCore::FontSelectionRequest::operator!=):
77         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey):
78         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue):
79         (WebCore::FontSelectionRequestKey::operator==):
80         (WebCore::FontSelectionRequestKeyHash::hash):
81         (WebCore::FontSelectionRequestKeyHash::equal):
82         (WebCore::FontSelectionCapabilities::expand):
83         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm):
84         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
85         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilities):
86         * platform/graphics/cocoa/FontCacheCoreText.cpp: Moved to FontSelectionAlgorithm.
87         (WebCore::stretchFromCoreTextTraits):
88         (WebCore::FontDatabase::capabilitiesForFontDescriptor):
89         (WebCore::findClosestFont):
90         (WebCore::calculateFontSelectionRequest):
91         (WebCore::platformFontLookupWithFamily):
92         (WebCore::FontCache::getTraitsInFamily): Deleted.
93         (WebCore::iterateActiveFontsWithReturn): Deleted.
94         (WebCore::iterateActiveFonts): Deleted.
95         (WebCore::findClosestStretch): Deleted.
96         (WebCore::filterStretch): Deleted.
97         (WebCore::findClosestStyle): Deleted.
98         (WebCore::filterStyle): Deleted.
99         (WebCore::findClosestWeight): Deleted.
100         (WebCore::filterWeight): Deleted.
101         (WebCore::computeTargetWeight): Deleted.
102         * platform/text/TextFlags.h: Moved to FontSelectionAlgorithm.
103         (WebCore::FontSelectionValue::FontSelectionValue): Deleted.
104         (WebCore::FontSelectionValue::operator float): Deleted.
105         (WebCore::FontSelectionValue::operator+): Deleted.
106         (WebCore::FontSelectionValue::operator-): Deleted.
107         (WebCore::FontSelectionValue::operator*): Deleted.
108         (WebCore::FontSelectionValue::operator/): Deleted.
109         (WebCore::FontSelectionValue::operator==): Deleted.
110         (WebCore::FontSelectionValue::operator!=): Deleted.
111         (WebCore::FontSelectionValue::operator<): Deleted.
112         (WebCore::FontSelectionValue::operator<=): Deleted.
113         (WebCore::FontSelectionValue::operator>): Deleted.
114         (WebCore::FontSelectionValue::operator>=): Deleted.
115         (WebCore::FontSelectionValue::rawValue): Deleted.
116         (WebCore::FontSelectionValue::maximumValue): Deleted.
117         (WebCore::FontSelectionValue::minimumValue): Deleted.
118         (WebCore::FontSelectionRange::isValid): Deleted.
119         (WebCore::FontSelectionRange::expand): Deleted.
120         (WebCore::FontSelectionRange::includes): Deleted.
121         (WebCore::FontSelectionCapabilities::expand): Deleted.
122
123 2017-03-05  Simon Fraser  <simon.fraser@apple.com>
124
125         Make some RenderLayer tree traversal in RenderLayerBacking more generic
126         https://bugs.webkit.org/show_bug.cgi?id=169177
127
128         Reviewed by Zalan Bujtas.
129
130         The real goal of this patch is reduce the number of callers of
131         RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that,
132         have the setContentsVisible() logic (which is really just about the CSS 'visibility' property)
133         do its own tree traversal which just consults layer.hasVisibleContent(). So
134         make descendantLayerPaintsIntoAncestor() a generic traversal function which walks
135         descendant layers which may paint into the target layer. The "Visible" in the name
136         reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant().
137
138         * rendering/RenderLayerBacking.cpp:
139         (WebCore::RenderLayerBacking::updateAfterDescendants):
140         (WebCore::traverseVisibleNonCompositedDescendantLayers):
141         (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
142         (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
143         (WebCore::descendantLayerPaintsIntoAncestor): Deleted.
144         * rendering/RenderLayerBacking.h:
145
146 2017-03-04  Simon Fraser  <simon.fraser@apple.com>
147
148         Clarify some terminology in RenderLayerBacking
149         https://bugs.webkit.org/show_bug.cgi?id=169174
150
151         Reviewed by Zalan Bujtas.
152
153         Rename some functions related to directly-composited background images and
154         box decorations for clarify.
155
156         Only behavior change is for canDirectlyCompositeBackgroundBackgroundImage() to check
157         GraphicsLayer::supportsContentsTiling(), which means that RenderLayerBacking::contentChanged()
158         will no longer trigger a updateGeometry() when it gets BackgroundImageChanged on non-
159         CoordinateGraphics platforms.
160
161         * rendering/RenderLayerBacking.cpp:
162         (WebCore::RenderLayerBacking::updateConfiguration):
163         (WebCore::RenderLayerBacking::updateAfterDescendants):
164         (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
165         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
166         (WebCore::hasPaintedBoxDecorationsOrBackgroundImage):
167         (WebCore::supportsDirectlyCompositedBoxDecorations):
168         (WebCore::RenderLayerBacking::paintsBoxDecorations):
169         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
170         (WebCore::RenderLayerBacking::contentChanged):
171         (WebCore::RenderLayerBacking::updateDirectlyCompositedContents): Deleted.
172         (WebCore::canCreateTiledImage): Deleted.
173         (WebCore::hasVisibleBoxDecorationsOrBackgroundImage): Deleted.
174         (WebCore::supportsDirectBoxDecorationsComposition): Deleted.
175         * rendering/RenderLayerBacking.h:
176
177 2017-03-04  Alex Christensen  <achristensen@webkit.org>
178
179         Cleanup after r213418
180         https://bugs.webkit.org/show_bug.cgi?id=169165
181
182         Reviewed by Youenn Fablet.
183
184         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
185         (WebCore::RealtimeIncomingAudioSource::OnData):
186         Restore the assertion I removed.
187
188 2017-03-04  Commit Queue  <commit-queue@webkit.org>
189
190         Unreviewed, rolling out r213379.
191         https://bugs.webkit.org/show_bug.cgi?id=169169
192
193         broke GTK+ and Windows builds (Requested by mcatanzaro on
194         #webkit).
195
196         Reverted changeset:
197
198         "Enable fieldsets to be flexboxes, grids and multicolumn."
199         https://bugs.webkit.org/show_bug.cgi?id=169082
200         http://trac.webkit.org/changeset/213379
201
202 2017-03-03  Youenn Fablet  <youenn@apple.com>
203
204         [WebRTC] Update libwebrtc source code
205         https://bugs.webkit.org/show_bug.cgi?id=168599
206
207         Reviewed by Alex Christensen.
208
209         * Modules/mediastream/RTCStatsReport.h:
210         * Modules/mediastream/RTCStatsReport.idl:
211         Update to match the latest spec, which matches the new structures in libwebrtc.
212         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
213         (WebCore::fillRTCRTPStreamStats):
214         (WebCore::fillOutboundRTPStreamStats):
215         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
216         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
217         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
218         (WebCore::RealtimeIncomingAudioSource::OnData):
219         Comment out an assertion that was failing.  We should revisit this.
220         * testing/MockLibWebRTCPeerConnection.h:
221
222 2017-03-03  Commit Queue  <commit-queue@webkit.org>
223
224         Unreviewed, rolling out r213400.
225         https://bugs.webkit.org/show_bug.cgi?id=169163
226
227         Caused frequent assertion failures (Requested by ap on
228         #webkit).
229
230         Reverted changeset:
231
232         "[Modern Media Controls] Improve media documents across macOS,
233         iPhone and iPad"
234         https://bugs.webkit.org/show_bug.cgi?id=169145
235         http://trac.webkit.org/changeset/213400
236
237 2017-03-03  Andy Estes  <aestes@apple.com>
238
239         Add support for canvas.toBlob
240         https://bugs.webkit.org/show_bug.cgi?id=148878
241         <rdar://problem/22590406>
242
243         Reviewed by Tim Horton.
244
245         These tests now pass:
246         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
247         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html
248
249         * CMakeLists.txt:
250         * DerivedSources.make:
251         * WebCore.xcodeproj/project.pbxproj:
252         * fileapi/BlobCallback.cpp: Added.
253         (WebCore::BlobCallback::scheduleCallback):
254         * fileapi/BlobCallback.h: Added.
255         (WebCore::BlobCallback::~BlobCallback):
256         * fileapi/BlobCallback.idl: Added.
257         * html/HTMLCanvasElement.cpp:
258         (WebCore::HTMLCanvasElement::toBlob):
259         * html/HTMLCanvasElement.h:
260         * html/HTMLCanvasElement.idl:
261         * platform/graphics/ImageBuffer.h:
262         * platform/graphics/cairo/ImageBufferCairo.cpp:
263         (WebCore::writeFunction):
264         (WebCore::encodeImage):
265         (WebCore::ImageBuffer::toDataURL):
266         (WebCore::ImageBuffer::toData):
267         * platform/graphics/cg/ImageBufferCG.cpp:
268         (WebCore::data):
269         (WebCore::ImageBuffer::toDataURL):
270         (WebCore::ImageBuffer::toData):
271         (WebCore::ImageBuffer::toCGImage):
272         (WebCore::cgImage):
273         (WebCore::dataURL):
274         * platform/graphics/gtk/ImageBufferGtk.cpp:
275         (WebCore::ImageBuffer::toDataURL):
276         (WebCore::ImageBuffer::toData):
277         * platform/graphics/win/ImageBufferDirect2D.cpp:
278         (WebCore::ImageBuffer::toData):
279
280 2017-03-03  Dean Jackson  <dino@apple.com>
281
282         Add WebGPU compile flag and experimental feature flag
283         https://bugs.webkit.org/show_bug.cgi?id=169161
284         <rdar://problem/30846689>
285
286         Reviewed by Tim Horton.
287
288         Add ENABLE_WEBGPU, an experimental feature flag, a RuntimeEnabledFeature,
289         and an InternalSetting.
290
291         * Configurations/FeatureDefines.xcconfig:
292         * page/RuntimeEnabledFeatures.h:
293         (WebCore::RuntimeEnabledFeatures::setWebGPUEnabled):
294         (WebCore::RuntimeEnabledFeatures::webGPUEnabled):
295         * testing/InternalSettings.cpp:
296         (WebCore::InternalSettings::Backup::Backup):
297         (WebCore::InternalSettings::Backup::restoreTo):
298         (WebCore::InternalSettings::setWebGPUEnabled):
299         * testing/InternalSettings.h:
300         * testing/InternalSettings.idl:
301
302 2017-03-03  Simon Fraser  <simon.fraser@apple.com>
303
304         Clean up some RenderLayerBacking code
305         https://bugs.webkit.org/show_bug.cgi?id=169160
306
307         Reviewed by Dean Jackson.
308
309         Modern loops in descendantLayerPaintsIntoAncestor().
310
311         Rename RenderLayerBacking::paintsChildren() to RenderLayerBacking::paintsChildRenderers() to clarify that
312         it refers to renderers, not RenderLayers.
313
314         Rename RenderLayerBacking::paintsNonDirectCompositedBoxDecoration() to RenderLayerBacking::paintsBoxDecorations().
315         "Paints" already implies non-composited.
316
317         No behavior change.
318
319         * rendering/RenderLayerBacking.cpp:
320         (WebCore::RenderLayerBacking::updateDrawsContent):
321         (WebCore::RenderLayerBacking::paintsBoxDecorations):
322         (WebCore::RenderLayerBacking::paintsChildRenderers):
323         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
324         (WebCore::descendantLayerPaintsIntoAncestor):
325         (WebCore::RenderLayerBacking::paintsNonDirectCompositedBoxDecoration): Deleted.
326         (WebCore::RenderLayerBacking::paintsChildren): Deleted.
327         * rendering/RenderLayerBacking.h:
328
329 2017-03-03  Simon Fraser  <simon.fraser@apple.com>
330
331         Clean up RenderImage and a RenderImageResource function
332         https://bugs.webkit.org/show_bug.cgi?id=169153
333
334         Reviewed by Zalan Bujtas.
335         
336         Change all calls to imageResource().cachedImage() in RenderImage to use the inline
337         cachedImage() function.
338
339         In RenderImage::paintReplaced(), early return after the broken image block (and no need
340         to test imageResource().hasImage() again in the second condition). Convert height/width to size,
341         which also forces us to be explicit about using flooredIntSize() when fetching the image
342         (perhaps this should be a roundedIntSize, but I didn't want to change behavior).
343
344         Change RenderImageResource::image() to take an IntSize, rather than int height and width.
345
346         No behavior change.
347
348         * rendering/RenderImage.cpp:
349         (WebCore::RenderImage::styleDidChange):
350         (WebCore::RenderImage::imageChanged):
351         (WebCore::RenderImage::notifyFinished):
352         (WebCore::RenderImage::paintReplaced):
353         (WebCore::RenderImage::paintIntoRect):
354         (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
355         (WebCore::RenderImage::embeddedContentBox):
356         * rendering/RenderImageResource.cpp:
357         (WebCore::RenderImageResource::image):
358         * rendering/RenderImageResource.h:
359         (WebCore::RenderImageResource::image):
360         * rendering/RenderImageResourceStyleImage.cpp:
361         (WebCore::RenderImageResourceStyleImage::image):
362         * rendering/RenderImageResourceStyleImage.h:
363
364 2017-03-03  Antoine Quint  <graouts@apple.com>
365
366         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
367         https://bugs.webkit.org/show_bug.cgi?id=169145
368         <rdar://problem/17048858>
369
370         Reviewed by Dean Jackson.
371
372         There were a variety of issues with media documents, some longstanding, and some specifically
373         about modern media controls.
374
375         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
376         due to using a <video> element to load the audio file. We now have additional logic in MediaController
377         to identify if the loaded media is really an audio file, and using this information to hide the
378         fullscreen and picture-in-picture buttons.
379
380         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
381         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
382         use the injected style in the shadow root to size media documents based on the device characteristics
383         and ensuring that page styles are overridden.
384
385         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
386         attribute and not a <source> element.
387
388         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
389         a media document to hide the controls while we determine the type of media we're loading (audio vs.
390         video) in order to apply the appropriate styling without flashes.
391
392         As a result of the new styles applied by the modern-media-controls module, media documents have a
393         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
394         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
395         we want to always play the media at full width, with some padding in the case of audio.
396
397         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
398                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
399                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
400                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
401                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
402                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
403                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
404                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
405
406         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
407         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
408         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
409         * Modules/modern-media-controls/controls/macos-media-controls.css:
410         (:host(audio) .media-controls.mac.inline > .controls-bar,):
411         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
412         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
413         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
414         * Modules/modern-media-controls/controls/media-document.css: Added.
415         (:host(.media-document)):
416         (:host(.media-document.ready)):
417         (:host(.media-document.audio.mac)):
418         (:host(.media-document.audio.ipad)):
419         (:host(.media-document.audio.iphone)):
420         (:host(.media-document.video.mac)):
421         (:host(.media-document.video.ipad)):
422         (:host(.media-document.video.iphone)):
423         * Modules/modern-media-controls/js-files:
424         * Modules/modern-media-controls/media/fullscreen-support.js:
425         (FullscreenSupport.prototype.syncControl):
426         (FullscreenSupport):
427         * Modules/modern-media-controls/media/media-controller.js:
428         (MediaController):
429         (MediaController.prototype.get isAudio):
430         * Modules/modern-media-controls/media/media-document-controller.js: Added.
431         (MediaDocumentController):
432         (MediaDocumentController.prototype.handleEvent):
433         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
434         (MediaDocumentController.prototype._mediaDocumentHasSize):
435         * Modules/modern-media-controls/media/pip-support.js:
436         (PiPSupport.prototype.syncControl):
437         (PiPSupport):
438         * html/MediaDocument.cpp:
439         (WebCore::MediaDocumentParser::createDocumentStructure):
440
441 2017-03-03  Chris Dumez  <cdumez@apple.com>
442
443         [iOS] Throttle SVG SMIL animations to 30fps in low power mode
444         https://bugs.webkit.org/show_bug.cgi?id=169137
445         <rdar://problem/30833754>
446
447         Reviewed by Simon Fraser.
448
449         Throttle SVG SMIL animations to 30fps in low power mode on iOS to save
450         battery.
451
452         Test: svg/animations/animations-lowPowerMode-throttling.html
453
454         * svg/SVGSVGElement.cpp:
455         (WebCore::SVGSVGElement::SVGSVGElement):
456         * svg/SVGSVGElement.idl:
457         * svg/animation/SMILTime.h:
458         (WebCore::SMILTime::SMILTime):
459         * svg/animation/SMILTimeContainer.cpp:
460         (WebCore::SMILTimeContainer::SMILTimeContainer):
461         (WebCore::SMILTimeContainer::animationFrameDelay):
462         (WebCore::SMILTimeContainer::updateDocumentOrderIndexes):
463         (WebCore::SMILTimeContainer::updateAnimations):
464         * svg/animation/SMILTimeContainer.h:
465         * svg/animation/SVGSMILElement.cpp:
466         (WebCore::SVGSMILElement::calculateNextProgressTime):
467         * testing/Internals.cpp:
468         (WebCore::Internals::svgAnimationsInterval):
469         * testing/Internals.h:
470         * testing/Internals.idl:
471
472 2017-03-03  Joseph Pecoraro  <pecoraro@apple.com>
473
474         [Mac] WebCore.framework is missing a symlink from Frameworks to Versions/Current/Frameworks when the latter exists
475         https://bugs.webkit.org/show_bug.cgi?id=169067
476
477         Reviewed by Dan Bernstein.
478
479         * WebCore.xcodeproj/project.pbxproj:
480
481 2017-03-03  Sam Weinig  <sam@webkit.org>
482
483         REGRESSION (r209760): Apple Pay doesn't work on casper.com, shopspring.com, maybe other sites
484         <rdar://problem/30313445>
485         https://bugs.webkit.org/show_bug.cgi?id=169149
486
487         Reviewed by Simon Fraser.
488
489         Relax restriction that the ApplePayShippingMethod sequence must not be empty. This
490         was incorrect.
491
492         * Modules/applepay/ApplePaySession.cpp:
493         (WebCore::convertAndValidate):
494
495 2017-03-03  Alex Christensen  <achristensen@webkit.org>
496
497         [URLParser] Fix file: as a relative file URL
498         https://bugs.webkit.org/show_bug.cgi?id=169122
499
500         Reviewed by Tim Horton.
501
502         This is clearly defined in https://url.spec.whatwg.org/#file-state with the EOF code point.
503         I got it wrong and didn't test it.  It's been added to the web platform tests since we last updated.
504
505         * platform/URLParser.cpp:
506         (WebCore::URLParser::parse):
507
508 2017-03-03  Dave Hyatt  <hyatt@apple.com>
509
510         Enable fieldsets to be flexboxes, grids and multicolumn.
511         https://bugs.webkit.org/show_bug.cgi?id=169082
512
513         Reviewed by Simon Fraser.
514
515         Added new tests in fast/forms/fieldset.
516
517         This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
518         derived classes can also be fieldsets.
519
520         * CMakeLists.txt:
521         * WebCore.xcodeproj/project.pbxproj:
522         Remove RenderFieldset from the project.
523
524         * accessibility/AccessibilityRenderObject.cpp:
525         (WebCore::AccessibilityRenderObject::titleUIElement):
526         Call in to RenderBlock now instead of RenderFieldset.
527
528         * html/HTMLFieldSetElement.cpp:
529         (WebCore::HTMLFieldSetElement::createElementRenderer):
530         * html/HTMLFieldSetElement.h:
531         The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
532         can be supported. A special flag has been added that indicates only to make flexbox and block-related
533         renderers (not table display types).
534
535         * rendering/OrderIterator.cpp:
536         (WebCore::OrderIterator::shouldSkipChild):
537         (WebCore::OrderIteratorPopulator::collectChild):
538         * rendering/OrderIterator.h:
539         Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
540         value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
541         excluded children like the legends of fieldsets.
542
543         * rendering/RenderBlock.cpp:
544         (WebCore::RenderBlockRareData::RenderBlockRareData):
545         When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
546         This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
547         across any layout system, since the legend is now just treated as part of the border.
548
549         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
550         Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
551         preferred width in their own way and not as part of a specific layout system.
552
553         (WebCore::RenderBlock::renderName):
554         Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.
555
556         (WebCore::RenderBlock::layoutExcludedChildren):
557         Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
558         can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
559         the layout of legends by both placing them and setting the correct intrinsic border before amount on the
560         block.
561
562         (WebCore::RenderBlock::findFieldsetLegend):
563         Moved from RenderFieldset.
564
565         (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
566         (WebCore::RenderBlock::paintRectToClipOutFromBorder):
567         These methods are used when painting to shrink the border box as needed to account for the legend and to
568         provide the portion of the border that needs to be clipped out. These methods have been enhanced to
569         properly support all writing modes.
570
571         (WebCore::RenderBlock::intrinsicBorderForFieldset):
572         (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
573         (WebCore::RenderBlock::borderTop):
574         (WebCore::RenderBlock::borderLeft):
575         (WebCore::RenderBlock::borderBottom):
576         (WebCore::RenderBlock::borderRight):
577         (WebCore::RenderBlock::borderBefore):
578         These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
579         properly factored in.
580
581         (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
582         * rendering/RenderBlock.h:
583         This method computes the preferred widths for legend children in order to ensure that the legend properly
584         grows the width of the fieldset when it is the widest item.
585
586         (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
587         (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
588         Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
589         for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
590         (and our old behavior).
591
592         (WebCore::RenderBlock::paintExcludedChildrenInBorder):
593         Method for painting the excluded children that might be present in our border. We only do this if the
594         paint phase is a box decoration painting phase and if the legend isn't self-painting.
595
596         * rendering/RenderBlockFlow.cpp:
597         (WebCore::RenderBlockFlow::willCreateColumns):
598         Allow fieldsets to create columns now.
599
600         (WebCore::RenderBlockFlow::layoutBlockChildren):
601         (WebCore::RenderBlockFlow::layoutExcludedChildren):
602         Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
603         get handled properly.
604
605         (WebCore::RenderBlockFlow::addChild):
606         Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
607         remain outside of it.
608
609         (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
610         Renamed to layoutExcludedChildren.
611
612         * rendering/RenderBlockFlow.h:
613         * rendering/RenderBox.cpp:
614         (WebCore::RenderBox::paintBoxDecorations):
615         (WebCore::RenderBox::paintMask):
616         Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
617         order to properly shrink the border box rect for painting and to clip out the portion of the border
618         covered by the legend.
619
620         (WebCore::RenderBox::avoidsFloats):
621         Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
622         its removal, we need to put this in the base class along with legends.
623
624         * rendering/RenderBox.h:
625         (WebCore::RenderBox::isGridItem):
626         (WebCore::RenderBox::isFlexItem):
627         Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.
628
629         (WebCore::RenderBox::adjustBorderBoxRectForPainting):
630         This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.
631
632         * rendering/RenderBoxModelObject.cpp:
633         (WebCore::RenderBoxModelObject::paintBorder):
634         * rendering/RenderBoxModelObject.h:
635         (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
636         Patched to properly paint fieldsets using the new helpers.
637
638         * rendering/RenderDeprecatedFlexibleBox.cpp:
639         (WebCore::FlexBoxIterator::next):
640         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
641         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
642         Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.
643
644         * rendering/RenderElement.cpp:
645         (WebCore::RenderElement::createFor):
646         * rendering/RenderElement.h:
647         Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
648         display types.
649
650         * rendering/RenderFieldset.cpp: Removed.
651         * rendering/RenderFieldset.h: Removed.
652         Remove RenderFieldset files from the tree.
653
654         * rendering/RenderFlexibleBox.cpp:
655         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
656         (WebCore::RenderFlexibleBox::firstLineBaseline):
657         (WebCore::RenderFlexibleBox::layoutBlock):
658         (WebCore::RenderFlexibleBox::layoutFlexItems):
659         (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
660         Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
661         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
662         part of the flexible box layout.
663
664         * rendering/RenderGrid.cpp:
665         (WebCore::RenderGrid::layoutBlock):
666         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
667         (WebCore::RenderGrid::placeItemsOnGrid):
668         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
669         (WebCore::RenderGrid::layoutGridItems):
670         Make sure grids lay out their legends properly by calling layoutExcludedChildren.
671         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
672         part of the grid's layout.
673
674         * rendering/RenderMultiColumnFlowThread.cpp:
675         (WebCore::RenderMultiColumnFlowThread::populate):
676         Pull legends back up into the block and don't let them be part of the flow thread.
677
678         * rendering/RenderMultiColumnSet.cpp:
679         (WebCore::RenderMultiColumnSet::requiresBalancing):
680         Fix an assert to allow legends to exist as siblings of multicolumn sets.
681
682         * rendering/RenderObject.cpp:
683         (WebCore::RenderObject::isFieldset):
684         Changed to examine the HTML element rather than RenderFieldset.
685
686         * rendering/RenderObject.h:
687         (WebCore::RenderObject::isExcludedFromNormalLayout):
688         (WebCore::RenderObject::setIsExcludedFromNormalLayout):
689         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
690         RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
691         placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
692         the layout system and can be skipped.
693
694         (WebCore::RenderObject::isExcludedAndPlacedInBorder):
695         Helper method for asking if an object is painting inside the border. Used to know we
696         need to factor it into preferred width calculations outside of any one layout system
697         and also to know that we need to paint it when we paint the fieldset's border instead of
698         later (after we might have scrolled or clipped the child painting area).
699
700         * rendering/RenderRubyRun.cpp:
701         (WebCore::RenderRubyRun::layoutExcludedChildren):
702         (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
703         * rendering/RenderRubyRun.h:
704         Rename layoutSpecialExcludedChild to layoutExcludedChildren.
705
706         * rendering/RenderTable.cpp:
707         (WebCore::RenderTable::adjustBorderBoxRectForPainting):
708         (WebCore::RenderTable::paintBoxDecorations):
709         (WebCore::RenderTable::paintMask):
710         (WebCore::RenderTable::subtractCaptionRect): Deleted.
711         * rendering/RenderTable.h:
712         Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
713         out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
714         way.
715
716         * rendering/RenderTableCell.cpp:
717         (WebCore::RenderTableCell::paintBoxDecorations):
718         (WebCore::RenderTableCell::paintMask):
719         Make sure table cells adjust their border box rects for painting. Again this is prep work for
720         cells potentially being fieldsets, but not supported yet.
721
722         * rendering/RenderTextControl.cpp:
723         (WebCore::RenderTextControl::layoutExcludedChildren):
724         (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
725         * rendering/RenderTextControl.h:
726         * rendering/RenderTextControlMultiLine.cpp:
727         (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
728         (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
729         * rendering/RenderTextControlMultiLine.h:
730         Renamed the methods for doing the excluded child layout.
731
732         * rendering/RenderTreeAsText.cpp:
733         (WebCore::RenderTreeAsText::writeRenderObject):
734         Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.
735
736 2017-03-03  Ryan Haddad  <ryanhaddad@apple.com>
737
738         Unreviewed, rolling out r213344.
739
740         This changed caused LayoutTest crashes under GuardMalloc.
741
742         Reverted changeset:
743
744         "Add support for canvas.toBlob"
745         https://bugs.webkit.org/show_bug.cgi?id=148878
746         http://trac.webkit.org/changeset/213344
747
748 2017-03-03  Konstantin Tokarev  <annulen@yandex.ru>
749
750         Unreviewed typo fix
751
752         * features.json:
753
754 2017-03-03  Eric Carlson  <eric.carlson@apple.com>
755
756         [MediaStream] Remove #if USE(VIDEOTOOLBOX) from AVVideoCaptureSource
757         https://bugs.webkit.org/show_bug.cgi?id=169131
758
759         Reviewed by Youenn Fablet.
760
761         * platform/mediastream/mac/AVVideoCaptureSource.mm:
762         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
763
764 2017-03-03  Chris Dumez  <cdumez@apple.com>
765
766         Add assertion in Frame::setView() to make sure associated document has no living render tree
767         https://bugs.webkit.org/show_bug.cgi?id=169134
768
769         Reviewed by Brent Fulgham.
770
771         Add assertion in Frame::setView() to make sure associated document has no living render tree.
772         This is not supposed to happen and r213311 fixed one case where this could happen. We need
773         to find out if it can still happen.
774
775         * page/Frame.cpp:
776         (WebCore::Frame::setView):
777
778 2017-03-02  Sam Weinig  <sam@webkit.org>
779
780         Rename htmlediting.h/cpp to Editing.h/cpp
781         https://bugs.webkit.org/show_bug.cgi?id=169103
782
783         Reviewed by Alex Christensen.
784
785         * CMakeLists.txt:
786         * WebCore.xcodeproj/project.pbxproj:
787         * accessibility/AXObjectCache.cpp:
788         * accessibility/AccessibilityNodeObject.cpp:
789         * accessibility/AccessibilityObject.cpp:
790         * accessibility/AccessibilityRenderObject.cpp:
791         * accessibility/atk/WebKitAccessibleHyperlink.cpp:
792         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
793         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
794         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
795         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
796         * dom/Document.cpp:
797         * dom/Element.cpp:
798         * dom/Node.h:
799         * dom/Position.cpp:
800         * dom/PositionIterator.cpp:
801         * dom/Range.cpp:
802         * editing/AlternativeTextController.cpp:
803         * editing/AppendNodeCommand.cpp:
804         * editing/ApplyBlockElementCommand.cpp:
805         * editing/ApplyStyleCommand.cpp:
806         * editing/BreakBlockquoteCommand.cpp:
807         * editing/CompositeEditCommand.cpp:
808         * editing/CreateLinkCommand.cpp:
809         (WebCore::CreateLinkCommand::CreateLinkCommand):
810         * editing/DeleteFromTextNodeCommand.cpp:
811         * editing/DeleteSelectionCommand.cpp:
812         * editing/EditCommand.cpp:
813         * editing/Editing.cpp: Copied from Source/WebCore/editing/htmlediting.cpp.
814         * editing/Editing.h: Copied from Source/WebCore/editing/htmlediting.h.
815         * editing/EditingAllInOne.cpp:
816         * editing/EditingStyle.cpp:
817         * editing/Editor.cpp:
818         * editing/EditorCommand.cpp:
819         * editing/FormatBlockCommand.cpp:
820         * editing/FrameSelection.cpp:
821         * editing/HTMLInterchange.cpp:
822         * editing/IndentOutdentCommand.cpp:
823         * editing/InsertLineBreakCommand.cpp:
824         * editing/InsertListCommand.cpp:
825         * editing/InsertNodeBeforeCommand.cpp:
826         * editing/InsertParagraphSeparatorCommand.cpp:
827         * editing/InsertTextCommand.cpp:
828         * editing/ModifySelectionListLevel.cpp:
829         * editing/RemoveNodeCommand.cpp:
830         * editing/ReplaceNodeWithSpanCommand.cpp:
831         * editing/ReplaceSelectionCommand.cpp:
832         * editing/SpellChecker.cpp:
833         * editing/TextIterator.cpp:
834         * editing/TypingCommand.cpp:
835         * editing/VisiblePosition.cpp:
836         * editing/VisibleSelection.cpp:
837         * editing/VisibleUnits.cpp:
838         * editing/cocoa/DataDetection.mm:
839         * editing/cocoa/EditorCocoa.mm:
840         * editing/htmlediting.cpp: Removed.
841         * editing/htmlediting.h: Removed.
842         * editing/ios/EditorIOS.mm:
843         * editing/mac/DictionaryLookup.mm:
844         * editing/mac/EditorMac.mm:
845         * editing/markup.cpp:
846         * html/HTMLTextFormControlElement.cpp:
847         * inspector/InspectorDOMAgent.cpp:
848         * page/DOMSelection.cpp:
849         * page/DragController.cpp:
850         * page/EventHandler.cpp:
851         * page/FocusController.cpp:
852         * page/Frame.cpp:
853         * platform/ios/PasteboardIOS.mm:
854         * platform/mac/PasteboardMac.mm:
855         * rendering/RenderBox.cpp:
856         * rendering/RenderObject.cpp:
857
858 2017-03-02  Matt Baker  <mattbaker@apple.com>
859
860         Web Inspector: Should be able to push nodes in an iframe subtree to the frontend
861         https://bugs.webkit.org/show_bug.cgi?id=169086
862
863         Reviewed by Joseph Pecoraro.
864
865         Test: inspector/dom/push-node-by-path-to-frontend.html
866
867         * inspector/InspectorDOMAgent.cpp:
868         (WebCore::InspectorDOMAgent::nodeForPath):
869         During top-down document traversal, descend into content document nodes
870         when visiting an HTMLFrameOwnerElement.
871
872 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
873
874         Unreviewed, rolling out r213274.
875
876         This change caused flakiness with LayoutTest memory/memory-
877         pressure-simulation.html
878
879         Reverted changeset:
880
881         "Don't keep dead resources in MemoryCache while under memory
882         pressure."
883         https://bugs.webkit.org/show_bug.cgi?id=169070
884         http://trac.webkit.org/changeset/213274
885
886 2017-03-02  Jiewen Tan  <jiewen_tan@apple.com>
887
888         WebCrypto API support for AES-GCM
889         https://bugs.webkit.org/show_bug.cgi?id=157175
890         <rdar://problem/27311691>
891
892         Reviewed by Brent Fulgham.
893
894         This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
895         importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm
896
897         Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
898                crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
899                crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
900                crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
901                crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
902                crypto/subtle/aes-gcm-generate-export-raw-key.html
903                crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
904                crypto/subtle/aes-gcm-generate-key.html
905                crypto/subtle/aes-gcm-import-jwk-key-length-128.html
906                crypto/subtle/aes-gcm-import-jwk-key-length-192.html
907                crypto/subtle/aes-gcm-import-jwk-key-length-256.html
908                crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
909                crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
910                crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
911                crypto/subtle/aes-gcm-import-key-decrypt.html
912                crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
913                crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
914                crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
915                crypto/subtle/aes-gcm-import-key-encrypt.html
916                crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
917                crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
918                crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
919                crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
920                crypto/subtle/aes-gcm-import-raw-key.html
921                crypto/workers/subtle/aes-gcm-import-key-decrypt.html
922                crypto/workers/subtle/aes-gcm-import-key-encrypt.html
923                crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
924                crypto/workers/subtle/aes-gcm-import-key-wrap-key.html
925
926         * CMakeLists.txt:
927         * DerivedSources.make:
928         * PlatformGTK.cmake:
929         * PlatformMac.cmake:
930         Add CryptoAlgorithmAES_CFBMac.cpp as well.
931         * WebCore.xcodeproj/project.pbxproj:
932         * bindings/js/JSSubtleCryptoCustom.cpp:
933         (WebCore::normalizeCryptoAlgorithmParameters):
934         Add support for AES-GCM.
935         * crypto/CommonCryptoUtilities.h:
936         Include SPI header for AES-GCM support. We have a mismatch SPI between different OS version.
937         Therefore, a guardian is placed.
938         * crypto/CryptoAlgorithmParameters.h:
939         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
940         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
941         (WebCore::tagLengthIsValid):
942         (WebCore::CryptoAlgorithmAES_GCM::create):
943         (WebCore::CryptoAlgorithmAES_GCM::identifier):
944         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
945         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
946         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
947         (WebCore::CryptoAlgorithmAES_GCM::importKey):
948         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
949         * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
950         * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
951         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
952         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
953         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
954         (WebCore::encryptAES_GCM):
955         (WebCore::decyptAES_GCM):
956         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
957         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
958         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
959         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
960         * crypto/parameters/AesGcmParams.idl: Added.
961         * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.
962
963 2017-03-02  Andy Estes  <aestes@apple.com>
964
965         Add support for canvas.toBlob
966         https://bugs.webkit.org/show_bug.cgi?id=148878
967         <rdar://problem/22590406>
968
969         Reviewed by Tim Horton.
970
971         These tests now pass:
972         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
973         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html
974
975         * CMakeLists.txt:
976         * DerivedSources.make:
977         * WebCore.xcodeproj/project.pbxproj:
978         * fileapi/BlobCallback.cpp: Added.
979         (WebCore::BlobCallback::scheduleCallback):
980         * fileapi/BlobCallback.h: Added.
981         (WebCore::BlobCallback::~BlobCallback):
982         * fileapi/BlobCallback.idl: Added.
983         * html/HTMLCanvasElement.cpp:
984         (WebCore::HTMLCanvasElement::toBlob):
985         * html/HTMLCanvasElement.h:
986         * html/HTMLCanvasElement.idl:
987         * platform/graphics/ImageBuffer.h:
988         * platform/graphics/cairo/ImageBufferCairo.cpp:
989         (WebCore::writeFunction):
990         (WebCore::encodeImage):
991         (WebCore::ImageBuffer::toDataURL):
992         (WebCore::ImageBuffer::toData):
993         * platform/graphics/cg/ImageBufferCG.cpp:
994         (WebCore::data):
995         (WebCore::ImageBuffer::toDataURL):
996         (WebCore::ImageBuffer::toData):
997         (WebCore::ImageBuffer::toCGImage):
998         (WebCore::cgImage):
999         (WebCore::dataURL):
1000         * platform/graphics/gtk/ImageBufferGtk.cpp:
1001         (WebCore::ImageBuffer::toDataURL):
1002         (WebCore::ImageBuffer::toData):
1003         * platform/graphics/win/ImageBufferDirect2D.cpp:
1004         (WebCore::ImageBuffer::toData):
1005
1006 2017-03-02  Myles C. Maxfield  <mmaxfield@apple.com>
1007
1008         Migrate font-stretch to use fixed-point values
1009         https://bugs.webkit.org/show_bug.cgi?id=169107
1010
1011         Reviewed by Dean Jackson.
1012
1013         There are a few benefits of using fixed-point values:
1014         - Not all of the entropy of a float is necessary for font selection. In particular, values are
1015         expected to stay between around -1000 to 1000, and only need to have a few fractional bits.
1016         Therefore, the values can be represented by 16-bit fixed point numbers, which includes one sign
1017         bit and two fractional bits. This is smaller than the 32-bit floating point numbers we were
1018         using, which means FontDescription can be slimmed down. This becomes even more important when
1019         the rest of the variation font properties are implemented, since those will use these fixed-
1020         point values too.
1021         - Fixed point values have a larger distance between adjacent representable values, which means
1022         there are more collisions, which means our cache hit rates are higher.
1023
1024         No new tests because there is no behavior change.
1025
1026         * css/CSSComputedStyleDeclaration.cpp:
1027         (WebCore::fontStretchFromStyle):
1028         * css/StyleBuilderConverter.h:
1029         (WebCore::StyleBuilderConverter::convertFontStretch):
1030         * platform/graphics/FontCache.h:
1031         (WebCore::FontDescriptionKey::FontDescriptionKey):
1032         * platform/graphics/FontDescription.h:
1033         (WebCore::FontDescription::stretch):
1034         (WebCore::FontDescription::setStretch):
1035         (WebCore::FontCascadeDescription::initialStretch):
1036         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1037         (WebCore::defaultFontSelectionValues):
1038         (WebCore::preparePlatformFont):
1039         (WebCore::FontDatabase::InstalledFont::InstalledFont):
1040         (WebCore::FontDatabase::InstalledFontFamily::expand):
1041         (WebCore::FontDatabase::capabilitiesForFontDescriptor):
1042         (WebCore::FontDatabase::stretchThreshold):
1043         (WebCore::FontDatabase::italicThreshold):
1044         (WebCore::FontDatabase::weightThreshold):
1045         (WebCore::findClosestStretch):
1046         (WebCore::filterStretch):
1047         (WebCore::findClosestStyle):
1048         (WebCore::filterStyle):
1049         (WebCore::findClosestWeight):
1050         (WebCore::filterWeight):
1051         (WebCore::computeTargetWeight):
1052         (WebCore::findClosestFont):
1053         (WebCore::platformFontLookupWithFamily):
1054         (WebCore::fontWithFamily):
1055         (WebCore::defaultVariationValues): Deleted.
1056         (WebCore::FontDatabase::Range::Range): Deleted.
1057         (WebCore::FontDatabase::Range::isValid): Deleted.
1058         (WebCore::FontDatabase::Range::expand): Deleted.
1059         (WebCore::FontDatabase::Range::includes): Deleted.
1060         (): Deleted.
1061         * platform/text/TextFlags.h:
1062         (WebCore::FontSelectionValue::FontSelectionValue):
1063         (WebCore::FontSelectionValue::operator float):
1064         (WebCore::FontSelectionValue::operator+):
1065         (WebCore::FontSelectionValue::operator-):
1066         (WebCore::FontSelectionValue::operator*):
1067         (WebCore::FontSelectionValue::operator/):
1068         (WebCore::FontSelectionValue::operator==):
1069         (WebCore::FontSelectionValue::operator!=):
1070         (WebCore::FontSelectionValue::operator<):
1071         (WebCore::FontSelectionValue::operator<=):
1072         (WebCore::FontSelectionValue::operator>):
1073         (WebCore::FontSelectionValue::operator>=):
1074         (WebCore::FontSelectionValue::rawValue):
1075         (WebCore::FontSelectionRange::isValid):
1076         (WebCore::FontSelectionRange::expand):
1077         (WebCore::FontSelectionRange::includes):
1078         (WebCore::FontSelectionCapabilities::expand):
1079
1080 2017-03-02  Alex Christensen  <achristensen@webkit.org>
1081
1082         Modernize ContentExtensionParser
1083         https://bugs.webkit.org/show_bug.cgi?id=169106
1084
1085         Reviewed by Andy Estes.
1086
1087         We were returning std::error_code and passing the return value as a parameter reference.
1088         because we wrote this code before we had WTF::Expected.
1089
1090         No change in behavior, verified by many API tests.
1091
1092         * contentextensions/ContentExtensionCompiler.cpp:
1093         (WebCore::ContentExtensions::compileRuleList):
1094         * contentextensions/ContentExtensionParser.cpp:
1095         (WebCore::ContentExtensions::getDomainList):
1096         (WebCore::ContentExtensions::loadTrigger):
1097         (WebCore::ContentExtensions::loadAction):
1098         (WebCore::ContentExtensions::loadRule):
1099         (WebCore::ContentExtensions::loadEncodedRules):
1100         (WebCore::ContentExtensions::parseRuleList):
1101         * contentextensions/ContentExtensionParser.h:
1102         * contentextensions/ContentExtensionRule.cpp:
1103         (WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
1104         * contentextensions/ContentExtensionRule.h:
1105
1106 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
1107
1108         Unreviewed, rolling out r213301.
1109
1110         This change broke internal builds.
1111
1112         Reverted changeset:
1113
1114         "WebCrypto API support for AES-GCM"
1115         https://bugs.webkit.org/show_bug.cgi?id=157175
1116         http://trac.webkit.org/changeset/213301
1117
1118 2017-03-02  Aakash Jain  <aakash_jain@apple.com>
1119
1120         Move stringMatchesWildcardString from WebKit2 to WebCore
1121         https://bugs.webkit.org/show_bug.cgi?id=169065
1122
1123         Reviewed by Alexey Proskuryakov.
1124
1125         * WebCore.xcodeproj/project.pbxproj: Added StringUtilities.h and StringUtilities.mm
1126         * PlatformMac.cmake: Added StringUtilities.mm
1127         * platform/mac/StringUtilities.h: Added.
1128         * platform/mac/StringUtilities.mm: Added.
1129         (WebCore::wildcardRegexPatternString): Added.
1130         (WebCore::stringMatchesWildcardString): Added.
1131
1132 2017-02-28  Matt Rajca  <mrajca@apple.com>
1133
1134         Media: send "did interfere with playback" events when the user pauses an autoplaying element
1135         https://bugs.webkit.org/show_bug.cgi?id=169006
1136
1137         Reviewed by Alex Christensen.
1138
1139         Added API tests.
1140
1141         * html/HTMLMediaElement.cpp:
1142         (WebCore::HTMLMediaElement::pauseInternal):
1143
1144 2017-03-02  Chris Dumez  <cdumez@apple.com>
1145
1146         We should prevent load of subframes inserted during FrameTree deconstruction
1147         https://bugs.webkit.org/show_bug.cgi?id=169095
1148
1149         Reviewed by Brent Fulgham.
1150
1151         When deconstructing the FrameTree, we fire the unload event in each subframe.
1152         Such unload event handler may insert a new frame, we would previously load
1153         such new frame which was unsafe as we would end up with an attached subframe
1154         on a detached tree. To address the issue, we prevent new subframes from loading
1155         while deconstructing the FrameTree and firing the unload events. This new
1156         behavior is consistent with Chrome and should therefore be safe from a
1157         compatibility standpoint.
1158
1159         Test: fast/frames/insert-frame-unload-handler.html
1160
1161         * dom/ContainerNodeAlgorithms.cpp:
1162         (WebCore::disconnectSubframes):
1163         Update SubframeLoadingDisabler call site now that the constructor takes in
1164         a pointer instead of a reference.
1165
1166         * html/HTMLFrameOwnerElement.h:
1167         (WebCore::SubframeLoadingDisabler::SubframeLoadingDisabler):
1168         (WebCore::SubframeLoadingDisabler::~SubframeLoadingDisabler):
1169         Update SubframeLoadingDisabler constructor to take in a pointer instead
1170         of a reference, for convenience.
1171
1172         * loader/FrameLoader.cpp:
1173         (WebCore::FrameLoader::detachChildren):
1174         Prevent loads in subframes while detaching the subframes. It would be unsafe
1175         as we copy the list of frames before iterating to fire the unload events.
1176         Therefore, newly inserted frames would not get unloaded.
1177
1178 2017-03-02  Dave Hyatt  <hyatt@apple.com>
1179
1180         flex-basis should be 0% (not 0px) when omitted
1181         https://bugs.webkit.org/show_bug.cgi?id=169100
1182         rdar://problem/30429154
1183
1184         Reviewed by Dean Jackson.
1185
1186         Covered by existing tests.
1187
1188         * css/parser/CSSPropertyParser.cpp:
1189         (WebCore::CSSPropertyParser::consumeFlex):
1190
1191 2017-02-22  Jiewen Tan  <jiewen_tan@apple.com>
1192
1193         WebCrypto API support for AES-GCM
1194         https://bugs.webkit.org/show_bug.cgi?id=157175
1195         <rdar://problem/27311691>
1196
1197         Reviewed by Brent Fulgham.
1198
1199         This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
1200         importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm
1201
1202         Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
1203                crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
1204                crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
1205                crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
1206                crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
1207                crypto/subtle/aes-gcm-generate-export-raw-key.html
1208                crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
1209                crypto/subtle/aes-gcm-generate-key.html
1210                crypto/subtle/aes-gcm-import-jwk-key-length-128.html
1211                crypto/subtle/aes-gcm-import-jwk-key-length-192.html
1212                crypto/subtle/aes-gcm-import-jwk-key-length-256.html
1213                crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
1214                crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
1215                crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
1216                crypto/subtle/aes-gcm-import-key-decrypt.html
1217                crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
1218                crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
1219                crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
1220                crypto/subtle/aes-gcm-import-key-encrypt.html
1221                crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
1222                crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
1223                crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
1224                crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
1225                crypto/subtle/aes-gcm-import-raw-key.html
1226                crypto/workers/subtle/aes-gcm-import-key-decrypt.html
1227                crypto/workers/subtle/aes-gcm-import-key-encrypt.html
1228                crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
1229                crypto/workers/subtle/aes-gcm-import-key-wrap-key.html
1230
1231         * CMakeLists.txt:
1232         * DerivedSources.make:
1233         * PlatformGTK.cmake:
1234         * PlatformMac.cmake:
1235         Add CryptoAlgorithmAES_CFBMac.cpp as well.
1236         * WebCore.xcodeproj/project.pbxproj:
1237         * bindings/js/JSSubtleCryptoCustom.cpp:
1238         (WebCore::normalizeCryptoAlgorithmParameters):
1239         Add support for AES-GCM.
1240         * crypto/CommonCryptoUtilities.h:
1241         Include SPI header for AES-GCM support.
1242         * crypto/CryptoAlgorithmParameters.h:
1243         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
1244         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
1245         (WebCore::tagLengthIsValid):
1246         (WebCore::CryptoAlgorithmAES_GCM::create):
1247         (WebCore::CryptoAlgorithmAES_GCM::identifier):
1248         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
1249         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
1250         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
1251         (WebCore::CryptoAlgorithmAES_GCM::importKey):
1252         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
1253         * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
1254         * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
1255         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
1256         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
1257         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
1258         (WebCore::encryptAES_GCM):
1259         (WebCore::decyptAES_GCM):
1260         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
1261         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
1262         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
1263         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1264         * crypto/parameters/AesGcmParams.idl: Added.
1265         * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.
1266
1267 2017-03-02  Alex Christensen  <achristensen@webkit.org>
1268
1269         Continue enabling WebRTC
1270         https://bugs.webkit.org/show_bug.cgi?id=169056
1271
1272         Reviewed by Jon Lee.
1273
1274         * Configurations/FeatureDefines.xcconfig:
1275
1276 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
1277
1278         Unreviewed, rolling out r213281.
1279
1280         This change caused API test WebKit2.UserMediaBasic to time
1281         out.
1282
1283         Reverted changeset:
1284
1285         "[MediaStream] UIClient may not be notified of capture state
1286         change when leaving a page"
1287         https://bugs.webkit.org/show_bug.cgi?id=169014
1288         http://trac.webkit.org/changeset/213281
1289
1290 2017-03-02  Jon Lee  <jonlee@apple.com>
1291
1292         Improve consistency of captions rendering on Mac
1293         https://bugs.webkit.org/show_bug.cgi?id=169071
1294
1295         Reviewed by Eric Carlson.
1296
1297         * page/CaptionUserPreferencesMediaAF.h:
1298         (WebCore::CaptionUserPreferencesMediaAF::captionsEdgeColorForTextColor): Deleted.
1299         (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor): Deleted.
1300
1301         * page/CaptionUserPreferencesMediaAF.cpp:
1302         (WebCore::appendCSS): Helper function to add a CSS rule with a provided StringBuilder.
1303         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS): Refactor to use
1304         appendCSS.
1305         (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS): Ditto.
1306         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS): Update text edge styles.
1307         - Add a blur to the shadow
1308         - Drop shadow style includes 1px text border
1309         - Always use black for the text edge color
1310         Also convert the stroke rules to using the CSS property and values instead of straight strings.
1311         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride): Fly-by fix of a typo.
1312
1313 2017-03-02  Chris Dumez  <cdumez@apple.com>
1314
1315         Download attribute set to "*\" save file with name "example.com"
1316         https://bugs.webkit.org/show_bug.cgi?id=169066
1317         <rdar://problem/30740875>
1318
1319         Reviewed by Alex Christensen.
1320
1321         The issue is that a backslash in recognized as an escaping character in
1322         a quoted string as per RFC2616:
1323         "
1324         The backslash character ("\") MAY be used as a single-character
1325         quoting mechanism only within quoted-string and comment constructs.
1326         "
1327
1328         We therefore need to escape the backslashes in the filename before
1329         using it in the Content-Disposition header, inside the quoted string.
1330
1331         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html
1332
1333         * platform/network/ResourceResponseBase.cpp:
1334         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1335
1336 2017-03-02  Youenn Fablet  <youenn@apple.com>
1337
1338         [WebRTC] Activate ICE candidate privacy policy
1339         https://bugs.webkit.org/show_bug.cgi?id=168975
1340
1341         Reviewed by Alex Christensen.
1342
1343         Test: webrtc/datachannel/filter-ice-candidate.html
1344
1345         * testing/Internals.cpp:
1346         (WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
1347         (WebCore::Internals::setICECandidateFiltering):
1348         * testing/Internals.h:
1349         * testing/Internals.idl:
1350
1351 2017-03-02  Eric Carlson  <eric.carlson@apple.com>
1352
1353         [MediaStream] UIClient may not be notified of capture state change when leaving a page
1354         https://bugs.webkit.org/show_bug.cgi?id=169014
1355         <rdar://problem/30632267>
1356
1357         Reviewed by Youenn Fablet.
1358
1359         Enable and update the WebKit API test WebKit2.UserMedia.
1360
1361         * dom/Document.cpp:
1362         (WebCore::Document::prepareForDestruction): Always call page.updateIsPlayingMedia() if there
1363         is active media in the document because it won't be possible when the state changes later
1364         because the frame will have been cleared.
1365
1366 2017-03-02  Tomas Popela  <tpopela@redhat.com>
1367
1368         [WK2] Keyboard menu key should show context menu
1369         https://bugs.webkit.org/show_bug.cgi?id=72099
1370
1371         Reviewed by Carlos Garcia Campos.
1372
1373         Show the context menu when the GtkWidget::popup-menu signal is
1374         emitted. This signal is triggered by pressing a key (usually
1375         the Menu key or the Shift + F10 shortcut) or it could be emitted on
1376         WebKitWebView.
1377
1378         Test: fast/events/context-activated-by-key-event.html
1379
1380         Also could be tested by:
1381
1382         ManualTests/keyboard-menukey-event.html
1383         ManualTests/win/contextmenu-key.html
1384         ManualTests/win/contextmenu-key2.html
1385
1386         * page/EventHandler.cpp:
1387         (WebCore::EventHandler::sendContextMenuEventForKey):
1388         Correctly send the mouse event that used for showing the context menu.
1389         Previously the event was immediately dispatched as it is, but this was
1390         only the right way if some element was focused on the page. If there
1391         was no focused element or non-empty text range then the event lacked
1392         the right node, where it was supposed to be shown. The correct node
1393         is determined and added to the event in the sendContextMenuEvent() so
1394         we have to use this function to send the event.
1395
1396         Also use absoluteBoundingBoxRect() instead of
1397         pixelSnappedAbsoluteClippedOverflowRect() when determining
1398         a coordinate where to show the context menu for the currently focus
1399         element. The latter is not returning a right box (it is bigger) which
1400         could lead to the situation that no menu will be displayed at all,
1401         because the HitTest won't contain the right element as the
1402         determined coordinates could be outside of the element.
1403         * page/EventHandler.h:
1404
1405 2017-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1406
1407         [GTK] Crash in WebCore::CoordinatedGraphicsLayer::notifyFlushRequired
1408         https://bugs.webkit.org/show_bug.cgi?id=166420
1409
1410         Reviewed by Žan Doberšek.
1411
1412         This is happening when closing a page that is being inspected. When CoordinatedGraphicsLayer::removeFromParent()
1413         is called, the coordinator has already been invalidated, so all its layers were set a nullptr coordinator. I
1414         think it's safe to simply handle m_coordinator being nullptr in notifyFlushRequired().
1415
1416         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1417         (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): Return early if the coordinator is nullptr.
1418
1419 2017-03-02  Andreas Kling  <akling@apple.com>
1420
1421         Don't keep dead resources in MemoryCache while under memory pressure.
1422         <https://webkit.org/b/169070>
1423
1424         Reviewed by Antti Koivisto.
1425
1426         Have CachedResource::deleteIfPossible() remove the resource from the MemoryCache
1427         if we're under memory pressure and that was the only thing keeping it alive.
1428
1429         This is consistent with the policy where dead resources are evicted from the cache
1430         as we come under pressure.
1431
1432         * loader/cache/CachedResource.cpp:
1433         (WebCore::CachedResource::deleteIfPossible):
1434
1435 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1436
1437         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
1438         https://bugs.webkit.org/show_bug.cgi?id=169024
1439
1440         Reviewed by Youenn Fablet.
1441
1442         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
1443         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
1444         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
1445         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
1446
1447         Fixes: http/tests/download/literal-utf-8.html
1448
1449         * platform/network/soup/ResourceResponseSoup.cpp:
1450         (WebCore::ResourceResponse::platformSuggestedFilename):
1451
1452 2017-03-01  Alex Christensen  <achristensen@webkit.org>
1453
1454         Actually fix Windows build.
1455
1456         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1457         Win32Handle is now in WTF namespace.
1458
1459 2017-03-01  Alex Christensen  <achristensen@webkit.org>
1460
1461         Fix WinCairo build after r213214
1462         https://bugs.webkit.org/show_bug.cgi?id=168908
1463
1464         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1465
1466 2017-03-01  Myles C. Maxfield  <mmaxfield@apple.com>
1467
1468         Implement font-stretch for installed fonts
1469         https://bugs.webkit.org/show_bug.cgi?id=168888
1470
1471         Reviewed by Darin Adler and Dave Hyatt.
1472
1473         This patch implements the font-stretch property. Both parsing and the implementation is
1474         implemented. Contrary to the name, this property doesn't actually stretch fonts; instead,
1475         it provides one more input to the font selection routine.
1476
1477         The mapping from Core Text's [-1, 1] width values to font-stretch's percentage-based
1478         values is not perfect. For now, I've implemented a piecewise linear curve mapping the
1479         two. However, I expect to be able to improve this transfer function soon.
1480
1481         This patch does not implement the font-stretch descriptor in @font-face, and therefore
1482         does not work with web fonts. I will add this support in
1483         https://bugs.webkit.org/show_bug.cgi?id=168892. The reason it isn't done in this patch is
1484         it requires some architectural changes to our CSSFontFace classes which are large enough
1485         they should be separated into their own patch.
1486
1487         This patch lays the groundwork for implementing the 'wdth' variation axis. It does this
1488         by adding a floating-point value to RenderStyle instead of just an enum. The font-stretch
1489         keywords get converted to these floating-point numbers in accordance with the Fonts spec.
1490         This patch doesn't actually implement the variations piece of font-stretch, because that
1491         piece also requires some architectural changes. This patch just implements the installed
1492         font selection piece.
1493
1494         This patch also fixes the regression introduced in r213163 with Helvetica Neue. Now that
1495         our font selection algorithm has a concept of font stretch, weights 800 and 900 of
1496         Helvetica Neue are rendered as expected. (And this patch updates the tests to make sure.)
1497
1498         Tests: fast/text/font-stretch-parse.html
1499                fast/text/font-stretch-shorthand.html
1500                FontCacheTest.FontLookupFromFamilyName
1501
1502         * css/CSSComputedStyleDeclaration.cpp:
1503         (WebCore::fontStretchFromStyle): Map style values to CSS keywords.
1504         (WebCore::ComputedStyleExtractor::propertyValue): Call the above function.
1505         * css/CSSFontValue.cpp:
1506         (WebCore::CSSFontValue::customCSSText): Used in getComputedStyle() for the "font"
1507         shorthand.
1508         (WebCore::CSSFontValue::equals):
1509         * css/CSSFontValue.h:
1510         * css/CSSProperties.json:
1511         * css/StyleBuilderConverter.h:
1512         (WebCore::StyleBuilderConverter::convertFontStretch): Map CSS keywords to style values.
1513         * css/StyleProperties.cpp:
1514         (WebCore::StyleProperties::appendFontLonghandValueIfExplicit): Used for
1515         Element.style.font.
1516         (WebCore::StyleProperties::fontValue):
1517         * css/parser/CSSParserFastPaths.cpp:
1518         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Now that variation fonts are being
1519         implemented, font-stretch is no longer a keyword property. Instead, it can also take a
1520         number or percentage.
1521         * css/parser/CSSPropertyParser.cpp:
1522         (WebCore::consumeFontStretch): Parse the value.
1523         (WebCore::CSSPropertyParser::parseSingleValue): Call the above function.
1524         (WebCore::CSSPropertyParser::consumeFont): Ditto.
1525         * platform/graphics/FontCache.h:
1526         (WebCore::FontDescriptionKey::FontDescriptionKey): Caches should be sensitive to this
1527         new value.
1528         (WebCore::FontDescriptionKey::operator==):
1529         (WebCore::FontDescriptionKey::computeHash):
1530         * platform/graphics/FontDescription.h:
1531         (WebCore::FontDescription::stretch): The parsed style value.
1532         (WebCore::FontDescription::setStretch):
1533         (WebCore::FontDescription::operator==):
1534         (WebCore::FontCascadeDescription::initialStretch):
1535         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1536         (WebCore::FontDatabase::InstalledFont::InstalledFont): Update the installed font selection
1537         algorithm to understand font-stretch.
1538         (WebCore::findClosestStretch):
1539         (WebCore::filterStretch):
1540         (WebCore::findClosestFont):
1541         (WebCore::platformFontLookupWithFamily):
1542         (WebCore::fontWithFamily):
1543         (WebCore::FontCache::createFontPlatformData):
1544
1545 2017-03-01  Antti Koivisto  <antti@apple.com>
1546
1547         Rename recalcStyle to resolveStyle and clean up the signature
1548         https://bugs.webkit.org/show_bug.cgi?id=169049
1549
1550         Reviewed by Sam Weinig.
1551
1552         Move to modern naming.
1553
1554         * dom/Document.cpp:
1555         (WebCore::Document::resolveStyle):
1556
1557             Only two of the possible values are used so pass in a two-value enum.
1558
1559         (WebCore::Document::updateStyleIfNeeded):
1560         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
1561         (WebCore::Document::createRenderTree):
1562         (WebCore::Document::finishedParsing):
1563         (WebCore::Document::webkitWillEnterFullScreenForElement):
1564         (WebCore::Document::recalcStyle): Deleted.
1565         * dom/Document.h:
1566         * inspector/InspectorOverlay.cpp:
1567         (WebCore::InspectorOverlay::update):
1568         * loader/DocumentWriter.cpp:
1569         (WebCore::DocumentWriter::reportDataReceived):
1570         * page/Frame.cpp:
1571         (WebCore::Frame::setPageAndTextZoomFactors):
1572         * page/Page.cpp:
1573         (WebCore::Page::setPageScaleFactor):
1574         * style/StyleTreeResolver.cpp:
1575         (WebCore::Style::TreeResolver::Parent::Parent):
1576         (WebCore::Style::TreeResolver::resolve):
1577
1578             Remove the argument, Document invalidates the document element if everything needs to be re-resolved.
1579
1580         * style/StyleTreeResolver.h:
1581
1582 2017-03-01  Alex Christensen  <achristensen@webkit.org>
1583
1584         Unreviewed, rolling out r213259.
1585
1586         Broke an internal build
1587
1588         Reverted changeset:
1589
1590         "Continue enabling WebRTC"
1591         https://bugs.webkit.org/show_bug.cgi?id=169056
1592         http://trac.webkit.org/changeset/213259
1593
1594 2017-03-01  Alex Christensen  <achristensen@webkit.org>
1595
1596         Continue enabling WebRTC
1597         https://bugs.webkit.org/show_bug.cgi?id=169056
1598
1599         Reviewed by Jon Lee.
1600
1601         * Configurations/FeatureDefines.xcconfig:
1602
1603 2017-03-01  Chris Dumez  <cdumez@apple.com>
1604
1605         [WK2][!NETWORK_SESSION] Failure to download when using a download attribute with no value on an anchor
1606         https://bugs.webkit.org/show_bug.cgi?id=169060
1607         <rdar://problem/30773140>
1608
1609         Reviewed by Darin Adler.
1610
1611         Make sure we never set the suggested filename to the empty string when
1612         the download attribute is present but has no value.
1613
1614         Test: http/tests/download/anchor-download-no-value.html
1615
1616         * loader/PolicyChecker.cpp:
1617         (WebCore::PolicyChecker::checkNavigationPolicy):
1618
1619 2017-03-01  Antoine Quint  <graouts@apple.com>
1620
1621         [ios-simulator] Unskip media/modern-media-controls/audio/audio-controls-metrics.html
1622         https://bugs.webkit.org/show_bug.cgi?id=167258
1623         <rdar://problem/30282740>
1624
1625         We weren't enforcing the min-width to be 200px as well as the default width, and the
1626         UA stylesheet would override it. Setting a default min-width that trumps the UA
1627         stylesheet makes the test work correctly on iOS and we can safely unskip this test.
1628
1629         Reviewed by Jon Lee.
1630
1631         * Modules/modern-media-controls/controls/media-controls.css:
1632         (:host(audio)):
1633
1634 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
1635
1636         Missing 'specification' section in the place-content shorthand
1637         https://bugs.webkit.org/show_bug.cgi?id=169052
1638
1639         Reviewed by Darin Adler.
1640
1641         Added 'specification' section in the place-content shorthand.
1642
1643         No new tests, no new functionality.
1644
1645         * css/CSSProperties.json:
1646
1647 2017-02-28  Matt Rajca  <mrajca@apple.com>
1648
1649         Media: notify clients when autoplayed media is muted
1650         https://bugs.webkit.org/show_bug.cgi?id=168987
1651
1652         Reviewed by Alex Christensen.
1653
1654         Added API tests.
1655
1656         * html/HTMLMediaElement.cpp:
1657         (WebCore::HTMLMediaElement::setMuted):
1658         (WebCore::HTMLMediaElement::pageMutedStateDidChange):
1659         * page/AutoplayEvent.h:
1660
1661 2017-03-01  Commit Queue  <commit-queue@webkit.org>
1662
1663         Unreviewed, rolling out r213226.
1664         https://bugs.webkit.org/show_bug.cgi?id=169051
1665
1666         Speculative rollout, might be causing several failures and
1667         crashes in WebKitGTK+ (Requested by lajava on #webkit).
1668
1669         Reverted changeset:
1670
1671         "REGRESSION(r213062): [SOUP] UTF-8 filename in Content-
1672         Disposition header incorrectly handled since r213062"
1673         https://bugs.webkit.org/show_bug.cgi?id=169024
1674         http://trac.webkit.org/changeset/213226
1675
1676 2017-03-01  James Craig  <jcraig@apple.com>
1677
1678         AX: add role aliases for ARIA DPUB module
1679         https://bugs.webkit.org/show_bug.cgi?id=168978
1680         <rdar://problem/30762724>
1681
1682         Reviewed by Chris Fleizach.
1683
1684         Added role aliases for ARIA DPUB module, and updated existing tests.
1685
1686         Test: accessibility/roles-exposed.html
1687         Test: inspector/dom/getAccessibilityPropertiesForNode.html
1688
1689         * accessibility/AccessibilityObject.cpp:
1690         (WebCore::initializeRoleMap): 
1691
1692 2017-03-01  Alex Christensen  <achristensen@webkit.org>
1693
1694         Don't call libwebrtc functions if libwebrtc.dylib doesn't exist while testing
1695         https://bugs.webkit.org/show_bug.cgi?id=169045
1696         <rdar://problem/30735413>
1697
1698         Reviewed by Youenn Fablet.
1699
1700         WebRTC tests fail instead of crashing now if libwebrtc.dylib is missing.
1701         All other tests pass instead of crashing immediately when creating an Internals object.
1702
1703         * Modules/mediastream/RTCController.cpp:
1704         (WebCore::RTCController::disableICECandidateFiltering):
1705         (WebCore::RTCController::enableICECandidateFiltering):
1706         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1707         (WebCore::createLibWebRTCPeerConnectionBackend):
1708         * testing/Internals.cpp:
1709         (WebCore::Internals::enableMockMediaEndpoint):
1710         (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
1711         (WebCore::Internals::useMockRTCPeerConnectionFactory):
1712         * testing/Internals.h:
1713
1714 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
1715
1716         [css-align] Implement the place-content shorthand
1717         https://bugs.webkit.org/show_bug.cgi?id=168771
1718
1719         Reviewed by Manuel Rego Casasnovas.
1720
1721         The CSS Box Alignment specification defines a new shorthand to set the
1722         Content Alignment properties (align-content and justify-content) at the
1723         same time.
1724
1725         This patch provides the implementation of the CSS parsing logic and the
1726         required regression tests.
1727
1728         Test: css3/parse-place-content.html
1729
1730         * css/CSSComputedStyleDeclaration.cpp:
1731         (WebCore::ComputedStyleExtractor::propertyValue):
1732         * css/CSSProperties.json:
1733         * css/StyleProperties.cpp:
1734         (WebCore::StyleProperties::getPropertyValue):
1735         * css/parser/CSSPropertyParser.cpp:
1736         (WebCore::consumeSimplifiedContentPosition):
1737         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
1738         (WebCore::CSSPropertyParser::parseShorthand):
1739         * css/parser/CSSPropertyParser.h:
1740
1741 2017-03-01  Simon Fraser  <simon.fraser@apple.com>
1742
1743         Try to fix Windows build after r213191.
1744
1745         * platform/spi/win/CoreTextSPIWin.h:
1746
1747 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1748
1749         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
1750         https://bugs.webkit.org/show_bug.cgi?id=169024
1751
1752         Reviewed by Youenn Fablet.
1753
1754         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
1755         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
1756         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
1757         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
1758
1759         Fixes: http/tests/download/literal-utf-8.html
1760
1761         * platform/network/soup/ResourceResponseSoup.cpp:
1762         (WebCore::ResourceResponse::platformSuggestedFilename):
1763
1764 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1765
1766         [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout
1767         https://bugs.webkit.org/show_bug.cgi?id=169019
1768
1769         Reviewed by Xabier Rodriguez-Calvar.
1770
1771         The timeout happens normally when the media player is deleted and the pipeline state is set to NULL. The call to
1772         gst_element_set_state() never returns because of different deadlocks with the video sink. Sometimes the deadlock
1773         happens with the sample mutex used by VideoRenderRequestScheduler. VideoRenderRequestScheduler::requestRender()
1774         calls webkitVideoSinkRepaintRequested() with the lock held, that ends up calling
1775         MediaPlayerPrivateGStreamerBase::triggerRepaint(). When rendering can't be accelerated the draw timer is
1776         scheduled and triggerRepaint blocks until the timer is fired. If the media player is destroyed before the timer
1777         is fired, when setting the pipeline state to NULL, other VideoRenderRequestScheduler methods can be called, like
1778         stop() that tries to get the sample mutex that is still held by requestRender(). So, first we need to make
1779         sure that requestRender() releases the lock before calling webkitVideoSinkRepaintRequested(). But that's not
1780         enough, we also need to ensure that the pipeline is set to NULL state after everyting has been properly
1781         stopped. This is currently done in ~MediaPlayerPrivateGStreamer that happens before
1782         ~MediaPlayerPrivateGStreamerBase, so gst_element_set_state() is hanging before allowing the
1783         MediaPlayerPrivateGStreamerBase to be cleaned up. We should move the call to the end of
1784         ~MediaPlayerPrivateGStreamerBase and ensure the draw timer and mutex are properly cleaned up before.
1785
1786         Fixes: fast/canvas/canvas-createPattern-video-loading.html
1787
1788         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1789         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Do not reset pipeline here.
1790         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1791         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Stop the draw mutex and notify the
1792         lock to ensure we unblock. Do the pipeline reset at the end.
1793         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
1794         (VideoRenderRequestScheduler::requestRender): Release the mutex lock before calling webkitVideoSinkRepaintRequested().
1795
1796 2017-03-01  Tomas Popela  <tpopela@redhat.com>
1797
1798         Unreviewed compiler warning fix after r213218
1799
1800         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1801         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
1802
1803 2017-03-01  Tomas Popela  <tpopela@redhat.com>
1804
1805         [Cairo] Incorrectly determining height in GraphicsContext::roundToDevicePixels()
1806         https://bugs.webkit.org/show_bug.cgi?id=169031
1807
1808         Reviewed by Carlos Garcia Campos.
1809
1810         We should compare if height is between -1 and 0 and not mixing height
1811         and width together.
1812
1813         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1814         (WebCore::GraphicsContext::roundToDevicePixels):
1815
1816 2017-03-01  Tomas Popela  <tpopela@redhat.com>
1817
1818         [GTK] Fix problems found by Coverity scan in platform's keyboard and mouse events
1819         https://bugs.webkit.org/show_bug.cgi?id=169028
1820
1821         Reviewed by Carlos Garcia Campos.
1822
1823         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1824         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): Initialize
1825         the m_handledByInputMethod member.
1826         * platform/gtk/PlatformMouseEventGtk.cpp:
1827         (WebCore::PlatformMouseEvent::PlatformMouseEvent): Initialize the
1828         m_modifierFlags member.
1829
1830 2017-03-01  Andreas Kling  <akling@apple.com>
1831
1832         Move MemoryPressureHandler to WTF
1833         <https://webkit.org/b/168908>
1834
1835         Reviewed by Sam Weinig.
1836
1837         * CMakeLists.txt:
1838         * PlatformMac.cmake:
1839         * PlatformWin.cmake:
1840         * WebCore.xcodeproj/project.pbxproj:
1841         * bindings/js/ScriptController.cpp:
1842         * history/PageCache.cpp:
1843         * html/HTMLMediaElement.cpp:
1844         * inspector/InspectorInstrumentation.h:
1845         * inspector/InspectorMemoryAgent.h:
1846         * page/FrameView.cpp:
1847         * page/MemoryRelease.h:
1848         * page/linux/ResourceUsageThreadLinux.cpp:
1849         * platform/Linux.cmake:
1850         * platform/graphics/FontCache.cpp:
1851         * platform/graphics/WidthCache.h:
1852         * platform/graphics/ca/TileController.cpp:
1853         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1854         * platform/ios/LegacyTileCache.mm:
1855         * platform/ios/LegacyTileGrid.mm:
1856         * platform/ios/LegacyTileLayerPool.mm:
1857         * platform/ios/TileControllerMemoryHandlerIOS.cpp:
1858         * testing/Internals.cpp:
1859
1860 2017-03-01  Per Arne Vollan  <pvollan@apple.com>
1861
1862         [Win] Popup menus are too small in HiDPI mode.
1863         https://bugs.webkit.org/show_bug.cgi?id=168965
1864
1865         Reviewed by Brent Fulgham.
1866
1867         Scale font with device scale factor.
1868
1869         * platform/win/PopupMenuWin.cpp:
1870         (WebCore::PopupMenuWin::show):
1871         (WebCore::PopupMenuWin::calculatePositionAndSize):
1872         (WebCore::PopupMenuWin::paint):
1873         * platform/win/PopupMenuWin.h:
1874
1875 2017-03-01  Joseph Pecoraro  <pecoraro@apple.com>
1876
1877         [WebRTC] Install libwebrtc.dylib inside of WebCore.framework
1878         https://bugs.webkit.org/show_bug.cgi?id=168859
1879
1880         Reviewed by Dan Bernstein.
1881
1882         * Configurations/WebCore.xcconfig:
1883         Set library search path to find the libwebrtc.dylib inside of WebCore's Frameworks
1884         or in the WK_OVERRIDE_FRAMEWORKS_DIR.
1885
1886 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
1887
1888         Addressing post-review comments on r213163
1889         https://bugs.webkit.org/show_bug.cgi?id=168678
1890
1891         Unreviewed.
1892
1893         No new tests because there is no behavior change.
1894
1895         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1896         (WebCore::platformFontLookupWithFamily):
1897
1898 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
1899
1900         Don't use the LinearGlyphMask format if accelerated drawing is disabled
1901         https://bugs.webkit.org/show_bug.cgi?id=168997
1902
1903         Reviewed by Tim Horton.
1904
1905         Non-accelerated drawing doesn't work into LinearGlyphMask-format backing store,
1906         so don't use that backing store format when accelerated drawing is disabled.
1907
1908         * platform/graphics/ca/PlatformCALayer.cpp:
1909         (WebCore::PlatformCALayer::drawRepaintIndicator):
1910         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1911         (layerContentsFormat):
1912         (PlatformCALayerCocoa::updateContentsFormat):
1913
1914 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
1915
1916         Make the repaint indicators show subpixel antialiased text indication a bit more clearly
1917         https://bugs.webkit.org/show_bug.cgi?id=168988
1918
1919         Reviewed by Tim Horton.
1920
1921         Put a more obvious stroke around the repaint count when subpixel-antialiased layer text is enabled.
1922
1923         * platform/graphics/ca/PlatformCALayer.cpp:
1924         (WebCore::PlatformCALayer::drawRepaintIndicator):
1925         (WebCore::PlatformCALayer::drawTextAtPoint):
1926         * platform/graphics/ca/PlatformCALayer.h:
1927         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1928         (PlatformCALayerWin::drawTextAtPoint):
1929         * platform/graphics/ca/win/PlatformCALayerWin.h:
1930
1931 2017-02-28  Alex Christensen  <achristensen@webkit.org>
1932
1933         LibWebRTCProvider should check existence of libwebrtc.dylib
1934         https://bugs.webkit.org/show_bug.cgi?id=168986
1935         <rdar://problem/30735413>
1936
1937         Reviewed by Youenn Fablet.
1938
1939         Some configurations of the webrtc tests overwrite the availability of WebRTC in order to test it
1940         with MockLibWebRTCPeerConnection.  If the dylib can not be found, we can't use it, so we want to
1941         fail these tests rather than crashing calling rtc::LogMessage::LogToDebug.
1942
1943         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1944         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1945         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
1946         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1947         (WebCore::LibWebRTCProvider::factory):
1948         (WebCore::LibWebRTCProvider::webRTCAvailable):
1949         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1950         * testing/MockLibWebRTCPeerConnection.cpp:
1951         (WebCore::useMockRTCPeerConnectionFactory):
1952         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
1953
1954 2017-02-28  Tim Horton  <timothy_horton@apple.com>
1955
1956         Apply a review comment that was missing in r213182
1957
1958         * loader/ios/QuickLook.mm:
1959         (WebCore::isQuickLookPreviewURL):
1960
1961 2017-02-28  Tim Horton  <timothy_horton@apple.com>
1962
1963         [iOS] Getting QLPreviewProtocol slows down first navigation in Web process
1964         https://bugs.webkit.org/show_bug.cgi?id=168940
1965         <rdar://problem/29468999>
1966
1967         Reviewed by Simon Fraser.
1968
1969         No new tests, just a performance improvement.
1970
1971         * loader/DocumentLoader.cpp:
1972         (WebCore::isRemoteWebArchive):
1973         * loader/PolicyChecker.cpp:
1974         (WebCore::PolicyChecker::checkNavigationPolicy):
1975         * loader/ResourceLoadNotifier.cpp:
1976         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
1977         Make use of isQuickLookPreviewURL.
1978
1979         * loader/ios/QuickLook.h:
1980         * loader/ios/QuickLook.mm:
1981         (WebCore::isQuickLookPreviewURL):
1982         Add isQuickLookPreviewURL, which first early-returns if the protocol
1983         of the URL is a well-known protocol, and then falls back to loading QuickLook.
1984
1985         In a microbenchmark this is a 30-40% improvement in total time spent
1986         loading an empty HTML document (wall-clock time between loadHTMLString
1987         and didFinishNavigation).
1988
1989 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
1990
1991         Add Geolocation and DeviceOrientation to features.json 
1992
1993         * features.json:
1994
1995 2017-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1996
1997         Data interaction should support attachment elements
1998         https://bugs.webkit.org/show_bug.cgi?id=168916
1999         <rdar://problem/30664519>
2000
2001         Reviewed by Ryosuke Niwa.
2002
2003         Teaches DragController to recognize and initiate dragging on attachment elements, and also adds a new
2004         convenience method to the WebItemProviderPasteboard for block enumeration of available UIItemProviders. Covered
2005         by a new API test: DataInteractionTests.AttachmentElementItemProviders.
2006
2007         * page/DragController.cpp:
2008         (WebCore::DragController::draggableElement):
2009         (WebCore::DragController::startDrag):
2010         * platform/ios/WebItemProviderPasteboard.h:
2011         * platform/ios/WebItemProviderPasteboard.mm:
2012         (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
2013
2014 2017-02-28  Mark Lam  <mark.lam@apple.com>
2015
2016         Remove setExclusiveThread() and peers from the JSLock.
2017         https://bugs.webkit.org/show_bug.cgi?id=168977
2018
2019         Reviewed by Filip Pizlo.
2020
2021         No new tests because this should already be covered by existing tests.
2022
2023         * bindings/js/CommonVM.cpp:
2024         (WebCore::commonVMSlow):
2025
2026 2017-02-28  Dave Hyatt  <hyatt@apple.com>
2027
2028         Centering text inside a button set to display flex and justify-content: center is impossible
2029         https://bugs.webkit.org/show_bug.cgi?id=148872
2030         <rdar://problem/22590086>
2031
2032         Reviewed by Simon Fraser.
2033
2034         Added new test in fast/forms.
2035
2036         * rendering/RenderButton.cpp:
2037         (WebCore::RenderButton::addChild):
2038         (WebCore::RenderButton::updateAnonymousChildStyle):
2039         (WebCore::RenderButton::styleDidChange):
2040         (WebCore::RenderButton::styleWillChange): Deleted.
2041         (WebCore::RenderButton::setupInnerStyle): Deleted.
2042         * rendering/RenderButton.h:
2043         * rendering/RenderElement.cpp:
2044         (WebCore::RenderElement::propagateStyleToAnonymousChildren):
2045         * rendering/RenderElement.h:
2046         (WebCore::RenderElement::updateAnonymousChildStyle):
2047
2048 2017-02-28  Antoine Quint  <graouts@apple.com>
2049
2050         [Modern Media Controls] Add missing compact mode assets for macOS
2051         https://bugs.webkit.org/show_bug.cgi?id=168980
2052         <rdar://problem/30763269>
2053
2054         Reviewed by Jon Lee.
2055
2056         Adding missing compact mode assets for the AirPlay, tracks, PiP and volume buttons.
2057
2058         * Modules/modern-media-controls/controls/icon-service.js:
2059         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
2060         (.media-controls.mac.inline.compact button.airplay):
2061         (.media-controls.mac.inline.compact button.pip):
2062         (.media-controls.mac.inline.compact button.tracks):
2063         * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Added.
2064         * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Added.
2065         * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Added.
2066         * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Added.
2067         * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Added.
2068         * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Added.
2069         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png:
2070         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png:
2071         * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Added.
2072         * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Added.
2073
2074 2017-02-28  Chris Dumez  <cdumez@apple.com>
2075
2076         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
2077         https://bugs.webkit.org/show_bug.cgi?id=168837
2078         <rdar://problem/30700929>
2079
2080         Reviewed by Simon Fraser.
2081
2082         Throttle requestAnimationFrame to 30fps in low power mode on iOS to save battery.
2083
2084         ScriptedAnimationController now maintains an OptionSet of throttling reasons.
2085         Throttling reasons for now are: OutsideViewport, VisuallyIdle, and LowPowerMode.
2086         The requestAnimationFrame interval is then determined based on those throttling
2087         reasons:
2088         - OutsideViewport or VisuallyIdle: 10 seconds (very aggressive throttling)
2089         - LowPowerMode: 30fps
2090         - No reasons: 60fps
2091
2092         The Page now keeps track of low power mode state using a LowPowerModeNotifier.
2093         Whenever low power mode changes, it updates the throttling reasons in all the
2094         documents' ScriptedAnimationControllers in the frame tree.
2095
2096         Tests: fast/animation/request-animation-frame-throttling-detached-iframe.html
2097                fast/animation/request-animation-frame-throttling-lowPowerMode.html
2098
2099         * dom/Document.cpp:
2100         (WebCore::Document::requestAnimationFrame):
2101         * dom/Document.h:
2102         * dom/ScriptedAnimationController.cpp:
2103         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
2104         (WebCore::throttlingReasonToString):
2105         (WebCore::throttlingReasonsToString):
2106         (WebCore::ScriptedAnimationController::addThrottlingReason):
2107         (WebCore::ScriptedAnimationController::removeThrottlingReason):
2108         (WebCore::ScriptedAnimationController::isThrottled):
2109         (WebCore::ScriptedAnimationController::interval):
2110         (WebCore::ScriptedAnimationController::page):
2111         (WebCore::ScriptedAnimationController::scheduleAnimation):
2112         * dom/ScriptedAnimationController.h:
2113         (WebCore::ScriptedAnimationController::create):
2114         * page/FrameView.cpp:
2115         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
2116         * page/Page.cpp:
2117         (WebCore::Page::Page):
2118         (WebCore::Page::isLowPowerModeEnabled):
2119         (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
2120         (WebCore::updateScriptedAnimationsThrottlingReason):
2121         (WebCore::Page::setIsVisuallyIdleInternal):
2122         (WebCore::Page::handleLowModePowerChange):
2123         * page/Page.h:
2124         * testing/Internals.cpp:
2125         (WebCore::Internals::resetToConsistentState):
2126         (WebCore::Internals::requestAnimationFrameInterval):
2127         (WebCore::Internals::setLowPowerModeEnabled):
2128         * testing/Internals.h:
2129         * testing/Internals.idl:
2130
2131 2017-02-28  Youenn Fablet  <youenn@apple.com>
2132
2133         [WebRTC] Limit libwebrtc logging in Debug build
2134         https://bugs.webkit.org/show_bug.cgi?id=168974
2135
2136         Reviewed by Alex Christensen.
2137
2138         Covered by manual testing..
2139
2140         * platform/Logging.h:
2141         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2142         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
2143
2144 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
2145
2146         [macOS] Migrate off of CTFontCreateForCSS
2147         https://bugs.webkit.org/show_bug.cgi?id=168678
2148
2149         Reviewed by David Hyatt.
2150
2151         This patch implements the Font Matching Algorithm detailed in
2152         https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
2153         Previously, this was implemented inside Core Text (via
2154         CTFontCreateForCSS()), but that implementation does not understand
2155         variation fonts. Therefore it should move to WebKit (along with
2156         the general fact that CSS algorithms should be implemented in a
2157         CSS engine, not the platform's text engine).
2158
2159         This implementation is not completely divorced from the platform,
2160         however - Core Text exposes font weights on a [-1, 1] range, but
2161         CSS operates on a [1, 999] range. In order to provide the mapping
2162         to CSS weights, Core Text infrastructure is necessary. Therefore,
2163         this new implementation of the matching algorithm is only used
2164         on certain operating systems.
2165
2166         The new implementation of the algorithm is not bug-compatible with
2167         the existing implementation; this patch does represent a behavior
2168         change. However, I have reviewed the differences manually and
2169         believe this algorithm to be a progression over the previous one
2170         (except for one case with Helvetica Neue - see
2171         LayoutTests/ChangeLog for more information about that).
2172
2173         This patch also represents a 27% performance progression on our
2174         standard page load test (just measuring the performance of the font
2175         matching algorithm, and nothing else). (Because font matching is
2176         only a small part of the entire test, the overall progression is
2177         much smaller.)
2178
2179         Tests: FontCacheTest.FontLookupFromFamilyName
2180                FontCacheTest.FontLookupFromPostScriptName
2181
2182         * platform/graphics/FontCache.h:
2183         (WebCore::FontCache::createFontPlatformDataForTesting): Allow for
2184         unit testing.
2185         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2186         (WebCore::isSystemFont): Inlined.
2187         (WebCore::FontDatabase::singleton): Cache results of Core Text
2188         lookups.
2189         (WebCore::FontDatabase::Range::Range): Because of variation fonts,
2190         fonts' weights, widths, and slopes need to be represented as a range
2191         instead of an individual value.
2192         (WebCore::FontDatabase::Range::isValid):
2193         (WebCore::FontDatabase::Range::expand):
2194         (WebCore::FontDatabase::Range::includes):
2195         (WebCore::FontDatabase::InstalledFont::InstalledFont): Represents a
2196         Font Descriptor as well as some lookup information about it.
2197         (WebCore::FontDatabase::InstalledFontCollection::InstalledFontCollection):
2198         A collection of installed fonts.
2199         (WebCore::FontDatabase::InstalledFontCollection::insertInstalledFont):
2200         Cache minima and maxima.
2201         (WebCore::FontDatabase::InstalledFontCollection::isEmpty):
2202         (WebCore::FontDatabase::InstalledFontCollection::size):
2203         (WebCore::FontDatabase::lookupFamilyName): Get all the fonts in
2204         the family.
2205         (WebCore::FontDatabase::lookupPostScriptName): Get the font with
2206         the given PostScript name.
2207         (WebCore::FontDatabase::clear):
2208         (WebCore::FontDatabase::FontDatabase): Cache.
2209         (WebCore::iterateActiveFontsWithReturn): The Font Matching Algorithm
2210         works by starting with every font in the family, and the eliminating
2211         items from the set iteratively. Instead of actually removing items
2212         from a vector or linked list, we instead want to treat the collection
2213         as immutable and keep a parallel side-table of which items have been
2214         eliminated (in order to reduce copies and allocations). This makes
2215         sense because most families only have a handful of fonts in them.
2216         This function consults with the side-table to iterate only over the
2217         fonts which have not been eliminated.
2218         (WebCore::iterateActiveFonts): Ditto.
2219         (WebCore::findClosestStretch):
2220         (WebCore::filterStretch): Eliminate fonts based on their stretch
2221         value.
2222         (WebCore::findClosestStyle):
2223         (WebCore::filterStyle): Eliminate fonts based on their style value.
2224         (WebCore::findClosestWeight):
2225         (WebCore::filterWeight): Eliminate fonts based on their weight value.
2226         (WebCore::computeTargetWeight):
2227         (WebCore::findClosestFont): If we have a set of fonts in a family,
2228         select the font in the set which best matches the criteria.
2229         (WebCore::platformFontLookupWithFamily): While findClosestFont()
2230         function satisfies the spec's notion of the font matching algorithm,
2231         WebKit actually claims to be able to look up fonts by their PostScript
2232         name. Therefore, this function has a higher-level of logic to rectify
2233         the confusion that results when the PostScript name doesn't agree with
2234         the other CSS properties (like if you say "Helvetica-Bold" but also say
2235         font-weight: 100).
2236         * platform/spi/cocoa/CoreTextSPI.h: Add signature for system CSS
2237         font weight support.
2238
2239 2017-02-24  Matt Rajca  <mrajca@apple.com>
2240
2241         Media: notify clients when autoplayed media ends without being paused
2242         https://bugs.webkit.org/show_bug.cgi?id=168852
2243
2244         Reviewed by Alex Christensen.
2245
2246         Added API tests.
2247
2248         * html/HTMLMediaElement.cpp:
2249         (WebCore::HTMLMediaElement::setReadyState):
2250          Set state accordingly if we autoplayed or if playback was prevented.
2251         (WebCore::HTMLMediaElement::play):
2252          Update state if playback was prevented.
2253         (WebCore::HTMLMediaElement::playInternal):
2254          Update state if playback began without user interaction.
2255         (WebCore::HTMLMediaElement::pauseInternal):
2256          Update state.
2257         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2258          If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
2259         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
2260         * html/HTMLMediaElement.h:
2261         * page/AutoplayEvent.h:
2262
2263 2017-02-27  Dave Hyatt  <hyatt@apple.com>
2264
2265         Update flexbox to Blink's tip of tree
2266         https://bugs.webkit.org/show_bug.cgi?id=168657
2267
2268         Reviewed by Zalan Bujtas.
2269
2270         Added new tests in css3/flexbox.
2271
2272         * CMakeLists.txt:
2273         * WebCore.xcodeproj/project.pbxproj:
2274         * css/CSSComputedStyleDeclaration.cpp:
2275         (WebCore::ComputedStyleExtractor::propertyValue):
2276         * rendering/FlexibleBoxAlgorithm.cpp: Added.
2277         (WebCore::FlexItem::FlexItem):
2278         (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm):
2279         (WebCore::FlexLayoutAlgorithm::computeNextFlexLine):
2280         * rendering/FlexibleBoxAlgorithm.h: Added.
2281         (WebCore::FlexItem::hypotheticalMainAxisMarginBoxSize):
2282         (WebCore::FlexItem::flexBaseMarginBoxSize):
2283         (WebCore::FlexItem::flexedMarginBoxSize):
2284         (WebCore::FlexLayoutAlgorithm::isMultiline):
2285         * rendering/GridTrackSizingAlgorithm.cpp:
2286         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
2287         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
2288         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
2289         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
2290         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2291         * rendering/GridTrackSizingAlgorithm.h:
2292         * rendering/OrderIterator.cpp:
2293         (WebCore::OrderIterator::next):
2294         (WebCore::OrderIterator::reset):
2295         (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator):
2296         (WebCore::OrderIteratorPopulator::collectChild):
2297         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): Deleted.
2298         (WebCore::OrderIteratorPopulator::removeDuplicatedOrderValues): Deleted.
2299         * rendering/OrderIterator.h:
2300         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator):
2301         * rendering/RenderBlock.cpp:
2302         (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout):
2303         (WebCore::RenderBlock::layoutPositionedObject):
2304         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
2305         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
2306         (WebCore::RenderBlock::hasDefiniteLogicalHeight):
2307         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
2308         * rendering/RenderBlock.h:
2309         (WebCore::RenderBlock::hasPercentHeightDescendants):
2310         * rendering/RenderBlockFlow.cpp:
2311         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
2312         * rendering/RenderBox.cpp:
2313         (WebCore::RenderBox::columnFlexItemHasStretchAlignment):
2314         (WebCore::RenderBox::isStretchingColumnFlexItem):
2315         (WebCore::RenderBox::hasStretchedLogicalWidth):
2316         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
2317         (WebCore::RenderBox::computeInlineDirectionMargins):
2318         (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem):
2319         (WebCore::RenderBox::updateLogicalHeight):
2320         (WebCore::RenderBox::computeLogicalHeightWithoutLayout):
2321         (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation):
2322         (WebCore::RenderBox::shouldTreatChildAsReplacedInTableCells):
2323         (WebCore::tableCellShouldHaveZeroInitialSize):
2324         (WebCore::RenderBox::computePercentageLogicalHeight):
2325         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
2326         (WebCore::RenderBox::availableLogicalHeightUsing):
2327         (WebCore::RenderBox::percentageLogicalHeightIsResolvable):
2328         (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
2329         (WebCore::flexItemHasStretchAlignment): Deleted.
2330         (WebCore::isStretchingColumnFlexItem): Deleted.
2331         (WebCore::logicalWidthIsResolvable): Deleted.
2332         (WebCore::RenderBox::hasDefiniteLogicalWidth): Deleted.
2333         (WebCore::percentageLogicalHeightIsResolvable): Deleted.
2334         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Deleted.
2335         (WebCore::RenderBox::hasDefiniteLogicalHeight): Deleted.
2336         * rendering/RenderBox.h:
2337         (WebCore::RenderBox::isGridItem):
2338         (WebCore::RenderBox::isFlexItem):
2339         (WebCore::RenderBox::selfAlignmentNormalBehavior):
2340         * rendering/RenderBoxModelObject.cpp:
2341         (WebCore::isOutOfFlowPositionedWithImplicitHeight):
2342         (WebCore::RenderBoxModelObject::containingBlockForAutoHeightDetection):
2343         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
2344         * rendering/RenderBoxModelObject.h:
2345         * rendering/RenderElement.cpp:
2346         (WebCore::RenderElement::removeChildInternal):
2347         * rendering/RenderFlexibleBox.cpp:
2348         (WebCore::RenderFlexibleBox::LineContext::LineContext):
2349         (WebCore::RenderFlexibleBox::RenderFlexibleBox):
2350         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
2351         (WebCore::contentAlignmentNormalBehavior):
2352         (WebCore::RenderFlexibleBox::styleDidChange):
2353         (WebCore::RenderFlexibleBox::layoutBlock):
2354         (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems):
2355         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
2356         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
2357         (WebCore::RenderFlexibleBox::flexBasisForChild):
2358         (WebCore::RenderFlexibleBox::crossAxisExtentForChild):
2359         (WebCore::RenderFlexibleBox::cachedChildIntrinsicContentLogicalHeight):
2360         (WebCore::RenderFlexibleBox::setCachedChildIntrinsicContentLogicalHeight):
2361         (WebCore::RenderFlexibleBox::clearCachedChildIntrinsicContentLogicalHeight):
2362         (WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight):
2363         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
2364         (WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
2365         (WebCore::RenderFlexibleBox::mainAxisExtentForChild):
2366         (WebCore::RenderFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar):
2367         (WebCore::RenderFlexibleBox::crossAxisExtent):
2368         (WebCore::RenderFlexibleBox::mainAxisExtent):
2369         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
2370         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
2371         (WebCore::RenderFlexibleBox::transformedWritingMode):
2372         (WebCore::RenderFlexibleBox::flowAwareMarginStartForChild):
2373         (WebCore::RenderFlexibleBox::flowAwareMarginEndForChild):
2374         (WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild):
2375         (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild):
2376         (WebCore::RenderFlexibleBox::flowAwareLocationForChild):
2377         (WebCore::RenderFlexibleBox::useChildAspectRatio):
2378         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
2379         (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild):
2380         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
2381         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
2382         (WebCore::RenderFlexibleBox::cacheChildMainSize):
2383         (WebCore::RenderFlexibleBox::clearCachedMainSizeForChild):
2384         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
2385         (WebCore::RenderFlexibleBox::layoutFlexItems):
2386         (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
2387         (WebCore::RenderFlexibleBox::updateAutoMarginsInMainAxis):
2388         (WebCore::RenderFlexibleBox::hasAutoMarginsInCrossAxis):
2389         (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild):
2390         (WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis):
2391         (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
2392         (WebCore::RenderFlexibleBox::computeChildMarginValue):
2393         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
2394         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
2395         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
2396         (WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution):
2397         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
2398         (WebCore::RenderFlexibleBox::constructFlexItem):
2399         (WebCore::RenderFlexibleBox::freezeViolations):
2400         (WebCore::RenderFlexibleBox::freezeInflexibleItems):
2401         (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
2402         (WebCore::alignmentOffset):
2403         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
2404         (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild):
2405         (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild):
2406         (WebCore::RenderFlexibleBox::staticInlinePositionForPositionedChild):
2407         (WebCore::RenderFlexibleBox::staticBlockPositionForPositionedChild):
2408         (WebCore::RenderFlexibleBox::setStaticPositionForPositionedLayout):
2409         (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout):
2410         (WebCore::RenderFlexibleBox::alignmentForChild):
2411         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
2412         (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight):
2413         (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
2414         (WebCore::RenderFlexibleBox::crossAxisOverflowForChild):
2415         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
2416         (WebCore::RenderFlexibleBox::layoutColumnReverse):
2417         (WebCore::initialAlignContentOffset):
2418         (WebCore::alignContentSpaceBetweenChildren):
2419         (WebCore::RenderFlexibleBox::alignFlexLines):
2420         (WebCore::RenderFlexibleBox::adjustAlignmentForChild):
2421         (WebCore::RenderFlexibleBox::alignChildren):
2422         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
2423         (WebCore::RenderFlexibleBox::flipForRightToLeftColumn):
2424         (WebCore::RenderFlexibleBox::flipForWrapReverse):
2425         (WebCore::RenderFlexibleBox::Violation::Violation): Deleted.
2426         (WebCore::RenderFlexibleBox::setCrossAxisExtent): Deleted.
2427         (WebCore::RenderFlexibleBox::flowAwareMarginAfterForChild): Deleted.
2428         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): Deleted.
2429         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): Deleted.
2430         (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Deleted.
2431         (WebCore::RenderFlexibleBox::computeNextFlexLine): Deleted.
2432         (WebCore::RenderFlexibleBox::setLogicalOverrideSize): Deleted.
2433         (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Deleted.
2434         (WebCore::RenderFlexibleBox::needToStretchChild): Deleted.
2435         (WebCore::contentAlignmentNormalBehaviorFlexibleBox): Deleted.
2436         * rendering/RenderFlexibleBox.h:
2437         (WebCore::RenderFlexibleBox::orderIterator):
2438         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
2439         * rendering/RenderFullScreen.h:
2440         * rendering/RenderGrid.cpp:
2441         (WebCore::selfAlignmentChangedToStretchInRowAxis):
2442         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
2443         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
2444         (WebCore::RenderGrid::styleDidChange):
2445         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
2446         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
2447         (WebCore::RenderGrid::gridGapForDirection):
2448         (WebCore::RenderGrid::guttersSize):
2449         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
2450         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
2451         (WebCore::RenderGrid::trackSizesForComputedStyle):
2452         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2453         (WebCore::RenderGrid::populateGridPositionsForDirection):
2454         (WebCore::RenderGrid::alignSelfForChild):
2455         (WebCore::RenderGrid::justifySelfForChild):
2456         (WebCore::RenderGrid::columnAxisPositionForChild):
2457         (WebCore::RenderGrid::rowAxisPositionForChild):
2458         (WebCore::RenderGrid::columnAxisOffsetForChild):
2459         (WebCore::RenderGrid::rowAxisOffsetForChild):
2460         (WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
2461         * rendering/RenderGrid.h:
2462         * rendering/RenderLayer.cpp:
2463         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
2464         * rendering/RenderListBox.cpp:
2465         (WebCore::RenderListBox::computeLogicalHeight):
2466         * rendering/RenderTable.cpp:
2467         (WebCore::RenderTable::layout):
2468         * rendering/RenderTableCell.cpp:
2469         (WebCore::RenderTableCell::layout):
2470         * rendering/RenderTableSection.cpp:
2471         (WebCore::shouldFlexCellChild):
2472         (WebCore::RenderTableSection::relayoutCellIfFlexed):
2473         (WebCore::RenderTableSection::layoutRows):
2474         * rendering/RenderTableSection.h:
2475         * rendering/RenderTextControl.cpp:
2476         (WebCore::RenderTextControl::computeLogicalHeight):
2477         * rendering/style/RenderStyle.cpp:
2478         (WebCore::resolvedSelfAlignment):
2479         (WebCore::RenderStyle::resolvedAlignSelf):
2480         (WebCore::RenderStyle::resolvedJustifySelf):
2481         * rendering/style/RenderStyle.h:
2482         * style/RenderTreeUpdater.cpp:
2483         (WebCore::textRendererIsNeeded):
2484
2485 2017-02-28  Alex Christensen  <achristensen@webkit.org>
2486
2487         Main resource requests need cachePartition
2488         https://bugs.webkit.org/show_bug.cgi?id=168806
2489         <rdar://30639764>
2490
2491         Reviewed by Brady Eidson.
2492
2493         Test: http/tests/security/credentials-main-resource.html
2494
2495         r211751 caused an unintended regression on pages whose main resource is protected
2496         by basic authentication.  We were not setting the cache partition for main resource
2497         requests, and we use the cache partition now for credentials, so the credentials for
2498         the main resource were not being put into a partition in the CredentialStorage that
2499         would not be used for subresources of the page, whose requests had the correct partition
2500         for the domain of the page.  This caused users to have to enter their credentials twice,
2501         once for the main resource and once for any subresources.  This is fixed by using the
2502         domain from the main resource request as the cache partition.  Elsewhere the Document is
2503         used to get the cache partition, but there is no Document yet when requesting the main resource.
2504
2505         * loader/DocumentLoader.cpp:
2506         (WebCore::DocumentLoader::startLoadingMainResource):
2507         Set the cache partition for the main resource loads based on the SecurityOrigin of the
2508         initial request if we are loading the main resource for a new top document.  If the main resource
2509         request is redirected, then we will still use the partition of the initial request because that is
2510         what the user requested and that is where the user entered the credentials.
2511         * loader/cache/CachedResourceLoader.h:
2512         * loader/cache/CachedResourceRequest.cpp:
2513         (WebCore::CachedResourceRequest::setDomainForCachePartition):
2514         * loader/cache/CachedResourceRequest.h:
2515
2516 2017-02-28  Alex Christensen  <achristensen@webkit.org>
2517
2518         REGRESSION: LayoutTest http/tests/security/credentials-iframes.html is failing on ios-simulator
2519         https://bugs.webkit.org/show_bug.cgi?id=167967
2520
2521         Reviewed by Brady Eidson.
2522
2523         XHR credentials have a persistence of CredentialPersistenceNone because we keep
2524         them in the WebCore::CredentialStorage.  We were storing them to CFNetwork's NSURLCredentialStorage
2525         on iOS and then they were being given as the proposedCredential in
2526         NetworkDataTaskCocoa::tryPasswordBasedAuthentication even though we set CredentialPersistenceNone.
2527
2528         This fixes http/tests/security/credentials-iframes.html
2529
2530         * platform/network/CredentialStorage.cpp:
2531         (WebCore::CredentialStorage::set):
2532         * platform/network/CredentialStorage.h:
2533         * platform/network/cf/CredentialStorageCFNet.cpp:
2534         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
2535         * platform/network/mac/CredentialStorageMac.mm:
2536         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
2537
2538 2017-02-27  Alex Christensen  <achristensen@webkit.org>
2539
2540         Fix WinCairo build.
2541
2542         * PlatformWinCairo.cmake:
2543
2544 2017-02-27  Alex Christensen  <achristensen@webkit.org>
2545
2546         Begin enabling WebRTC on 64-bit
2547         https://bugs.webkit.org/show_bug.cgi?id=168915
2548
2549         Reviewed by Eric Carlson.
2550
2551         * Configurations/FeatureDefines.xcconfig:
2552
2553 2017-02-27  Antoine Quint  <graouts@apple.com>
2554
2555         [Modern Media Controls] Use compact mode by default on macOS
2556         https://bugs.webkit.org/show_bug.cgi?id=168958
2557         <rdar://problem/30748638>
2558
2559         Reviewed by Jon Lee.
2560
2561         We now use the compact layout mode by default on macOS.
2562
2563         * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
2564         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
2565         (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
2566         the scrubber in compact mode.
2567         (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
2568         compact mode so that it's vertically aligned.
2569         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2570         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
2571         reduced padding traits since these do not apply to macOS anymore. We also notify the
2572         scrubber of a layout trait change so that it may adjust its height.
2573         * Modules/modern-media-controls/controls/scrubber.js:
2574         (Scrubber):
2575         (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
2576         compact layout traits.
2577         * Modules/modern-media-controls/controls/time-control.js:
2578         (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
2579         TimeControl visibility to match compact layout traits.
2580         * Modules/modern-media-controls/media/media-controller.js:
2581         (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
2582         on macOS and make the tight padding specific to iOS.
2583
2584 2017-02-27  Antoine Quint  <graouts@apple.com>
2585
2586         [Modern Media Controls] Adhere to tight padding on iOS
2587         https://bugs.webkit.org/show_bug.cgi?id=168949
2588         <rdar://problem/30746164>
2589
2590         Reviewed by Jon Lee.
2591
2592         We used to only support custom margins on macOS, to support this on iOS as
2593         well, we promote the notification when the layoutTraits property is set to
2594         MediaControls and expose a new protected method layoutTraitsDidChange() for
2595         subclasses to implement. IOSInlineMediaControls now implements that method
2596         and will use tighter margins for the TightPadding layout trait.
2597
2598         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html
2599
2600         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
2601         (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
2602         (IOSInlineMediaControls):
2603         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2604         (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
2605         (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
2606         (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
2607         * Modules/modern-media-controls/controls/media-controls.js:
2608         (MediaControls.prototype.get layoutTraits):
2609         (MediaControls.prototype.set layoutTraits):
2610         (MediaControls.prototype.layoutTraitsDidChange):
2611
2612 2017-02-27  Youenn Fablet  <youenn@apple.com>
2613
2614         [WebRTC] Support modern RTCStatsReport
2615         https://bugs.webkit.org/show_bug.cgi?id=166916
2616         <rdar://problem/30293780>
2617
2618         Reviewed by Alex Christensen.
2619
2620         Updating binding generator and IDL parser to handle maplike.
2621         Covered by binding tests.
2622
2623         Added support for maplike binding from JS wrapper to DOM class.
2624         The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
2625         All maplike methods are forwarded to the corresponding Map methods.
2626         The XX object is responsible to add key/value pairs using a helper routine.
2627         The creation of the Map is done at creation of the JSXX wrapper.
2628
2629         DOM class is interacting with the map through DOMMapLike.
2630         Extracted DOMGuarded from DOM promise implementation.
2631         This allows reusing this code for DOMMapLike.
2632
2633         Covered by binding tests and manual tests.
2634
2635         * CMakeLists.txt:
2636         * DerivedSources.make:
2637         * Modules/mediastream/RTCStatsReport.h:
2638         (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
2639         (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
2640         (WebCore::RTCStatsReport::create):
2641         (WebCore::RTCStatsReport::synchronizeBackingMap):
2642         (WebCore::RTCStatsReport::backingMap):
2643         (WebCore::RTCStatsReport::addStats):
2644         * Modules/mediastream/RTCStatsReport.idl:
2645         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2646         (WebCore::fromStdString):
2647         (WebCore::fillRTCStats):
2648         (WebCore::fillRTCRTPStreamStats):
2649         (WebCore::fillInboundRTPStreamStats):
2650         (WebCore::fillOutboundRTPStreamStats):
2651         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
2652         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2653         * WebCore.xcodeproj/project.pbxproj:
2654         * bindings/js/JSDOMBindingInternals.js: Added.
2655         (mapLikeForEach):
2656         * bindings/js/JSDOMGlobalObject.cpp:
2657         (WebCore::JSDOMGlobalObject::visitChildren):
2658         * bindings/js/JSDOMGlobalObject.h:
2659         * bindings/js/JSDOMGuardedObject.cpp: Added.
2660         (WebCore::DOMGuardedObject::DOMGuardedObject):
2661         (WebCore::DOMGuardedObject::~DOMGuardedObject):
2662         (WebCore::DOMGuardedObject::clear):
2663         (WebCore::DOMGuardedObject::contextDestroyed):
2664         * bindings/js/JSDOMGuardedObject.h: Added.
2665         (WebCore::DOMGuardedObject::isSuspended):
2666         (WebCore::DOMGuardedObject::visitAggregate):
2667         (WebCore::DOMGuardedObject::guardedObject):
2668         (WebCore::DOMGuardedObject::globalObject):
2669         (WebCore::DOMGuardedObject::isEmpty):
2670         (WebCore::DOMGuarded::DOMGuarded):
2671         (WebCore::DOMGuarded::guarded):
2672         * bindings/js/JSDOMMapLike.cpp: Added.
2673         (WebCore::getBackingMap):
2674         (WebCore::initializeBackingMap):
2675         (WebCore::createBackingMap):
2676         (WebCore::forwardAttributeGetterToBackingMap):
2677         (WebCore::forwardFunctionCallToBackingMap):
2678         (WebCore::forwardForEachCallToBackingMap):
2679         * bindings/js/JSDOMMapLike.h: Added.
2680         (WebCore::DOMMapLike::set):
2681         (WebCore::synchronizeBackingMap):
2682         (WebCore::forwardSizeToMapLike):
2683         (WebCore::forwardEntriesToMapLike):
2684         (WebCore::forwardKeysToMapLike):
2685         (WebCore::forwardValuesToMapLike):
2686         (WebCore::forwardClearToMapLike):
2687         (WebCore::forwardForEachToMapLike):
2688         (WebCore::forwardHasToMapLike):
2689         (WebCore::forwardAddToMapLike):
2690         (WebCore::forwardDeleteToMapLike):
2691         * bindings/js/JSDOMPromise.cpp:
2692         (WebCore::DeferredPromise::promise):
2693         (WebCore::DeferredPromise::reject):
2694         * bindings/js/JSDOMPromise.h:
2695         (WebCore::DeferredPromise::resolve):
2696         (WebCore::DeferredPromise::resolveWithNewlyCreated):
2697         (WebCore::DeferredPromise::reject):
2698         (WebCore::DeferredPromise::resolveWithCallback):
2699         (WebCore::DeferredPromise::rejectWithCallback):
2700         (WebCore::DeferredPromise::DeferredPromise):
2701         (WebCore::DeferredPromise::deferred):
2702         * bindings/js/WebCoreBuiltinNames.h:
2703         * bindings/scripts/CodeGeneratorJS.pm:
2704         (PrototypeFunctionCount):
2705         (GeneratePropertiesHashTable):
2706         (InterfaceNeedsIterator):
2707         (GenerateImplementation):
2708         (GenerateParametersCheck):
2709         * bindings/scripts/IDLParser.pm:
2710         (assert):
2711         (parseAttributeOrOperationOrIterator):
2712         (parseSerializer):
2713         (parseAttributeOrOperationRest):
2714         (parseAttribute):
2715         (parseAttributeRest):
2716         (parseOperationOrIterator):
2717         (parseOptionalIterableInterface):
2718         (parseMapLikeRest):
2719         (parseMapLikeProperties):
2720         (parseOperationRest):
2721         (applyMemberList):
2722         * bindings/scripts/test/JS/JSMapLike.cpp: Added.
2723         * bindings/scripts/test/JS/JSMapLike.h: Added.
2724         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
2725         * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
2726         * bindings/scripts/test/TestMapLike.idl: Added.
2727         * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.
2728
2729 2017-02-27  Mark Lam  <mark.lam@apple.com>
2730
2731         Introduce a VM Traps mechanism and refactor Watchdog to use it.
2732         https://bugs.webkit.org/show_bug.cgi?id=168842
2733
2734         Reviewed by Filip Pizlo.
2735
2736         No new tests needed because this is a re-implementation of existing functionality.
2737
2738         * bindings/js/WorkerScriptController.cpp:
2739         (WebCore::WorkerScriptController::WorkerScriptController):
2740         (WebCore::WorkerScriptController::scheduleExecutionTermination):
2741
2742 2017-02-27  Andy Estes  <aestes@apple.com>
2743
2744         [Cocoa] Rename FileMac.mm to FileCocoa.mm
2745         https://bugs.webkit.org/show_bug.cgi?id=168947
2746
2747         Reviewed by Zalan Bujtas.
2748
2749         * PlatformMac.cmake:
2750         * WebCore.xcodeproj/project.pbxproj:
2751         * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.
2752
2753 2017-02-27  Andy Estes  <aestes@apple.com>
2754
2755         [iOS] Enable file replacement
2756         https://bugs.webkit.org/show_bug.cgi?id=168907
2757         <rdar://problem/22258242>
2758
2759         Reviewed by David Kilzer.
2760
2761         Covered by existing tests.
2762
2763         * fileapi/FileMac.mm:
2764         (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
2765         file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.
2766
2767 2017-02-27  Antoine Quint  <graouts@apple.com>
2768
2769         [Modern Media Controls] Use a solid background for <audio> controls on macOS
2770         https://bugs.webkit.org/show_bug.cgi?id=168941
2771         <rdar://problem/30744316>
2772
2773         Reviewed by Dean Jackson.
2774
2775         Use a solid background for <audio> elements on macOS, the same way we do on iOS.
2776
2777         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html
2778
2779         * Modules/modern-media-controls/controls/macos-media-controls.css:
2780         (:host(audio) .media-controls.mac.inline > .controls-bar):
2781         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):
2782
2783 2017-02-27  Antoine Quint  <graouts@apple.com>
2784
2785         [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
2786         https://bugs.webkit.org/show_bug.cgi?id=168938
2787         <rdar://problem/30743185>
2788
2789         Reviewed by Dean Jackson.
2790
2791         Ensure we use the same styling properties for StatusLabel and TimeLabel.
2792
2793         Tests: media/modern-media-controls/status-label/status-label-ios.html
2794                media/modern-media-controls/status-label/status-label-macos.html
2795
2796         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2797         (.media-controls.ios.inline .time-label,):
2798         (.media-controls.ios.inline .time-label): Deleted.
2799         * Modules/modern-media-controls/controls/macos-media-controls.css:
2800         (.media-controls.mac > .controls-bar .time-label,):
2801         (.media-controls.mac > .controls-bar .time-label): Deleted.
2802         * Modules/modern-media-controls/controls/status-label.css:
2803         (.status-label):
2804
2805 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2806
2807         Rename ICU cursor iterator to caret iterator
2808         https://bugs.webkit.org/show_bug.cgi?id=168206
2809
2810         Reviewed by Simon Fraser.
2811
2812         Mechanical find/replace.
2813
2814         No new tests because there is no behavior change.
2815
2816         * platform/graphics/ComplexTextController.cpp:
2817         (WebCore::ComplexTextController::offsetForPosition):
2818         * rendering/RenderText.cpp:
2819         (WebCore::RenderText::previousOffset):
2820         (WebCore::RenderText::nextOffset):
2821
2822 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2823
2824         Unprefix -webkit-line-break
2825         https://bugs.webkit.org/show_bug.cgi?id=168213
2826
2827         Reviewed by Darin Adler.
2828
2829         We support the property as specced.
2830
2831         Test: fast/text/line-break-unprefixed.html
2832
2833         * css/CSSComputedStyleDeclaration.cpp:
2834         (WebCore::ComputedStyleExtractor::propertyValue):
2835         * css/CSSProperties.json:
2836         * css/parser/CSSParserFastPaths.cpp:
2837         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2838         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2839         * editing/Editor.cpp:
2840         (WebCore::Editor::applyEditingStyleToElement):
2841         * html/HTMLElement.cpp:
2842         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
2843
2844 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2845
2846         Use RAII for ICU breaking iterators
2847         https://bugs.webkit.org/show_bug.cgi?id=168203
2848
2849         Reviewed by Simon Fraser.
2850
2851         No new tests because there is no behavior change.
2852
2853         * platform/graphics/ComplexTextController.cpp:
2854         (WebCore::ComplexTextController::offsetForPosition):
2855         * rendering/RenderText.cpp:
2856         (WebCore::RenderText::previousOffset):
2857         (WebCore::RenderText::nextOffset):
2858
2859 2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
2860
2861         [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
2862         https://bugs.webkit.org/show_bug.cgi?id=168486
2863
2864         Reviewed by Alex Christensen.
2865
2866         change the order of path location search to make it possible to 
2867         configure with environment variable because bundled ca-bundle is
2868         always available now.
2869
2870         * platform/network/curl/ResourceHandleManager.cpp:
2871         (WebCore::certificatePath):
2872
2873 2017-02-27  Antoine Quint  <graouts@apple.com>
2874
2875         [Modern Media Controls] Status text does not appear on iOS
2876         https://bugs.webkit.org/show_bug.cgi?id=168918
2877         <rdar://problem/30737644>
2878
2879         Reviewed by Dean Jackson.
2880
2881         We refactor the layout code out of MacOSInlineMediaControls and into a new
2882         InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
2883         both the macOS and iOS inline media controls run the same layout logic to
2884         control whether the status label or scrubber should be displayed, and which
2885         controls should be dropped due to space constraints.
2886
2887         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html
2888
2889         * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
2890         (InlineLayoutSupport):
2891         (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
2892         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
2893         (IOSInlineMediaControls.prototype.layout):
2894         (IOSInlineMediaControls):
2895         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2896         (MacOSInlineMediaControls.prototype.layout):
2897         * Modules/modern-media-controls/js-files:
2898
2899 2017-02-27  Simon Fraser  <simon.fraser@apple.com>
2900
2901         Add specification and status metadata to CSSProperties.json, and validate it
2902         https://bugs.webkit.org/show_bug.cgi?id=168901
2903
2904         Reviewed by Darin Adler.
2905
2906         Annotate CSS properties with data about the WebKit development status, and
2907         where they are specified. A property has a canonical specification reference,
2908         but individual values may have a reference to a more recent spec.
2909
2910         Add a list of specifications to the JSON that properties reference by key.
2911
2912         Enhance check-webkit-style to validate the status and spec data.
2913
2914         * css/CSSProperties.json:
2915
2916 2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>
2917
2918         [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
2919         https://bugs.webkit.org/show_bug.cgi?id=168616
2920         <rdar://problem/30167149>
2921
2922         Reviewed by Daniel Bates.
2923
2924         This patch adds IDL definitions for:
2925         1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
2926         2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
2927         3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
2928
2929         Test: credentials/idlharness.html
2930
2931         * CMakeLists.txt:
2932         * DerivedSources.make:
2933         * Modules/credentials/BasicCredential.cpp: Added.
2934         (WebCore::BasicCredential::BasicCredential):
2935         (WebCore::BasicCredential::~BasicCredential):
2936         (WebCore::BasicCredential::type):
2937         * Modules/credentials/BasicCredential.h: Added.
2938         (WebCore::BasicCredential::id):
2939         * Modules/credentials/BasicCredential.idl: Added.
2940         * Modules/credentials/CredentialData.h: Added.
2941         * Modules/credentials/CredentialData.idl: Added.
2942         * Modules/credentials/PasswordCredential.cpp: Added.
2943         (WebCore::PasswordCredential::PasswordCredential):
2944         (WebCore::PasswordCredential::PasswordCredential):
2945         Dummy constructors for now.
2946         * Modules/credentials/PasswordCredential.h: Added.
2947         (WebCore::PasswordCredential::create):
2948         (WebCore::PasswordCredential::create):
2949         (WebCore::PasswordCredential::setIdName):
2950         (WebCore::PasswordCredential::idName):
2951         (WebCore::PasswordCredential::setPasswordName):
2952         (WebCore::PasswordCredential::passwordName):
2953         (WebCore::PasswordCredential::setAdditionalData):
2954         (WebCore::PasswordCredential::additionalData):
2955         * Modules/credentials/PasswordCredential.idl: Added.
2956         * Modules/credentials/SiteBoundCredential.cpp: Added.
2957         (WebCore::SiteBoundCredential::SiteBoundCredential):
2958         (WebCore::SiteBoundCredential::~SiteBoundCredential):
2959         * Modules/credentials/SiteBoundCredential.h: Added.
2960         (WebCore::SiteBoundCredential::name):
2961         (WebCore::SiteBoundCredential::iconURL):
2962         (WebCore::SiteBoundCredential::setOrigin):
2963         (WebCore::SiteBoundCredential::origin):
2964         * Modules/credentials/SiteBoundCredential.idl: Added.
2965         * Modules/credentials/SiteBoundCredentialData.h: Added.
2966         * Modules/credentials/SiteBoundCredentialData.idl: Added.
2967         * WebCore.xcodeproj/project.pbxproj:
2968
2969 2017-02-27  Jer Noble  <jer.noble@apple.com>
2970
2971         [WebRTC] Fix remote audio rendering
2972         https://bugs.webkit.org/show_bug.cgi?id=168898
2973
2974         Reviewed by Eric Carlson.
2975
2976         Test: webrtc/audio-peer-connection-webaudio.html
2977
2978         Fix MediaStreamAudioSourceNode by not bailing out early if the input sample rate doesn't match
2979         the AudioContext's sample rate; there's code in setFormat() to do the sample rate conversion
2980         correctly.
2981
2982         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
2983         (WebCore::MediaStreamAudioSourceNode::setFormat):
2984
2985         Fix AudioSampleBufferList by making the AudioConverter input proc a free function, and passing
2986         its refCon a struct containing only the information it needs to perform its task. Because the
2987         conversion may result in a different number of output samples than input ones, just ask to
2988         generate the entire capacity of the scratch buffer, and signal that the input buffer was fully
2989         converted with a special return value.
2990
2991         * platform/audio/mac/AudioSampleBufferList.cpp:
2992         (WebCore::audioConverterFromABLCallback):
2993         (WebCore::AudioSampleBufferList::copyFrom):
2994         (WebCore::AudioSampleBufferList::convertInput): Deleted.
2995         (WebCore::AudioSampleBufferList::audioConverterCallback): Deleted.
2996         * platform/audio/mac/AudioSampleBufferList.h:
2997
2998         Fix AudioSampleDataSource by updating both the sampleCount and the sampleTime after doing
2999         a sample rate conversion to take into account that both the number of samples may have changed,
3000         as well as the timeScale of the sampleTime. This may result in small off-by-one rounding errors
3001         due to the sample rate conversion of sampleTime, so remember what the next expected sampleTime
3002         should be, and correct sampleTime if it is indeed off-by-one. If the pull operation has gotten
3003         ahead of the push operation, delay the next pull by the empty amount by rolling back the
3004         m_outputSampleOffset. Introduce the same offset behavior during pull operations.
3005
3006         * platform/audio/mac/AudioSampleDataSource.h:
3007         * platform/audio/mac/AudioSampleDataSource.mm:
3008         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3009         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3010         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3011
3012         Fix MediaPlayerPrivateMediaStreamAVFObjC by obeying the m_muted property.
3013
3014         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3015         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume):
3016         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted):
3017
3018         Fix LibWebRTCAudioModule by sleeping for the correct amount after emitting frames. Previously,
3019         LibWebRTCAudioModule would sleep for a fixed amount of time, which meant it would get slowly out
3020         of sync when emitting frames took a non-zero amount of time. Now, the amount of time before the
3021         next cycle starts is correctly calculated, and then LibWebRTCAudioModule sleeps for a dynamic amount
3022         of time in order to wake up correctly at the beginning of the next cycle.
3023
3024         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
3025         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
3026
3027         Fix AudioTrackPrivateMediaStreamCocoa by just using the output unit's preferred format
3028         description (with the current system sample rate), rather than whatever is the current
3029         input description.
3030
3031         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3032         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
3033         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3034         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3035
3036         Fix RealtimeIncomingAudioSource by actually creating an AudioSourceProvider when asked.
3037
3038         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
3039         (WebCore::RealtimeIncomingAudioSource::OnData):
3040         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
3041         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
3042
3043         Fix RealtimeOutgoingAudioSource by using the outgoing format description rather than the
3044         incoming one to determine the sample rate, channel count, sample byte size, etc., to use
3045         when delivering data upstream to libWebRTC.
3046
3047         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3048         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3049         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
3050         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3051
3052         Fix WebAudioSourceProviderAVFObjC by using a AudioSampleDataSource to do format and sample
3053         rate conversion rather than trying to duplicate all that code and use a CARingBuffer and 
3054         AudioConverter directly.
3055
3056         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
3057         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3058         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
3059         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
3060         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
3061         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
3062         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
3063
3064         Fix the MockLibWebRTCAudioTrack by passing along the AddSink() sink to its AudioSourceInterface,
3065         allowing the RealtimeOutgoingAudioSource to push data into the libWebRTC network stack. Also,
3066         make sure m_enabled is initialized to a good value.
3067
3068         * testing/MockLibWebRTCPeerConnection.h:
3069
3070 2017-02-21  Jer Noble  <jer.noble@apple.com>
3071
3072         AudioSampleDataSource should not exclusively lock its read and write threads.
3073         https://bugs.webkit.org/show_bug.cgi?id=168646
3074
3075         Reviewed by Eric Carlson.
3076
3077         Locking the write thread causes the read thread to drop audio samples and generates audible
3078         glitches, and the realtime audio thread backing the read thread should never block. There's
3079         no real reason to lock these threads against one another here; they both rely on the
3080         CARingBuffer to safely and simultaneously read and write data.
3081
3082         * platform/audio/mac/AudioSampleDataSource.cpp:
3083         (WebCore::AudioSampleDataSource::setPaused):
3084         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3085         (WebCore::AudioSampleDataSource::pushSamples):
3086         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3087         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3088         (WebCore::AudioSampleDataSource::pullSamples):
3089         * platform/audio/mac/AudioSampleDataSource.h:
3090
3091 2017-02-21  Jer Noble  <jer.noble@apple.com>
3092
3093         AudioTrackPrivateMediaStreamCocoa should not exclusively lock its read and write threads.
3094         https://bugs.webkit.org/show_bug.cgi?id=168643
3095
3096         Reviewed by Eric Carlson.
3097
3098         Locking the write thread causes the read thread to drop audio samples and generates audible
3099         glitches, and the realtime audio thread backing the read thread should never block. There's
3100         no real reason to lock these threads against one another here; they both rely on the
3101         AudioSampleDataSource and it's CARingBuffer to safely and simultaneously read and write
3102         data.
3103
3104         The one piece which locks previously protected against unsafe access was during creation of
3105         the audio unit.  Without a lock, the audio unit could begin playback after the unit was
3106         created and assigned to m_remoteIOUnit but before the ring buffer was created. To protect
3107         against this possibility, create the unit, set the input and output descriptions, but only
3108         assign the new audio unit to m_remoteIOUnit after the ring buffer has been created and
3109         initialized.
3110
3111         * platform/audio/mac/CAAudioStreamDescription.h:
3112         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3113         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
3114         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
3115         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
3116         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
3117         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
3118         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
3119         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit): Renamed to createAudioUnit()
3120         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3121         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3122
3123 2017-02-27  Youenn Fablet  <youenn@apple.com>
3124
3125         [WebRTC] RealtimOutgoingVideoSource should not need to do image conversion
3126         https://bugs.webkit.org/show_bug.cgi?id=168802
3127
3128         Reviewed by Jon Lee.
3129
3130         Covered by manual testing as mock sources do not hit the same code path.
3131
3132         * platform/mediastream/mac/AVVideoCaptureSource.h:
3133         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3134         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
3135         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3136         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
3137         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
3138         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3139
3140 2017-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3141
3142         [GTK] Downloads attributes tests are failing
3143         https://bugs.webkit.org/show_bug.cgi?id=168871
3144
3145         Reviewed by Michael Catanzaro.
3146
3147         Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
3148         filenameFromHTTPContentDisposition().
3149
3150         Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
3151                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
3152
3153         * platform/network/soup/ResourceResponseSoup.cpp:
3154         (WebCore::ResourceResponse::platformSuggestedFilename):
3155
3156 2017-02-27  Antoine Quint  <graouts@apple.com>
3157
3158         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
3159         https://bugs.webkit.org/show_bug.cgi?id=168820
3160         <rdar://problem/30690281>
3161
3162         Reviewed by Jon Lee.
3163
3164         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
3165         event target when initiating a drag is the controls bar itself and not some of its content.
3166
3167         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
3168         starting over one of the controls and notice that no dragging occurs.
3169
3170         We also fix an issue where we wouldn't update the layout of the left container as its icon
3171         buttons would load, which would cause the layout width of the left container to be incorrect
3172         and the related tests to time out.
3173
3174         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
3175
3176         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3177         (MacOSFullscreenMediaControls.prototype.layout):
3178         (MacOSFullscreenMediaControls.prototype._handleMousedown):
3179
3180 2017-02-27  Alex Christensen  <achristensen@webkit.org>
3181
3182         [libwebrtc] Enable WebRTC in some Production Builds
3183         https://bugs.webkit.org/show_bug.cgi?id=168858
3184
3185         * Configurations/FeatureDefines.xcconfig:
3186
3187 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
3188
3189         [TextureMapper] Clean up BitmapTextureGL construction
3190         https://bugs.webkit.org/show_bug.cgi?id=168909
3191
3192         Reviewed by Carlos Garcia Campos.
3193
3194         Have the BitmapTextureGL constructor accept an rvalue reference pointer
3195         to the GraphicsContext3D object. A static create() method is also added
3196         to help with constructing these objects. Construction sites are updated
3197         appropriately.
3198
3199         The BitmapTextureGL constructor is further cleaned up by moving default
3200         member initializations together with the member declarations.
3201
3202         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3203         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
3204         * platform/graphics/texmap/BitmapTextureGL.cpp:
3205         (WebCore::BitmapTextureGL::BitmapTextureGL):
3206         * platform/graphics/texmap/BitmapTextureGL.h:
3207         * platform/graphics/texmap/BitmapTexturePool.cpp:
3208         (WebCore::BitmapTexturePool::createTexture):
3209         * platform/graphics/texmap/TextureMapperGL.cpp:
3210         (WebCore::TextureMapperGL::createTexture):
3211
3212 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
3213
3214         [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
3215         https://bugs.webkit.org/show_bug.cgi?id=168906
3216
3217         Reviewed by Carlos Garcia Campos.
3218
3219         Remove the InterpolationQuality and TextDrawingModeFlags member variables from the
3220         TextureMapper class. These weren't modified anywhere in the code.
3221
3222         BitmapTexture::updateContents() still sets the image interpolation quality and
3223         drawing mode on the ImageBuffer's GraphicsContext, but now uses the default
3224         InterpolationDefault and TextModeFill values.
3225
3226         * platform/graphics/texmap/BitmapTexture.cpp:
3227         (WebCore::BitmapTexture::updateContents):
3228         * platform/graphics/texmap/TextureMapper.cpp:
3229         (WebCore::TextureMapper::TextureMapper): Deleted.
3230         (WebCore::TextureMapper::~TextureMapper): Deleted.
3231         * platform/graphics/texmap/TextureMapper.h:
3232         (WebCore::TextureMapper::setImageInterpolationQuality): Deleted.
3233         (WebCore::TextureMapper::setTextDrawingMode): Deleted.
3234         (WebCore::TextureMapper::imageInterpolationQuality): Deleted.
3235         (WebCore::TextureMapper::textDrawingMode): Deleted.
3236
3237 2017-02-26  Zan Dobersek  <zdobersek@igalia.com>
3238
3239         [CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
3240         https://bugs.webkit.org/show_bug.cgi?id=168903
3241
3242         Reviewed by Carlos Garcia Campos.
3243
3244         Remove the GraphicsContext pointer member from the TextureMapper class
3245         since the getter and setter methods are not used anywhere.
3246
3247         * platform/graphics/texmap/TextureMapper.cpp:
3248         (WebCore::TextureMapper::TextureMapper):
3249         * platform/graphics/texmap/TextureMapper.h:
3250         (WebCore::TextureMapper::setGraphicsContext): Deleted.
3251         (WebCore::TextureMapper::graphicsContext): Deleted.
3252
3253 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
3254
3255         Stop compiling our own cursorMovementIterator()
3256         https://bugs.webkit.org/show_bug.cgi?id=168211
3257
3258         Reviewed by David Hyatt.
3259
3260         Covered by existing tests.
3261
3262         Hook up the caret iterator.
3263
3264         * platform/graphics/ComplexTextController.cpp:
3265         (WebCore::ComplexTextController::offsetForPosition):
3266         * rendering/RenderText.cpp:
3267         (WebCore::RenderText::previousOffset):
3268         (WebCore::RenderText::nextOffset):
3269         * rendering/RenderText.h:
3270
3271 2017-02-26  Commit Queue  <commit-queue@webkit.org>
3272
3273         Unreviewed, rolling out r212942.
3274         https://bugs.webkit.org/show_bug.cgi?id=168882
3275
3276         Made EWS very flaky (Requested by ap on #webkit).
3277
3278         Reverted changeset:
3279
3280         "[Modern Media Controls] Dragging controls in fullscreen on
3281         macOS prevents scrubbing or interacting with controls"
3282         https://bugs.webkit.org/show_bug.cgi?id=168820
3283         http://trac.webkit.org/changeset/212942
3284
3285 2017-02-26  Chris Dumez  <cdumez@apple.com>
3286
3287         HitTestResult's linkSuggestedFilename should sanitize download attribute
3288         https://bugs.webkit.org/show_bug.cgi?id=168856
3289         <rdar://problem/30683109>
3290
3291         Reviewed by Antti Koivisto.
3292
3293         HitTestResult's linkSuggestedFilename should sanitize download attribute.
3294         This is used by the context menu's "Download Linked File" & "Download Linked
3295         File As..." actions.
3296
3297         * rendering/HitTestResult.cpp:
3298         (WebCore::HitTestResult::linkSuggestedFilename):
3299         * rendering/HitTestResult.h:
3300
3301 2017-02-25  Zalan Bujtas  <zalan@apple.com>
3302
3303         Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
3304         https://bugs.webkit.org/show_bug.cgi?id=168872
3305         
3306         Reviewed by Simon Fraser.
3307
3308         SimpleLineLayout.cpp is for core functions only.
3309
3310         No change in functionality.
3311
3312         * CMakeLists.txt:
3313         * WebCore.xcodeproj/project.pbxproj:
3314         * rendering/RenderingAllInOne.cpp:
3315         * rendering/SimpleLineLayout.cpp:
3316         (WebCore::SimpleLineLayout::canUseForWithReason):
3317         (WebCore::SimpleLineLayout::printReason): Deleted.
3318         (WebCore::SimpleLineLayout::printReasons): Deleted.
3319         (WebCore::SimpleLineLayout::printTextForSubtree): Deleted.
3320         (WebCore::SimpleLineLayout::textLengthForSubtree): Deleted.
3321         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Deleted.
3322         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage): Deleted.
3323         (WebCore::SimpleLineLayout::toggleSimpleLineLayout): Deleted.
3324         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList): Deleted.
3325         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage): Deleted.
3326         * rendering/SimpleLineLayout.h:
3327         * rendering/SimpleLineLayoutCoverage.cpp: Added.
3328         (WebCore::SimpleLineLayout::printReason):
3329         (WebCore::SimpleLineLayout::printReasons):
3330         (WebCore::SimpleLineLayout::printTextForSubtree):
3331         (WebCore::SimpleLineLayout::textLengthForSubtree):
3332         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows):
3333         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
3334         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
3335         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList):
3336         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
3337         * rendering/SimpleLineLayoutCoverage.h: Added.
3338
3339 2017-02-25  Zalan Bujtas  <zalan@apple.com>
3340
3341         Text might wrap when its preferred logical width is used for sizing the containing block.
3342         https://bugs.webkit.org/show_bug.cgi?id=168864
3343         <rdar://problem/30690734>
3344
3345         Reviewed by Antti Koivisto.
3346
3347         In certain cases we end up measuring a text run in 2 different ways.
3348         1. preferred width computation -> slow path FontCascade::width() 
3349         2. line breaking logic -> fast path FontCascade::widthForSimpleText()
3350  
3351         FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when
3352         the individual glyph widths are measured to be the same. It's because they run diffrent set of
3353         arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point
3354         precision.
3355         Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path
3356         (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path
3357         for all runs that have been already measured using the slow path (which would be just wasteful).
3358
3359         Test: fast/text/fast-run-width-vs-slow-run-width.html
3360
3361         * platform/graphics/FontCascade.cpp:
3362         (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here.  
3363
3364 2017-02-24  Simon Fraser  <simon.fraser@apple.com>
3365
3366         Improve how multiple codegen-properties are handled in CSSProperties.json
3367         https://bugs.webkit.org/show_bug.cgi?id=168867
3368
3369         Reviewed by Zalan Bujtas.
3370
3371         To make upcoming metadata storage easier, it's better if property entries in CSSProperties.json
3372         are always hashes. One property (line-height) used an array, in order to represent settings for
3373         two different build flags (ENABLE_TEXT_AUTOSIZING and !ENABLE_TEXT_AUTOSIZING).
3374
3375         Fix by making "codegen-properties" optionally be an array. The relevant item is selected in
3376         removeInactiveCodegenProperties() and used to replace the array.
3377
3378         Sort @internalProprerties when generating code, otherwise the contents of isInternalCSSProperty()
3379         are unstable (the order in @allNames is not stable because it's the keys in a hash).
3380
3381         * css/CSSProperties.json:
3382         * css/makeprop.pl:
3383         (matchEnableFlags):
3384         (removeInactiveCodegenProperties):
3385         (isPropertyEnabled):
3386
3387 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
3388
3389         [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
3390         https://bugs.webkit.org/show_bug.cgi?id=168680
3391
3392         Reviewed by Youenn Fablet.
3393
3394         * html/HTMLMediaElement.cpp:
3395         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
3396         Pass in the element so it may be used as the initiator.
3397
3398         * html/HTMLVideoElement.h:
3399         Export create() for TestWebKitAPI to use.
3400
3401         * loader/MediaResourceLoader.cpp:
3402         (WebCore::MediaResourceLoader::MediaResourceLoader):
3403         (WebCore::MediaResourceLoader::contextDestroyed):
3404         (WebCore::MediaResourceLoader::requestResource):
3405         * loader/MediaResourceLoader.h:
3406         Include the HTMLMediaElement as the initiator.
3407
3408 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
3409
3410         [Resource Timing] Gather timing information with reliable responseEnd time
3411         https://bugs.webkit.org/show_bug.cgi?id=168351
3412
3413         Reviewed by Alex Christensen.
3414
3415         This patch replaces the unused `double finishTime` in ResourceLoader's
3416         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
3417         allows the NetworkProcess to give complete timing information, and more
3418         final metrics about the load, to WebCore. Currently this is only used
3419         by ResourceTiming, but it will soon be used by Web Inspector as well.
3420         We may also end up extending this to the didFail path as well, since it
3421         is possible that we have some metrics for load failures.
3422
3423         At the same time we want to start moving away from the legacy path that
3424         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
3425         It doesn't make sense to store this information on the ResourceResponse
3426         for a few reasons: We don't want to store the metrics in our Network Cache and
3427         not all of the load timing metrics have been populated yet (responseEnd).
3428         In an effort to move off of this data we've renamed the accessor to
3429         "deprecatedNetworkLoadMetrics". There are a few remaining clients
3430         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
3431         migrated separately from this patch.
3432
3433         Having both the legacy and new code paths adds a little bit of complexity.
3434         One advantage of the new path is that the complete load timing data
3435         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
3436         be packaged together. The legacy path could not include a responseEnd, so
3437         WebCore faked that value with its own timestamp. Having the fake responseEnd
3438         caused issues as timestamps / clocks are different between processes. In order
3439         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
3440         has the complete network timing metrics it checks isComplete(). If true
3441         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
3442         it must fallback to the legacy value from LoadTiming. Once all of the
3443         deprecatedNetworkLoadMetrics clients go away, we should always have the
3444         complete data and this can be eliminated.
3445
3446         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
3447                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
3448
3449         * PlatformMac.cmake:
3450         * WebCore.xcodeproj/project.pbxproj:
3451         Rename NetworkLoadTiming -> NetworkLoadMetrics.
3452
3453         * page/PerformanceResourceTiming.cpp:
3454         (WebCore::entryStartTime):
3455         (WebCore::entryEndTime):
3456         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
3457         (WebCore::PerformanceResourceTiming::nextHopProtocol):
3458         (WebCore::PerformanceResourceTiming::domainLookupStart):
3459         (WebCore::PerformanceResourceTiming::domainLookupEnd):
3460         (WebCore::PerformanceResourceTiming::connectStart):
3461         (WebCore::PerformanceResourceTiming::connectEnd):
3462         (WebCore::PerformanceResourceTiming::secureConnectionStart):
3463         (WebCore::PerformanceResourceTiming::requestStart):
3464         (WebCore::PerformanceResourceTiming::responseStart):
3465         (WebCore::PerformanceResourceTiming::responseEnd):
3466         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
3467         * page/PerformanceResourceTiming.h:
3468         Mostly just updating names and types. This does however need to get the
3469         correct endTime based on whether the NetworkLoadMetrics are complete
3470         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
3471
3472         * page/PerformanceResourceTiming.idl:
3473         Add nextHopProtocol.
3474
3475         * page/PerformanceTiming.cpp:
3476         (WebCore::PerformanceTiming::domainLookupStart):
3477         (WebCore::PerformanceTiming::domainLookupEnd):
3478         (WebCore::PerformanceTiming::connectStart):
3479         (WebCore::PerformanceTiming::connectEnd):
3480         (WebCore::PerformanceTiming::secureConnectionStart):
3481         (WebCore::PerformanceTiming::requestStart):
3482         (WebCore::PerformanceTiming::responseStart):
3483         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
3484         * page/PerformanceTiming.h:
3485         Navigation Timing values still uses the NetworkLoadTiming values stored on
3486         the DocumentLoader. This should be moved off of the deprecated path separately.
3487
3488         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
3489         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
3490         (WebCore::NetworkLoadMetrics::isolatedCopy):
3491         (WebCore::NetworkLoadMetrics::reset):
3492         (WebCore::NetworkLoadMetrics::operator==):
3493         (WebCore::NetworkLoadMetrics::operator!=):
3494         (WebCore::NetworkLoadMetrics::isComplete):
3495         (WebCore::NetworkLoadMetrics::markComplete):
3496         (WebCore::NetworkLoadMetrics::encode):
3497         (WebCore::NetworkLoadMetrics::decode):
3498         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
3499         Add protocolName and "complete" boolean.
3500
3501         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
3502         (WebCore::timingValue):
3503         (WebCore::copyTimingData):
3504         (WebCore::setCollectsTimingData):
3505         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
3506         Since we already have to modify all the clients this moves us to use the more
3507         strongly typed units that are less ambiguous then "double". The rest of the
3508         Performance API has already moved to these units.
3509
3510         * inspector/InspectorNetworkAgent.cpp:
3511         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
3512         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
3513         (WebCore::InspectorNetworkAgent::didFinishLoading):
3514         * inspector/InspectorNetworkAgent.h:
3515         Inspector was the only client of the finishTime, and since the value was
3516         erratically coming from clients in different ways it was almost certainly
3517         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
3518
3519         * Modules/fetch/FetchLoader.cpp:
3520         (WebCore::FetchLoader::didFinishLoading):
3521         * Modules/fetch/FetchLoader.h:
3522         * fileapi/FileReaderLoader.cpp:
3523         (WebCore::FileReaderLoader::didFinishLoading):
3524         * fileapi/FileReaderLoader.h:
3525         * html/MediaFragmentURIParser.cpp:
3526         (WebCore::MediaFragmentURIParser::parseNPTTime):
3527         * inspector/InspectorInstrumentation.cpp:
3528         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
3529         * inspector/InspectorInstrumentation.h:
3530         (WebCore::InspectorInstrumentation::didFinishLoading):
3531         * loader/CrossOriginPreflightChecker.cpp:
3532         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
3533         * loader/DocumentLoader.cpp:
3534         (WebCore::DocumentLoader::notifyFinished):
3535         (WebCore::DocumentLoader::finishedLoading):
3536         (WebCore::DocumentLoader::continueAfterContentPolicy):
3537         (WebCore::DocumentLoader::maybeLoadEmpty):
3538         * loader/DocumentLoader.h:
3539         * loader/DocumentThreadableLoader.cpp:
3540         (WebCore::DocumentThreadableLoader::didReceiveResponse):
3541         (WebCore::DocumentThreadableLoader::notifyFinished):
3542         (WebCore::DocumentThreadableLoader::didFinishLoading):
3543         (WebCore::DocumentThreadableLoader::loadRequest):
3544         * loader/DocumentThreadableLoader.h:
3545         * loader/NetscapePlugInStreamLoader.cpp:
3546         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
3547         * loader/NetscapePlugInStreamLoader.h:
3548         * loader/ResourceLoadNotifier.cpp:
3549         (WebCore::ResourceLoadNotifier::didFinishLoad):
3550         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
3551         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
3552         * loader/ResourceLoadNotifier.h:
3553         * loader/ResourceLoader.cpp:
3554         (WebCore::ResourceLoader::deliverResponseAndData):
3555         (WebCore::ResourceLoader::loadDataURL):
3556         (WebCore::ResourceLoader::didFinishLoading):
3557         (WebCore::ResourceLoader::didFinishLoadingOnePart):
3558         * loader/ResourceLoader.h:
3559         * loader/ResourceTiming.cpp:
3560         (WebCore::ResourceTiming::fromLoad):
3561         (WebCore::ResourceTiming::fromSynchronousLoad):
3562         (WebCore::ResourceTiming::ResourceTiming):
3563         (WebCore::ResourceTiming::isolatedCopy):
3564         * loader/ResourceTiming.h:
3565         (WebCore::ResourceTiming::networkLoadMetrics):
3566         (WebCore::ResourceTiming::ResourceTiming):
3567         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
3568         * loader/SubresourceLoader.cpp:
3569         (WebCore::SubresourceLoader::SubresourceLoader):
3570         (WebCore::SubresourceLoader::willSendRequestInternal):
3571         (WebCore::SubresourceLoader::didReceiveResponse):
3572         (WebCore::SubresourceLoader::didFinishLoading):
3573         (WebCore::SubresourceLoader::reportResourceTiming):
3574         * loader/SubresourceLoader.h:
3575         * loader/ThreadableLoaderClient.h:
3576         (WebCore::ThreadableLoaderClient::didFinishLoading):
3577         * loader/ThreadableLoaderClientWrapper.h:
3578         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
3579         * loader/WorkerThreadableLoader.cpp:
3580         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
3581         * loader/WorkerThreadableLoader.h:
3582         * loader/appcache/ApplicationCacheGroup.cpp:
3583         (WebCore::ApplicationCacheGroup::didFinishLoading):
3584         * loader/appcache/ApplicationCacheGroup.h:
3585         * loader/cache/CachedResource.h:
3586         (WebCore::CachedResource::setLoadFinishTime):
3587         * loader/ios/QuickLook.mm:
3588         (-[WebPreviewLoader connectionDidFinishLoading:]):
3589         * page/EventSource.cpp:
3590         (WebCore::EventSource::didFinishLoading):
3591         * page/EventSource.h:
3592         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3593         (ResourceHandleStreamingClient::didFinishLoading):
3594         * platform/network/BlobResourceHandle.cpp:
3595         (WebCore::doNotifyFinish):
3596         * platform/network/PingHandle.h:
3597         * platform/network/ResourceHandle.h:
3598         * platform/network/ResourceHandleClient.h:
3599         (WebCore::ResourceHandleClient::didFinishLoading):
3600         * platform/network/ResourceResponseBase.cpp:
3601         (WebCore::ResourceResponseBase::crossThreadData):
3602         (WebCore::ResourceResponseBase::fromCrossThreadData):
3603         (WebCore::ResourceResponseBase::compare):
3604         * platform/network/ResourceResponseBase.h:
3605         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
3606         (WebCore::ResourceResponseBase::encode):
3607         (WebCore::ResourceResponseBase::decode):
3608         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
3609         * platform/network/SynchronousLoaderClient.cpp:
3610         (WebCore::SynchronousLoaderClient::didFinishLoading):
3611         * platform/network/SynchronousLoaderClient.h:
3612         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3613         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
3614         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
3615         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
3616         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
3617         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
3618         * platform/network/curl/ResourceHandleCurl.cpp:
3619         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
3620         * platform/network/curl/ResourceHandleManager.cpp:
3621         (WebCore::calculateWebTimingInformations):
3622         (WebCore::ResourceHandleManager::downloadTimerCallback):
3623         (WebCore::handleDataURL):
3624         (WebCore::milisecondsSinceRequest): Deleted.
3625         * platform/network/mac/ResourceHandleMac.mm:
3626         (WebCore::ResourceHandle::getConnectionTimingData):
3627         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3628         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
3629         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
3630         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3631         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3632         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
3633         * platform/network/soup/ResourceHandleSoup.cpp:
3634         (WebCore::restartedCallback):
3635         (WebCore::nextMultipartResponsePartCallback):
3636         (WebCore::sendRequestCallback):
3637         (WebCore::ResourceHandle::didStartRequest):
3638         (WebCore::networkEventCallback):
3639         (WebCore::ResourceHandle::sendPendingRequest):
3640         (WebCore::readCallback):
3641         (WebCore::milisecondsSinceRequest): Deleted.
3642         * workers/WorkerScriptLoader.cpp:
3643         (WebCore::WorkerScriptLoader::didFinishLoading):
3644         * workers/WorkerScriptLoader.h:
3645         * xml/XMLHttpRequest.cpp:
3646         (WebCore::XMLHttpRequest::didFinishLoading):
3647         * xml/XMLHttpRequest.h:
3648         Eliminate the unused finishTime double.
3649
3650 2017-02-24  Chris Dumez  <cdumez@apple.com>
3651
3652         Unreviewed GTK build fix after r212965
3653
3654         * CMakeLists.txt:
3655
3656 2017-02-24  Chris Dumez  <cdumez@apple.com>
3657
3658         Unreviewed, rolling out r212944.
3659
3660         Caused a lot of failures on the debug bots
3661
3662         Reverted changeset:
3663
3664         "[Resource Timing] Gather timing information with reliable
3665         responseEnd time"
3666         https://bugs.webkit.org/show_bug.cgi?id=168351
3667         http://trac.webkit.org/changeset/212944
3668
3669 2017-02-24  Chris Dumez  <cdumez@apple.com>
3670
3671         Unreviewed, follow-up fix after r212972.
3672
3673         Fixes a few assertions on the debug build bots.
3674         URL needs to be exactly the same as the parsed one given
3675         that we are calling the ParsedURLString constructor.
3676
3677         * platform/network/ResourceResponseBase.cpp:
3678         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
3679
3680 2017-02-24  Zalan Bujtas  <zalan@apple.com>
3681
3682         Simple line layout: Re-adjust paginated lines when block height changes.
3683         https://bugs.webkit.org/show_bug.cgi?id=168838
3684         <rdar://problem/30701233>
3685
3686         Reviewed by Antti Koivisto.
3687
3688         When the estimated block height is wrong, we issue an additional layout on the inline children
3689         so that we get the pagination right (this layout is setChildNeedsLayout(MarkOnlyThis) only).
3690         Since the height change only affects the struts and page breaks (and again, the relayoutChildren flag is false)
3691         we don't need to re-layout the content, but instead we just need to re-adjust the pagination for the simple lines. 
3692         This patch also moves the pagination logic to SimpleLineLayoutPagination.cpp.
3693
3694         Not enabled yet.
3695
3696         * CMakeLists.txt:
3697         * WebCore.xcodeproj/project.pbxproj:
3698         * rendering/RenderBlockFlow.cpp:
3699         (WebCore::RenderBlockFlow::layoutSimpleLines):
3700         * rendering/RenderingAllInOne.cpp:
3701         * rendering/SimpleLineLayout.cpp:
3702         (WebCore::SimpleLineLayout::canUseForWithReason):
3703         (WebCore::SimpleLineLayout::create):
3704         (WebCore::SimpleLineLayout::Layout::create):
3705         (WebCore::SimpleLineLayout::Layout::Layout):
3706         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Deleted.
3707         (WebCore::SimpleLineLayout::computeLineBreakIndex): Deleted.
3708         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak): Deleted.
3709         (WebCore::SimpleLineLayout::setPageBreakForLine): Deleted.
3710         (WebCore::SimpleLineLayout::updateMinimumPageHeight): Deleted.
3711         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): Deleted.
3712         * rendering/SimpleLineLayout.h:
3713         (WebCore::SimpleLineLayout::Layout::setIsPaginated):
3714         (WebCore::SimpleLineLayout::Layout::setLineStruts):
3715         * rendering/SimpleLineLayoutPagination.cpp: Added.
3716         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
3717         (WebCore::SimpleLineLayout::computeLineBreakIndex):
3718         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
3719         (WebCore::SimpleLineLayout::setPageBreakForLine):
3720         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
3721         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
3722         * rendering/SimpleLineLayoutPagination.h: Added.
3723
3724 2017-02-24  Jon Lee  <jonlee@apple.com>
3725
3726         Alias "system-ui" for the System font name
3727         https://bugs.webkit.org/show_bug.cgi?id=151493
3728
3729         Reviewed by Tim Horton and Joseph Pecoraro.
3730
3731         Updated existing tests.
3732
3733         * WebCore.xcodeproj/project.pbxproj: Add WebKitFontFamilyNames.in for
3734         convenience.
3735         * css/CSSValueKeywords.in: Add system-ui as a keyword.
3736         * css/WebKitFontFamilyNames.in: Add system-ui.
3737
3738         * platform/graphics/ios/FontCacheIOS.mm:
3739         (WebCore::platformFontWithFamilySpecialCase): Include "system-ui" as an
3740         alias.
3741         * platform/graphics/mac/FontCacheMac.mm:
3742         (WebCore::platformFontWithFamilySpecialCase): Ditto.
3743
3744         * rendering/RenderThemeMac.mm:
3745         (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Update
3746         serialization to "system-ui" from "-apple-system".
3747
3748         * css/CSSComputedStyleDeclaration.cpp:
3749         (WebCore::identifierForFamily):
3750         * css/CSSFontFaceSet.cpp:
3751         (WebCore::CSSFontFaceSet::familyNameFromPrimitive):
3752         * css/StyleBuilderCustom.h:
3753         (WebCore::StyleBuilderCustom::applyValueFontFamily):
3754
3755 2017-02-24  Matt Rajca  <mrajca@apple.com>
3756
3757         Media: notify clients when autoplay is denied
3758         https://bugs.webkit.org/show_bug.cgi?id=168840
3759
3760         Reviewed by Alex Christensen.
3761
3762         Added API tests.
3763
3764         * WebCore.xcodeproj/project.pbxproj:
3765         * html/HTMLMediaElement.cpp:
3766         (WebCore::HTMLMediaElement::setReadyState):
3767         (WebCore::HTMLMediaElement::play):
3768         (WebCore::HTMLMediaElement::playInternal):
3769         * page/AutoplayEvent.h: Added.
3770         * page/ChromeClient.h:
3771
3772 2017-02-24  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
3773
3774         curl: Improve errors by including the domain
3775         https://bugs.webkit.org/show_bug.cgi?id=134340
3776
3777         Reviewed by Alex Christensen.
3778
3779         Added proper error domain to ResourceError created by
3780         Curl problem.
3781
3782         * platform/network/curl/ResourceHandleManager.cpp:
3783         (WebCore::ResourceHandleManager::downloadTimerCallback):
3784         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
3785
3786 2017-02-24  Antoine Quint  <graouts@apple.com>
3787
3788         [Modern Media Controls] <audio> controls should center in their container when the page is scaled
3789         https://bugs.webkit.org/show_bug.cgi?id=168841
3790         <rdar://problem/28612794>
3791
3792         Reviewed by Eric Carlson.
3793
3794         When dealing with <audio> elements, we vertically center the controls relative to their containing
3795         media element such that if the controls visually overflow, they overflow equally above and below
3796         to minimize the likelihood of overlap with surrounding elements.
3797
3798         Test: media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html
3799
3800         * Modules/modern-media-controls/controls/media-controls.js:
3801         (MediaControls.prototype.get shouldCenterControlsVertically):
3802         (MediaControls.prototype.set shouldCenterControlsVertically):
3803         (MediaControls.prototype.commitProperty):
3804         * Modules/modern-media-controls/media/media-controller.js:
3805         (MediaController.prototype.get isAudio):
3806         (MediaController.prototype.get layoutTraits):
3807         (MediaController.prototype._updateControlsSize):
3808
3809 2017-02-24  Alex Christensen  <achristensen@webkit.org>
3810
3811         Non-special relative URLs should not ignore extra slashes
3812         https://bugs.webkit.org/show_bug.cgi?id=168834
3813
3814         Reviewed by Sam Weinig.
3815
3816         Special authority ignore slashes state should, as its name implies,
3817         only be reached by special URLs.  See https://url.spec.whatwg.org/#relative-slash-state
3818
3819         Covered by newly passing web platform tests.
3820
3821         * platform/URLParser.cpp:
3822         (WebCore::URLParser::parse):
3823
3824 2017-02-24  Alexey Proskuryakov  <ap@apple.com>
3825
3826         Build fix for newer clang
3827         https://bugs.webkit.org/show_bug.cgi?id=168849
3828         rdar://problem/30638741
3829
3830         Reviewed by Ryosuke Niwa.
3831
3832         * dom/Range.cpp: (WebCore::Range::toString): std::max(0, <unsigned>) is not meaningful,
3833         and now triggers a warning.
3834
3835 2017-02-24  Chris Dumez  <cdumez@apple.com>
3836
3837         Download attribute should be sanitized before being used as suggested filename
3838         https://bugs.webkit.org/show_bug.cgi?id=168839
3839         <rdar://problem/30683109>
3840
3841         Reviewed by Darin Adler.
3842
3843         Sanitize Download attribute before using it as a suggested filename for the download.
3844         We rely on ResourceResponse's sanitizing of the suggested filename to do so, which has
3845         the benefit of being consistent with downloads without the download attribute.
3846
3847         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
3848                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html
3849                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
3850
3851         * html/HTMLAnchorElement.cpp:
3852         (WebCore::HTMLAnchorElement::handleClick):
3853         * platform/network/ResourceResponseBase.cpp:
3854         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
3855         * platform/network/ResourceResponseBase.h:
3856
3857 2017-02-24  Miguel Gomez  <magomez@igalia.com>
3858
3859         [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
3860         https://bugs.webkit.org/show_bug.cgi?id=165522
3861
3862         Reviewed by Carlos Garcia Campos.
3863
3864         Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
3865         in some nvidia drivers. Ensure that we set the context as current before performing
3866         that operation, and set the appropriate current context after doing so.
3867
3868         No new tests.
3869
3870         * platform/graphics/glx/GLContextGLX.cpp:
3871         (WebCore::GLContextGLX::~GLContextGLX):
3872
3873 2017-02-24  Chris Dumez  <cdumez@apple.com>
3874
3875         [iOS][WK2] Disable network cache speculative revalidation / loading in low power mode
3876         https://bugs.webkit.org/show_bug.cgi?id=168832
3877         <rdar://problem/30697911>
3878
3879         Reviewed by Antti Koivisto.
3880
3881         Add LowPowerModeNotifier class to monitor low power mode state on iOS.
3882
3883         * WebCore.xcodeproj/project.pbxproj:
3884         * platform/LowPowerModeNotifier.cpp: Added.
3885         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
3886         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
3887         * platform/LowPowerModeNotifier.h: Added.
3888         * platform/ios/LowPowerModeNotifierIOS.mm: Added.
3889         (-[WebLowPowerModeObserver initWithNotifier:]):
3890         (-[WebLowPowerModeObserver dealloc]):
3891         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
3892         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
3893         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
3894         (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
3895         (WebCore::notifyLowPowerModeChanged):
3896
3897 2017-02-24  Chris Dumez  <cdumez@apple.com>
3898
3899         [Mac] Report domains using abnormally high memory usage via enhanced privacy logging
3900         https://bugs.webkit.org/show_bug.cgi?id=168797
3901         <rdar://problem/29964017>
3902
3903         Reviewed by Andreas Kling.
3904
3905         Report domains using abnormally high memory usage (> 2GB) via enhanced privacy
3906         logging on Mac.
3907
3908         * page/DiagnosticLoggingKeys.cpp:
3909         (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey):
3910         * page/DiagnosticLoggingKeys.h:
3911         * page/PerformanceMonitor.cpp:
3912         (WebCore::reportPageOverPostLoadResourceThreshold):
3913         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
3914         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
3915         (WebCore::reportPageOverPostLoadCPUUsageThreshold): Deleted.
3916
3917 2017-02-24  Alex Christensen  <achristensen@webkit.org>
3918
3919         .. should not remove windows drive letters in paths of file URLs
3920         https://bugs.webkit.org/show_bug.cgi?id=168824
3921
3922         Reviewed by Youenn Fablet.
3923
3924         It's specified in https://url.spec.whatwg.org/#shorten-a-urls-path and helps behavior for browsers on Windows.
3925         It can't hurt to pass a few more web platform tests, though.
3926
3927         * platform/URLParser.cpp:
3928         (WebCore::URLParser::copyURLPartsUntil):
3929         (WebCore::URLParser::shouldPopPath):
3930         (WebCore::URLParser::popPath):
3931         (WebCore::URLParser::parse):
3932         * platform/URLParser.h:
3933
3934 2017-02-24  Csaba Osztrogonác  <ossy@webkit.org>
3935
3936         [Mac][cmake] Unreviewed buildfix after r212736.
3937
3938         * PlatformMac.cmake:
3939
3940 2017-02-24  John Wilander  <wilander@apple.com>
3941
3942         Resource Load Statistics: Add alternate classification method
3943         https://bugs.webkit.org/show_bug.cgi?id=168347
3944         <rdar://problem/30352793>
3945         <rdar://problem/30646710>
3946         <rdar://problem/30660708>
3947
3948         Reviewed by Alex Christensen.
3949
3950         This patch only adds test infrastructure in WebCore.
3951
3952         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
3953                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
3954                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
3955                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
3956                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
3957                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
3958                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
3959                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
3960
3961         * loader/ResourceLoadObserver.cpp:
3962         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
3963         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
3964         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
3965         * loader/ResourceLoadObserver.h:
3966
3967 2017-02-23  Antoine Quint  <