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