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