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