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