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