[iOS] Getting QLPreviewProtocol slows down first navigation in Web process
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-28  Tim Horton  <timothy_horton@apple.com>
2
3         [iOS] Getting QLPreviewProtocol slows down first navigation in Web process
4         https://bugs.webkit.org/show_bug.cgi?id=168940
5         <rdar://problem/29468999>
6
7         Reviewed by Simon Fraser.
8
9         No new tests, just a performance improvement.
10
11         * loader/DocumentLoader.cpp:
12         (WebCore::isRemoteWebArchive):
13         * loader/PolicyChecker.cpp:
14         (WebCore::PolicyChecker::checkNavigationPolicy):
15         * loader/ResourceLoadNotifier.cpp:
16         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
17         Make use of isQuickLookPreviewURL.
18
19         * loader/ios/QuickLook.h:
20         * loader/ios/QuickLook.mm:
21         (WebCore::isQuickLookPreviewURL):
22         Add isQuickLookPreviewURL, which first early-returns if the protocol
23         of the URL is a well-known protocol, and then falls back to loading QuickLook.
24
25         In a microbenchmark this is a 30-40% improvement in total time spent
26         loading an empty HTML document (wall-clock time between loadHTMLString
27         and didFinishNavigation).
28
29 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
30
31         Add Geolocation and DeviceOrientation to features.json 
32
33         * features.json:
34
35 2017-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>
36
37         Data interaction should support attachment elements
38         https://bugs.webkit.org/show_bug.cgi?id=168916
39         <rdar://problem/30664519>
40
41         Reviewed by Ryosuke Niwa.
42
43         Teaches DragController to recognize and initiate dragging on attachment elements, and also adds a new
44         convenience method to the WebItemProviderPasteboard for block enumeration of available UIItemProviders. Covered
45         by a new API test: DataInteractionTests.AttachmentElementItemProviders.
46
47         * page/DragController.cpp:
48         (WebCore::DragController::draggableElement):
49         (WebCore::DragController::startDrag):
50         * platform/ios/WebItemProviderPasteboard.h:
51         * platform/ios/WebItemProviderPasteboard.mm:
52         (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
53
54 2017-02-28  Mark Lam  <mark.lam@apple.com>
55
56         Remove setExclusiveThread() and peers from the JSLock.
57         https://bugs.webkit.org/show_bug.cgi?id=168977
58
59         Reviewed by Filip Pizlo.
60
61         No new tests because this should already be covered by existing tests.
62
63         * bindings/js/CommonVM.cpp:
64         (WebCore::commonVMSlow):
65
66 2017-02-28  Dave Hyatt  <hyatt@apple.com>
67
68         Centering text inside a button set to display flex and justify-content: center is impossible
69         https://bugs.webkit.org/show_bug.cgi?id=148872
70         <rdar://problem/22590086>
71
72         Reviewed by Simon Fraser.
73
74         Added new test in fast/forms.
75
76         * rendering/RenderButton.cpp:
77         (WebCore::RenderButton::addChild):
78         (WebCore::RenderButton::updateAnonymousChildStyle):
79         (WebCore::RenderButton::styleDidChange):
80         (WebCore::RenderButton::styleWillChange): Deleted.
81         (WebCore::RenderButton::setupInnerStyle): Deleted.
82         * rendering/RenderButton.h:
83         * rendering/RenderElement.cpp:
84         (WebCore::RenderElement::propagateStyleToAnonymousChildren):
85         * rendering/RenderElement.h:
86         (WebCore::RenderElement::updateAnonymousChildStyle):
87
88 2017-02-28  Antoine Quint  <graouts@apple.com>
89
90         [Modern Media Controls] Add missing compact mode assets for macOS
91         https://bugs.webkit.org/show_bug.cgi?id=168980
92         <rdar://problem/30763269>
93
94         Reviewed by Jon Lee.
95
96         Adding missing compact mode assets for the AirPlay, tracks, PiP and volume buttons.
97
98         * Modules/modern-media-controls/controls/icon-service.js:
99         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
100         (.media-controls.mac.inline.compact button.airplay):
101         (.media-controls.mac.inline.compact button.pip):
102         (.media-controls.mac.inline.compact button.tracks):
103         * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Added.
104         * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Added.
105         * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Added.
106         * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Added.
107         * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Added.
108         * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Added.
109         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png:
110         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png:
111         * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Added.
112         * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Added.
113
114 2017-02-28  Chris Dumez  <cdumez@apple.com>
115
116         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
117         https://bugs.webkit.org/show_bug.cgi?id=168837
118         <rdar://problem/30700929>
119
120         Reviewed by Simon Fraser.
121
122         Throttle requestAnimationFrame to 30fps in low power mode on iOS to save battery.
123
124         ScriptedAnimationController now maintains an OptionSet of throttling reasons.
125         Throttling reasons for now are: OutsideViewport, VisuallyIdle, and LowPowerMode.
126         The requestAnimationFrame interval is then determined based on those throttling
127         reasons:
128         - OutsideViewport or VisuallyIdle: 10 seconds (very aggressive throttling)
129         - LowPowerMode: 30fps
130         - No reasons: 60fps
131
132         The Page now keeps track of low power mode state using a LowPowerModeNotifier.
133         Whenever low power mode changes, it updates the throttling reasons in all the
134         documents' ScriptedAnimationControllers in the frame tree.
135
136         Tests: fast/animation/request-animation-frame-throttling-detached-iframe.html
137                fast/animation/request-animation-frame-throttling-lowPowerMode.html
138
139         * dom/Document.cpp:
140         (WebCore::Document::requestAnimationFrame):
141         * dom/Document.h:
142         * dom/ScriptedAnimationController.cpp:
143         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
144         (WebCore::throttlingReasonToString):
145         (WebCore::throttlingReasonsToString):
146         (WebCore::ScriptedAnimationController::addThrottlingReason):
147         (WebCore::ScriptedAnimationController::removeThrottlingReason):
148         (WebCore::ScriptedAnimationController::isThrottled):
149         (WebCore::ScriptedAnimationController::interval):
150         (WebCore::ScriptedAnimationController::page):
151         (WebCore::ScriptedAnimationController::scheduleAnimation):
152         * dom/ScriptedAnimationController.h:
153         (WebCore::ScriptedAnimationController::create):
154         * page/FrameView.cpp:
155         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
156         * page/Page.cpp:
157         (WebCore::Page::Page):
158         (WebCore::Page::isLowPowerModeEnabled):
159         (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
160         (WebCore::updateScriptedAnimationsThrottlingReason):
161         (WebCore::Page::setIsVisuallyIdleInternal):
162         (WebCore::Page::handleLowModePowerChange):
163         * page/Page.h:
164         * testing/Internals.cpp:
165         (WebCore::Internals::resetToConsistentState):
166         (WebCore::Internals::requestAnimationFrameInterval):
167         (WebCore::Internals::setLowPowerModeEnabled):
168         * testing/Internals.h:
169         * testing/Internals.idl:
170
171 2017-02-28  Youenn Fablet  <youenn@apple.com>
172
173         [WebRTC] Limit libwebrtc logging in Debug build
174         https://bugs.webkit.org/show_bug.cgi?id=168974
175
176         Reviewed by Alex Christensen.
177
178         Covered by manual testing..
179
180         * platform/Logging.h:
181         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
182         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
183
184 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
185
186         [macOS] Migrate off of CTFontCreateForCSS
187         https://bugs.webkit.org/show_bug.cgi?id=168678
188
189         Reviewed by David Hyatt.
190
191         This patch implements the Font Matching Algorithm detailed in
192         https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
193         Previously, this was implemented inside Core Text (via
194         CTFontCreateForCSS()), but that implementation does not understand
195         variation fonts. Therefore it should move to WebKit (along with
196         the general fact that CSS algorithms should be implemented in a
197         CSS engine, not the platform's text engine).
198
199         This implementation is not completely divorced from the platform,
200         however - Core Text exposes font weights on a [-1, 1] range, but
201         CSS operates on a [1, 999] range. In order to provide the mapping
202         to CSS weights, Core Text infrastructure is necessary. Therefore,
203         this new implementation of the matching algorithm is only used
204         on certain operating systems.
205
206         The new implementation of the algorithm is not bug-compatible with
207         the existing implementation; this patch does represent a behavior
208         change. However, I have reviewed the differences manually and
209         believe this algorithm to be a progression over the previous one
210         (except for one case with Helvetica Neue - see
211         LayoutTests/ChangeLog for more information about that).
212
213         This patch also represents a 27% performance progression on our
214         standard page load test (just measuring the performance of the font
215         matching algorithm, and nothing else). (Because font matching is
216         only a small part of the entire test, the overall progression is
217         much smaller.)
218
219         Tests: FontCacheTest.FontLookupFromFamilyName
220                FontCacheTest.FontLookupFromPostScriptName
221
222         * platform/graphics/FontCache.h:
223         (WebCore::FontCache::createFontPlatformDataForTesting): Allow for
224         unit testing.
225         * platform/graphics/cocoa/FontCacheCoreText.cpp:
226         (WebCore::isSystemFont): Inlined.
227         (WebCore::FontDatabase::singleton): Cache results of Core Text
228         lookups.
229         (WebCore::FontDatabase::Range::Range): Because of variation fonts,
230         fonts' weights, widths, and slopes need to be represented as a range
231         instead of an individual value.
232         (WebCore::FontDatabase::Range::isValid):
233         (WebCore::FontDatabase::Range::expand):
234         (WebCore::FontDatabase::Range::includes):
235         (WebCore::FontDatabase::InstalledFont::InstalledFont): Represents a
236         Font Descriptor as well as some lookup information about it.
237         (WebCore::FontDatabase::InstalledFontCollection::InstalledFontCollection):
238         A collection of installed fonts.
239         (WebCore::FontDatabase::InstalledFontCollection::insertInstalledFont):
240         Cache minima and maxima.
241         (WebCore::FontDatabase::InstalledFontCollection::isEmpty):
242         (WebCore::FontDatabase::InstalledFontCollection::size):
243         (WebCore::FontDatabase::lookupFamilyName): Get all the fonts in
244         the family.
245         (WebCore::FontDatabase::lookupPostScriptName): Get the font with
246         the given PostScript name.
247         (WebCore::FontDatabase::clear):
248         (WebCore::FontDatabase::FontDatabase): Cache.
249         (WebCore::iterateActiveFontsWithReturn): The Font Matching Algorithm
250         works by starting with every font in the family, and the eliminating
251         items from the set iteratively. Instead of actually removing items
252         from a vector or linked list, we instead want to treat the collection
253         as immutable and keep a parallel side-table of which items have been
254         eliminated (in order to reduce copies and allocations). This makes
255         sense because most families only have a handful of fonts in them.
256         This function consults with the side-table to iterate only over the
257         fonts which have not been eliminated.
258         (WebCore::iterateActiveFonts): Ditto.
259         (WebCore::findClosestStretch):
260         (WebCore::filterStretch): Eliminate fonts based on their stretch
261         value.
262         (WebCore::findClosestStyle):
263         (WebCore::filterStyle): Eliminate fonts based on their style value.
264         (WebCore::findClosestWeight):
265         (WebCore::filterWeight): Eliminate fonts based on their weight value.
266         (WebCore::computeTargetWeight):
267         (WebCore::findClosestFont): If we have a set of fonts in a family,
268         select the font in the set which best matches the criteria.
269         (WebCore::platformFontLookupWithFamily): While findClosestFont()
270         function satisfies the spec's notion of the font matching algorithm,
271         WebKit actually claims to be able to look up fonts by their PostScript
272         name. Therefore, this function has a higher-level of logic to rectify
273         the confusion that results when the PostScript name doesn't agree with
274         the other CSS properties (like if you say "Helvetica-Bold" but also say
275         font-weight: 100).
276         * platform/spi/cocoa/CoreTextSPI.h: Add signature for system CSS
277         font weight support.
278
279 2017-02-24  Matt Rajca  <mrajca@apple.com>
280
281         Media: notify clients when autoplayed media ends without being paused
282         https://bugs.webkit.org/show_bug.cgi?id=168852
283
284         Reviewed by Alex Christensen.
285
286         Added API tests.
287
288         * html/HTMLMediaElement.cpp:
289         (WebCore::HTMLMediaElement::setReadyState):
290          Set state accordingly if we autoplayed or if playback was prevented.
291         (WebCore::HTMLMediaElement::play):
292          Update state if playback was prevented.
293         (WebCore::HTMLMediaElement::playInternal):
294          Update state if playback began without user interaction.
295         (WebCore::HTMLMediaElement::pauseInternal):
296          Update state.
297         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
298          If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
299         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
300         * html/HTMLMediaElement.h:
301         * page/AutoplayEvent.h:
302
303 2017-02-27  Dave Hyatt  <hyatt@apple.com>
304
305         Update flexbox to Blink's tip of tree
306         https://bugs.webkit.org/show_bug.cgi?id=168657
307
308         Reviewed by Zalan Bujtas.
309
310         Added new tests in css3/flexbox.
311
312         * CMakeLists.txt:
313         * WebCore.xcodeproj/project.pbxproj:
314         * css/CSSComputedStyleDeclaration.cpp:
315         (WebCore::ComputedStyleExtractor::propertyValue):
316         * rendering/FlexibleBoxAlgorithm.cpp: Added.
317         (WebCore::FlexItem::FlexItem):
318         (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm):
319         (WebCore::FlexLayoutAlgorithm::computeNextFlexLine):
320         * rendering/FlexibleBoxAlgorithm.h: Added.
321         (WebCore::FlexItem::hypotheticalMainAxisMarginBoxSize):
322         (WebCore::FlexItem::flexBaseMarginBoxSize):
323         (WebCore::FlexItem::flexedMarginBoxSize):
324         (WebCore::FlexLayoutAlgorithm::isMultiline):
325         * rendering/GridTrackSizingAlgorithm.cpp:
326         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
327         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
328         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
329         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
330         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
331         * rendering/GridTrackSizingAlgorithm.h:
332         * rendering/OrderIterator.cpp:
333         (WebCore::OrderIterator::next):
334         (WebCore::OrderIterator::reset):
335         (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator):
336         (WebCore::OrderIteratorPopulator::collectChild):
337         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): Deleted.
338         (WebCore::OrderIteratorPopulator::removeDuplicatedOrderValues): Deleted.
339         * rendering/OrderIterator.h:
340         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator):
341         * rendering/RenderBlock.cpp:
342         (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout):
343         (WebCore::RenderBlock::layoutPositionedObject):
344         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
345         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
346         (WebCore::RenderBlock::hasDefiniteLogicalHeight):
347         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
348         * rendering/RenderBlock.h:
349         (WebCore::RenderBlock::hasPercentHeightDescendants):
350         * rendering/RenderBlockFlow.cpp:
351         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
352         * rendering/RenderBox.cpp:
353         (WebCore::RenderBox::columnFlexItemHasStretchAlignment):
354         (WebCore::RenderBox::isStretchingColumnFlexItem):
355         (WebCore::RenderBox::hasStretchedLogicalWidth):
356         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
357         (WebCore::RenderBox::computeInlineDirectionMargins):
358         (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem):
359         (WebCore::RenderBox::updateLogicalHeight):
360         (WebCore::RenderBox::computeLogicalHeightWithoutLayout):
361         (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation):
362         (WebCore::RenderBox::shouldTreatChildAsReplacedInTableCells):
363         (WebCore::tableCellShouldHaveZeroInitialSize):
364         (WebCore::RenderBox::computePercentageLogicalHeight):
365         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
366         (WebCore::RenderBox::availableLogicalHeightUsing):
367         (WebCore::RenderBox::percentageLogicalHeightIsResolvable):
368         (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
369         (WebCore::flexItemHasStretchAlignment): Deleted.
370         (WebCore::isStretchingColumnFlexItem): Deleted.
371         (WebCore::logicalWidthIsResolvable): Deleted.
372         (WebCore::RenderBox::hasDefiniteLogicalWidth): Deleted.
373         (WebCore::percentageLogicalHeightIsResolvable): Deleted.
374         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Deleted.
375         (WebCore::RenderBox::hasDefiniteLogicalHeight): Deleted.
376         * rendering/RenderBox.h:
377         (WebCore::RenderBox::isGridItem):
378         (WebCore::RenderBox::isFlexItem):
379         (WebCore::RenderBox::selfAlignmentNormalBehavior):
380         * rendering/RenderBoxModelObject.cpp:
381         (WebCore::isOutOfFlowPositionedWithImplicitHeight):
382         (WebCore::RenderBoxModelObject::containingBlockForAutoHeightDetection):
383         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
384         * rendering/RenderBoxModelObject.h:
385         * rendering/RenderElement.cpp:
386         (WebCore::RenderElement::removeChildInternal):
387         * rendering/RenderFlexibleBox.cpp:
388         (WebCore::RenderFlexibleBox::LineContext::LineContext):
389         (WebCore::RenderFlexibleBox::RenderFlexibleBox):
390         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
391         (WebCore::contentAlignmentNormalBehavior):
392         (WebCore::RenderFlexibleBox::styleDidChange):
393         (WebCore::RenderFlexibleBox::layoutBlock):
394         (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems):
395         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
396         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
397         (WebCore::RenderFlexibleBox::flexBasisForChild):
398         (WebCore::RenderFlexibleBox::crossAxisExtentForChild):
399         (WebCore::RenderFlexibleBox::cachedChildIntrinsicContentLogicalHeight):
400         (WebCore::RenderFlexibleBox::setCachedChildIntrinsicContentLogicalHeight):
401         (WebCore::RenderFlexibleBox::clearCachedChildIntrinsicContentLogicalHeight):
402         (WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight):
403         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
404         (WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
405         (WebCore::RenderFlexibleBox::mainAxisExtentForChild):
406         (WebCore::RenderFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar):
407         (WebCore::RenderFlexibleBox::crossAxisExtent):
408         (WebCore::RenderFlexibleBox::mainAxisExtent):
409         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
410         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
411         (WebCore::RenderFlexibleBox::transformedWritingMode):
412         (WebCore::RenderFlexibleBox::flowAwareMarginStartForChild):
413         (WebCore::RenderFlexibleBox::flowAwareMarginEndForChild):
414         (WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild):
415         (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild):
416         (WebCore::RenderFlexibleBox::flowAwareLocationForChild):
417         (WebCore::RenderFlexibleBox::useChildAspectRatio):
418         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
419         (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild):
420         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
421         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
422         (WebCore::RenderFlexibleBox::cacheChildMainSize):
423         (WebCore::RenderFlexibleBox::clearCachedMainSizeForChild):
424         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
425         (WebCore::RenderFlexibleBox::layoutFlexItems):
426         (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
427         (WebCore::RenderFlexibleBox::updateAutoMarginsInMainAxis):
428         (WebCore::RenderFlexibleBox::hasAutoMarginsInCrossAxis):
429         (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild):
430         (WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis):
431         (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
432         (WebCore::RenderFlexibleBox::computeChildMarginValue):
433         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
434         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
435         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
436         (WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution):
437         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
438         (WebCore::RenderFlexibleBox::constructFlexItem):
439         (WebCore::RenderFlexibleBox::freezeViolations):
440         (WebCore::RenderFlexibleBox::freezeInflexibleItems):
441         (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
442         (WebCore::alignmentOffset):
443         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
444         (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild):
445         (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild):
446         (WebCore::RenderFlexibleBox::staticInlinePositionForPositionedChild):
447         (WebCore::RenderFlexibleBox::staticBlockPositionForPositionedChild):
448         (WebCore::RenderFlexibleBox::setStaticPositionForPositionedLayout):
449         (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout):
450         (WebCore::RenderFlexibleBox::alignmentForChild):
451         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
452         (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight):
453         (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
454         (WebCore::RenderFlexibleBox::crossAxisOverflowForChild):
455         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
456         (WebCore::RenderFlexibleBox::layoutColumnReverse):
457         (WebCore::initialAlignContentOffset):
458         (WebCore::alignContentSpaceBetweenChildren):
459         (WebCore::RenderFlexibleBox::alignFlexLines):
460         (WebCore::RenderFlexibleBox::adjustAlignmentForChild):
461         (WebCore::RenderFlexibleBox::alignChildren):
462         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
463         (WebCore::RenderFlexibleBox::flipForRightToLeftColumn):
464         (WebCore::RenderFlexibleBox::flipForWrapReverse):
465         (WebCore::RenderFlexibleBox::Violation::Violation): Deleted.
466         (WebCore::RenderFlexibleBox::setCrossAxisExtent): Deleted.
467         (WebCore::RenderFlexibleBox::flowAwareMarginAfterForChild): Deleted.
468         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): Deleted.
469         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): Deleted.
470         (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Deleted.
471         (WebCore::RenderFlexibleBox::computeNextFlexLine): Deleted.
472         (WebCore::RenderFlexibleBox::setLogicalOverrideSize): Deleted.
473         (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Deleted.
474         (WebCore::RenderFlexibleBox::needToStretchChild): Deleted.
475         (WebCore::contentAlignmentNormalBehaviorFlexibleBox): Deleted.
476         * rendering/RenderFlexibleBox.h:
477         (WebCore::RenderFlexibleBox::orderIterator):
478         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
479         * rendering/RenderFullScreen.h:
480         * rendering/RenderGrid.cpp:
481         (WebCore::selfAlignmentChangedToStretchInRowAxis):
482         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
483         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
484         (WebCore::RenderGrid::styleDidChange):
485         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
486         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
487         (WebCore::RenderGrid::gridGapForDirection):
488         (WebCore::RenderGrid::guttersSize):
489         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
490         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
491         (WebCore::RenderGrid::trackSizesForComputedStyle):
492         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
493         (WebCore::RenderGrid::populateGridPositionsForDirection):
494         (WebCore::RenderGrid::alignSelfForChild):
495         (WebCore::RenderGrid::justifySelfForChild):
496         (WebCore::RenderGrid::columnAxisPositionForChild):
497         (WebCore::RenderGrid::rowAxisPositionForChild):
498         (WebCore::RenderGrid::columnAxisOffsetForChild):
499         (WebCore::RenderGrid::rowAxisOffsetForChild):
500         (WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
501         * rendering/RenderGrid.h:
502         * rendering/RenderLayer.cpp:
503         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
504         * rendering/RenderListBox.cpp:
505         (WebCore::RenderListBox::computeLogicalHeight):
506         * rendering/RenderTable.cpp:
507         (WebCore::RenderTable::layout):
508         * rendering/RenderTableCell.cpp:
509         (WebCore::RenderTableCell::layout):
510         * rendering/RenderTableSection.cpp:
511         (WebCore::shouldFlexCellChild):
512         (WebCore::RenderTableSection::relayoutCellIfFlexed):
513         (WebCore::RenderTableSection::layoutRows):
514         * rendering/RenderTableSection.h:
515         * rendering/RenderTextControl.cpp:
516         (WebCore::RenderTextControl::computeLogicalHeight):
517         * rendering/style/RenderStyle.cpp:
518         (WebCore::resolvedSelfAlignment):
519         (WebCore::RenderStyle::resolvedAlignSelf):
520         (WebCore::RenderStyle::resolvedJustifySelf):
521         * rendering/style/RenderStyle.h:
522         * style/RenderTreeUpdater.cpp:
523         (WebCore::textRendererIsNeeded):
524
525 2017-02-28  Alex Christensen  <achristensen@webkit.org>
526
527         Main resource requests need cachePartition
528         https://bugs.webkit.org/show_bug.cgi?id=168806
529         <rdar://30639764>
530
531         Reviewed by Brady Eidson.
532
533         Test: http/tests/security/credentials-main-resource.html
534
535         r211751 caused an unintended regression on pages whose main resource is protected
536         by basic authentication.  We were not setting the cache partition for main resource
537         requests, and we use the cache partition now for credentials, so the credentials for
538         the main resource were not being put into a partition in the CredentialStorage that
539         would not be used for subresources of the page, whose requests had the correct partition
540         for the domain of the page.  This caused users to have to enter their credentials twice,
541         once for the main resource and once for any subresources.  This is fixed by using the
542         domain from the main resource request as the cache partition.  Elsewhere the Document is
543         used to get the cache partition, but there is no Document yet when requesting the main resource.
544
545         * loader/DocumentLoader.cpp:
546         (WebCore::DocumentLoader::startLoadingMainResource):
547         Set the cache partition for the main resource loads based on the SecurityOrigin of the
548         initial request if we are loading the main resource for a new top document.  If the main resource
549         request is redirected, then we will still use the partition of the initial request because that is
550         what the user requested and that is where the user entered the credentials.
551         * loader/cache/CachedResourceLoader.h:
552         * loader/cache/CachedResourceRequest.cpp:
553         (WebCore::CachedResourceRequest::setDomainForCachePartition):
554         * loader/cache/CachedResourceRequest.h:
555
556 2017-02-28  Alex Christensen  <achristensen@webkit.org>
557
558         REGRESSION: LayoutTest http/tests/security/credentials-iframes.html is failing on ios-simulator
559         https://bugs.webkit.org/show_bug.cgi?id=167967
560
561         Reviewed by Brady Eidson.
562
563         XHR credentials have a persistence of CredentialPersistenceNone because we keep
564         them in the WebCore::CredentialStorage.  We were storing them to CFNetwork's NSURLCredentialStorage
565         on iOS and then they were being given as the proposedCredential in
566         NetworkDataTaskCocoa::tryPasswordBasedAuthentication even though we set CredentialPersistenceNone.
567
568         This fixes http/tests/security/credentials-iframes.html
569
570         * platform/network/CredentialStorage.cpp:
571         (WebCore::CredentialStorage::set):
572         * platform/network/CredentialStorage.h:
573         * platform/network/cf/CredentialStorageCFNet.cpp:
574         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
575         * platform/network/mac/CredentialStorageMac.mm:
576         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
577
578 2017-02-27  Alex Christensen  <achristensen@webkit.org>
579
580         Fix WinCairo build.
581
582         * PlatformWinCairo.cmake:
583
584 2017-02-27  Alex Christensen  <achristensen@webkit.org>
585
586         Begin enabling WebRTC on 64-bit
587         https://bugs.webkit.org/show_bug.cgi?id=168915
588
589         Reviewed by Eric Carlson.
590
591         * Configurations/FeatureDefines.xcconfig:
592
593 2017-02-27  Antoine Quint  <graouts@apple.com>
594
595         [Modern Media Controls] Use compact mode by default on macOS
596         https://bugs.webkit.org/show_bug.cgi?id=168958
597         <rdar://problem/30748638>
598
599         Reviewed by Jon Lee.
600
601         We now use the compact layout mode by default on macOS.
602
603         * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
604         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
605         (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
606         the scrubber in compact mode.
607         (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
608         compact mode so that it's vertically aligned.
609         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
610         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
611         reduced padding traits since these do not apply to macOS anymore. We also notify the
612         scrubber of a layout trait change so that it may adjust its height.
613         * Modules/modern-media-controls/controls/scrubber.js:
614         (Scrubber):
615         (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
616         compact layout traits.
617         * Modules/modern-media-controls/controls/time-control.js:
618         (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
619         TimeControl visibility to match compact layout traits.
620         * Modules/modern-media-controls/media/media-controller.js:
621         (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
622         on macOS and make the tight padding specific to iOS.
623
624 2017-02-27  Antoine Quint  <graouts@apple.com>
625
626         [Modern Media Controls] Adhere to tight padding on iOS
627         https://bugs.webkit.org/show_bug.cgi?id=168949
628         <rdar://problem/30746164>
629
630         Reviewed by Jon Lee.
631
632         We used to only support custom margins on macOS, to support this on iOS as
633         well, we promote the notification when the layoutTraits property is set to
634         MediaControls and expose a new protected method layoutTraitsDidChange() for
635         subclasses to implement. IOSInlineMediaControls now implements that method
636         and will use tighter margins for the TightPadding layout trait.
637
638         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html
639
640         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
641         (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
642         (IOSInlineMediaControls):
643         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
644         (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
645         (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
646         (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
647         * Modules/modern-media-controls/controls/media-controls.js:
648         (MediaControls.prototype.get layoutTraits):
649         (MediaControls.prototype.set layoutTraits):
650         (MediaControls.prototype.layoutTraitsDidChange):
651
652 2017-02-27  Youenn Fablet  <youenn@apple.com>
653
654         [WebRTC] Support modern RTCStatsReport
655         https://bugs.webkit.org/show_bug.cgi?id=166916
656         <rdar://problem/30293780>
657
658         Reviewed by Alex Christensen.
659
660         Updating binding generator and IDL parser to handle maplike.
661         Covered by binding tests.
662
663         Added support for maplike binding from JS wrapper to DOM class.
664         The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
665         All maplike methods are forwarded to the corresponding Map methods.
666         The XX object is responsible to add key/value pairs using a helper routine.
667         The creation of the Map is done at creation of the JSXX wrapper.
668
669         DOM class is interacting with the map through DOMMapLike.
670         Extracted DOMGuarded from DOM promise implementation.
671         This allows reusing this code for DOMMapLike.
672
673         Covered by binding tests and manual tests.
674
675         * CMakeLists.txt:
676         * DerivedSources.make:
677         * Modules/mediastream/RTCStatsReport.h:
678         (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
679         (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
680         (WebCore::RTCStatsReport::create):
681         (WebCore::RTCStatsReport::synchronizeBackingMap):
682         (WebCore::RTCStatsReport::backingMap):
683         (WebCore::RTCStatsReport::addStats):
684         * Modules/mediastream/RTCStatsReport.idl:
685         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
686         (WebCore::fromStdString):
687         (WebCore::fillRTCStats):
688         (WebCore::fillRTCRTPStreamStats):
689         (WebCore::fillInboundRTPStreamStats):
690         (WebCore::fillOutboundRTPStreamStats):
691         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
692         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
693         * WebCore.xcodeproj/project.pbxproj:
694         * bindings/js/JSDOMBindingInternals.js: Added.
695         (mapLikeForEach):
696         * bindings/js/JSDOMGlobalObject.cpp:
697         (WebCore::JSDOMGlobalObject::visitChildren):
698         * bindings/js/JSDOMGlobalObject.h:
699         * bindings/js/JSDOMGuardedObject.cpp: Added.
700         (WebCore::DOMGuardedObject::DOMGuardedObject):
701         (WebCore::DOMGuardedObject::~DOMGuardedObject):
702         (WebCore::DOMGuardedObject::clear):
703         (WebCore::DOMGuardedObject::contextDestroyed):
704         * bindings/js/JSDOMGuardedObject.h: Added.
705         (WebCore::DOMGuardedObject::isSuspended):
706         (WebCore::DOMGuardedObject::visitAggregate):
707         (WebCore::DOMGuardedObject::guardedObject):
708         (WebCore::DOMGuardedObject::globalObject):
709         (WebCore::DOMGuardedObject::isEmpty):
710         (WebCore::DOMGuarded::DOMGuarded):
711         (WebCore::DOMGuarded::guarded):
712         * bindings/js/JSDOMMapLike.cpp: Added.
713         (WebCore::getBackingMap):
714         (WebCore::initializeBackingMap):
715         (WebCore::createBackingMap):
716         (WebCore::forwardAttributeGetterToBackingMap):
717         (WebCore::forwardFunctionCallToBackingMap):
718         (WebCore::forwardForEachCallToBackingMap):
719         * bindings/js/JSDOMMapLike.h: Added.
720         (WebCore::DOMMapLike::set):
721         (WebCore::synchronizeBackingMap):
722         (WebCore::forwardSizeToMapLike):
723         (WebCore::forwardEntriesToMapLike):
724         (WebCore::forwardKeysToMapLike):
725         (WebCore::forwardValuesToMapLike):
726         (WebCore::forwardClearToMapLike):
727         (WebCore::forwardForEachToMapLike):
728         (WebCore::forwardHasToMapLike):
729         (WebCore::forwardAddToMapLike):
730         (WebCore::forwardDeleteToMapLike):
731         * bindings/js/JSDOMPromise.cpp:
732         (WebCore::DeferredPromise::promise):
733         (WebCore::DeferredPromise::reject):
734         * bindings/js/JSDOMPromise.h:
735         (WebCore::DeferredPromise::resolve):
736         (WebCore::DeferredPromise::resolveWithNewlyCreated):
737         (WebCore::DeferredPromise::reject):
738         (WebCore::DeferredPromise::resolveWithCallback):
739         (WebCore::DeferredPromise::rejectWithCallback):
740         (WebCore::DeferredPromise::DeferredPromise):
741         (WebCore::DeferredPromise::deferred):
742         * bindings/js/WebCoreBuiltinNames.h:
743         * bindings/scripts/CodeGeneratorJS.pm:
744         (PrototypeFunctionCount):
745         (GeneratePropertiesHashTable):
746         (InterfaceNeedsIterator):
747         (GenerateImplementation):
748         (GenerateParametersCheck):
749         * bindings/scripts/IDLParser.pm:
750         (assert):
751         (parseAttributeOrOperationOrIterator):
752         (parseSerializer):
753         (parseAttributeOrOperationRest):
754         (parseAttribute):
755         (parseAttributeRest):
756         (parseOperationOrIterator):
757         (parseOptionalIterableInterface):
758         (parseMapLikeRest):
759         (parseMapLikeProperties):
760         (parseOperationRest):
761         (applyMemberList):
762         * bindings/scripts/test/JS/JSMapLike.cpp: Added.
763         * bindings/scripts/test/JS/JSMapLike.h: Added.
764         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
765         * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
766         * bindings/scripts/test/TestMapLike.idl: Added.
767         * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.
768
769 2017-02-27  Mark Lam  <mark.lam@apple.com>
770
771         Introduce a VM Traps mechanism and refactor Watchdog to use it.
772         https://bugs.webkit.org/show_bug.cgi?id=168842
773
774         Reviewed by Filip Pizlo.
775
776         No new tests needed because this is a re-implementation of existing functionality.
777
778         * bindings/js/WorkerScriptController.cpp:
779         (WebCore::WorkerScriptController::WorkerScriptController):
780         (WebCore::WorkerScriptController::scheduleExecutionTermination):
781
782 2017-02-27  Andy Estes  <aestes@apple.com>
783
784         [Cocoa] Rename FileMac.mm to FileCocoa.mm
785         https://bugs.webkit.org/show_bug.cgi?id=168947
786
787         Reviewed by Zalan Bujtas.
788
789         * PlatformMac.cmake:
790         * WebCore.xcodeproj/project.pbxproj:
791         * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.
792
793 2017-02-27  Andy Estes  <aestes@apple.com>
794
795         [iOS] Enable file replacement
796         https://bugs.webkit.org/show_bug.cgi?id=168907
797         <rdar://problem/22258242>
798
799         Reviewed by David Kilzer.
800
801         Covered by existing tests.
802
803         * fileapi/FileMac.mm:
804         (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
805         file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.
806
807 2017-02-27  Antoine Quint  <graouts@apple.com>
808
809         [Modern Media Controls] Use a solid background for <audio> controls on macOS
810         https://bugs.webkit.org/show_bug.cgi?id=168941
811         <rdar://problem/30744316>
812
813         Reviewed by Dean Jackson.
814
815         Use a solid background for <audio> elements on macOS, the same way we do on iOS.
816
817         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html
818
819         * Modules/modern-media-controls/controls/macos-media-controls.css:
820         (:host(audio) .media-controls.mac.inline > .controls-bar):
821         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):
822
823 2017-02-27  Antoine Quint  <graouts@apple.com>
824
825         [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
826         https://bugs.webkit.org/show_bug.cgi?id=168938
827         <rdar://problem/30743185>
828
829         Reviewed by Dean Jackson.
830
831         Ensure we use the same styling properties for StatusLabel and TimeLabel.
832
833         Tests: media/modern-media-controls/status-label/status-label-ios.html
834                media/modern-media-controls/status-label/status-label-macos.html
835
836         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
837         (.media-controls.ios.inline .time-label,):
838         (.media-controls.ios.inline .time-label): Deleted.
839         * Modules/modern-media-controls/controls/macos-media-controls.css:
840         (.media-controls.mac > .controls-bar .time-label,):
841         (.media-controls.mac > .controls-bar .time-label): Deleted.
842         * Modules/modern-media-controls/controls/status-label.css:
843         (.status-label):
844
845 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
846
847         Rename ICU cursor iterator to caret iterator
848         https://bugs.webkit.org/show_bug.cgi?id=168206
849
850         Reviewed by Simon Fraser.
851
852         Mechanical find/replace.
853
854         No new tests because there is no behavior change.
855
856         * platform/graphics/ComplexTextController.cpp:
857         (WebCore::ComplexTextController::offsetForPosition):
858         * rendering/RenderText.cpp:
859         (WebCore::RenderText::previousOffset):
860         (WebCore::RenderText::nextOffset):
861
862 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
863
864         Unprefix -webkit-line-break
865         https://bugs.webkit.org/show_bug.cgi?id=168213
866
867         Reviewed by Darin Adler.
868
869         We support the property as specced.
870
871         Test: fast/text/line-break-unprefixed.html
872
873         * css/CSSComputedStyleDeclaration.cpp:
874         (WebCore::ComputedStyleExtractor::propertyValue):
875         * css/CSSProperties.json:
876         * css/parser/CSSParserFastPaths.cpp:
877         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
878         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
879         * editing/Editor.cpp:
880         (WebCore::Editor::applyEditingStyleToElement):
881         * html/HTMLElement.cpp:
882         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
883
884 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
885
886         Use RAII for ICU breaking iterators
887         https://bugs.webkit.org/show_bug.cgi?id=168203
888
889         Reviewed by Simon Fraser.
890
891         No new tests because there is no behavior change.
892
893         * platform/graphics/ComplexTextController.cpp:
894         (WebCore::ComplexTextController::offsetForPosition):
895         * rendering/RenderText.cpp:
896         (WebCore::RenderText::previousOffset):
897         (WebCore::RenderText::nextOffset):
898
899 2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
900
901         [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
902         https://bugs.webkit.org/show_bug.cgi?id=168486
903
904         Reviewed by Alex Christensen.
905
906         change the order of path location search to make it possible to 
907         configure with environment variable because bundled ca-bundle is
908         always available now.
909
910         * platform/network/curl/ResourceHandleManager.cpp:
911         (WebCore::certificatePath):
912
913 2017-02-27  Antoine Quint  <graouts@apple.com>
914
915         [Modern Media Controls] Status text does not appear on iOS
916         https://bugs.webkit.org/show_bug.cgi?id=168918
917         <rdar://problem/30737644>
918
919         Reviewed by Dean Jackson.
920
921         We refactor the layout code out of MacOSInlineMediaControls and into a new
922         InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
923         both the macOS and iOS inline media controls run the same layout logic to
924         control whether the status label or scrubber should be displayed, and which
925         controls should be dropped due to space constraints.
926
927         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html
928
929         * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
930         (InlineLayoutSupport):
931         (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
932         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
933         (IOSInlineMediaControls.prototype.layout):
934         (IOSInlineMediaControls):
935         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
936         (MacOSInlineMediaControls.prototype.layout):
937         * Modules/modern-media-controls/js-files:
938
939 2017-02-27  Simon Fraser  <simon.fraser@apple.com>
940
941         Add specification and status metadata to CSSProperties.json, and validate it
942         https://bugs.webkit.org/show_bug.cgi?id=168901
943
944         Reviewed by Darin Adler.
945
946         Annotate CSS properties with data about the WebKit development status, and
947         where they are specified. A property has a canonical specification reference,
948         but individual values may have a reference to a more recent spec.
949
950         Add a list of specifications to the JSON that properties reference by key.
951
952         Enhance check-webkit-style to validate the status and spec data.
953
954         * css/CSSProperties.json:
955
956 2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>
957
958         [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
959         https://bugs.webkit.org/show_bug.cgi?id=168616
960         <rdar://problem/30167149>
961
962         Reviewed by Daniel Bates.
963
964         This patch adds IDL definitions for:
965         1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
966         2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
967         3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
968
969         Test: credentials/idlharness.html
970
971         * CMakeLists.txt:
972         * DerivedSources.make:
973         * Modules/credentials/BasicCredential.cpp: Added.
974         (WebCore::BasicCredential::BasicCredential):
975         (WebCore::BasicCredential::~BasicCredential):
976         (WebCore::BasicCredential::type):
977         * Modules/credentials/BasicCredential.h: Added.
978         (WebCore::BasicCredential::id):
979         * Modules/credentials/BasicCredential.idl: Added.
980         * Modules/credentials/CredentialData.h: Added.
981         * Modules/credentials/CredentialData.idl: Added.
982         * Modules/credentials/PasswordCredential.cpp: Added.
983         (WebCore::PasswordCredential::PasswordCredential):
984         (WebCore::PasswordCredential::PasswordCredential):
985         Dummy constructors for now.
986         * Modules/credentials/PasswordCredential.h: Added.
987         (WebCore::PasswordCredential::create):
988         (WebCore::PasswordCredential::create):
989         (WebCore::PasswordCredential::setIdName):
990         (WebCore::PasswordCredential::idName):
991         (WebCore::PasswordCredential::setPasswordName):
992         (WebCore::PasswordCredential::passwordName):
993         (WebCore::PasswordCredential::setAdditionalData):
994         (WebCore::PasswordCredential::additionalData):
995         * Modules/credentials/PasswordCredential.idl: Added.
996         * Modules/credentials/SiteBoundCredential.cpp: Added.
997         (WebCore::SiteBoundCredential::SiteBoundCredential):
998         (WebCore::SiteBoundCredential::~SiteBoundCredential):
999         * Modules/credentials/SiteBoundCredential.h: Added.
1000         (WebCore::SiteBoundCredential::name):
1001         (WebCore::SiteBoundCredential::iconURL):
1002         (WebCore::SiteBoundCredential::setOrigin):
1003         (WebCore::SiteBoundCredential::origin):
1004         * Modules/credentials/SiteBoundCredential.idl: Added.
1005         * Modules/credentials/SiteBoundCredentialData.h: Added.
1006         * Modules/credentials/SiteBoundCredentialData.idl: Added.
1007         * WebCore.xcodeproj/project.pbxproj:
1008
1009 2017-02-27  Jer Noble  <jer.noble@apple.com>
1010
1011         [WebRTC] Fix remote audio rendering
1012         https://bugs.webkit.org/show_bug.cgi?id=168898
1013
1014         Reviewed by Eric Carlson.
1015
1016         Test: webrtc/audio-peer-connection-webaudio.html
1017
1018         Fix MediaStreamAudioSourceNode by not bailing out early if the input sample rate doesn't match
1019         the AudioContext's sample rate; there's code in setFormat() to do the sample rate conversion
1020         correctly.
1021
1022         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
1023         (WebCore::MediaStreamAudioSourceNode::setFormat):
1024
1025         Fix AudioSampleBufferList by making the AudioConverter input proc a free function, and passing
1026         its refCon a struct containing only the information it needs to perform its task. Because the
1027         conversion may result in a different number of output samples than input ones, just ask to
1028         generate the entire capacity of the scratch buffer, and signal that the input buffer was fully
1029         converted with a special return value.
1030
1031         * platform/audio/mac/AudioSampleBufferList.cpp:
1032         (WebCore::audioConverterFromABLCallback):
1033         (WebCore::AudioSampleBufferList::copyFrom):
1034         (WebCore::AudioSampleBufferList::convertInput): Deleted.
1035         (WebCore::AudioSampleBufferList::audioConverterCallback): Deleted.
1036         * platform/audio/mac/AudioSampleBufferList.h:
1037
1038         Fix AudioSampleDataSource by updating both the sampleCount and the sampleTime after doing
1039         a sample rate conversion to take into account that both the number of samples may have changed,
1040         as well as the timeScale of the sampleTime. This may result in small off-by-one rounding errors
1041         due to the sample rate conversion of sampleTime, so remember what the next expected sampleTime
1042         should be, and correct sampleTime if it is indeed off-by-one. If the pull operation has gotten
1043         ahead of the push operation, delay the next pull by the empty amount by rolling back the
1044         m_outputSampleOffset. Introduce the same offset behavior during pull operations.
1045
1046         * platform/audio/mac/AudioSampleDataSource.h:
1047         * platform/audio/mac/AudioSampleDataSource.mm:
1048         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1049         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1050         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1051
1052         Fix MediaPlayerPrivateMediaStreamAVFObjC by obeying the m_muted property.
1053
1054         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1055         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume):
1056         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted):
1057
1058         Fix LibWebRTCAudioModule by sleeping for the correct amount after emitting frames. Previously,
1059         LibWebRTCAudioModule would sleep for a fixed amount of time, which meant it would get slowly out
1060         of sync when emitting frames took a non-zero amount of time. Now, the amount of time before the
1061         next cycle starts is correctly calculated, and then LibWebRTCAudioModule sleeps for a dynamic amount
1062         of time in order to wake up correctly at the beginning of the next cycle.
1063
1064         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
1065         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
1066
1067         Fix AudioTrackPrivateMediaStreamCocoa by just using the output unit's preferred format
1068         description (with the current system sample rate), rather than whatever is the current
1069         input description.
1070
1071         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1072         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1073         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1074         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1075
1076         Fix RealtimeIncomingAudioSource by actually creating an AudioSourceProvider when asked.
1077
1078         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1079         (WebCore::RealtimeIncomingAudioSource::OnData):
1080         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
1081         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1082
1083         Fix RealtimeOutgoingAudioSource by using the outgoing format description rather than the
1084         incoming one to determine the sample rate, channel count, sample byte size, etc., to use
1085         when delivering data upstream to libWebRTC.
1086
1087         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1088         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1089         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1090         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1091
1092         Fix WebAudioSourceProviderAVFObjC by using a AudioSampleDataSource to do format and sample
1093         rate conversion rather than trying to duplicate all that code and use a CARingBuffer and 
1094         AudioConverter directly.
1095
1096         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1097         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1098         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
1099         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
1100         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
1101         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
1102         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1103
1104         Fix the MockLibWebRTCAudioTrack by passing along the AddSink() sink to its AudioSourceInterface,
1105         allowing the RealtimeOutgoingAudioSource to push data into the libWebRTC network stack. Also,
1106         make sure m_enabled is initialized to a good value.
1107
1108         * testing/MockLibWebRTCPeerConnection.h:
1109
1110 2017-02-21  Jer Noble  <jer.noble@apple.com>
1111
1112         AudioSampleDataSource should not exclusively lock its read and write threads.
1113         https://bugs.webkit.org/show_bug.cgi?id=168646
1114
1115         Reviewed by Eric Carlson.
1116
1117         Locking the write thread causes the read thread to drop audio samples and generates audible
1118         glitches, and the realtime audio thread backing the read thread should never block. There's
1119         no real reason to lock these threads against one another here; they both rely on the
1120         CARingBuffer to safely and simultaneously read and write data.
1121
1122         * platform/audio/mac/AudioSampleDataSource.cpp:
1123         (WebCore::AudioSampleDataSource::setPaused):
1124         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1125         (WebCore::AudioSampleDataSource::pushSamples):
1126         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1127         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1128         (WebCore::AudioSampleDataSource::pullSamples):
1129         * platform/audio/mac/AudioSampleDataSource.h:
1130
1131 2017-02-21  Jer Noble  <jer.noble@apple.com>
1132
1133         AudioTrackPrivateMediaStreamCocoa should not exclusively lock its read and write threads.
1134         https://bugs.webkit.org/show_bug.cgi?id=168643
1135
1136         Reviewed by Eric Carlson.
1137
1138         Locking the write thread causes the read thread to drop audio samples and generates audible
1139         glitches, and the realtime audio thread backing the read thread should never block. There's
1140         no real reason to lock these threads against one another here; they both rely on the
1141         AudioSampleDataSource and it's CARingBuffer to safely and simultaneously read and write
1142         data.
1143
1144         The one piece which locks previously protected against unsafe access was during creation of
1145         the audio unit.  Without a lock, the audio unit could begin playback after the unit was
1146         created and assigned to m_remoteIOUnit but before the ring buffer was created. To protect
1147         against this possibility, create the unit, set the input and output descriptions, but only
1148         assign the new audio unit to m_remoteIOUnit after the ring buffer has been created and
1149         initialized.
1150
1151         * platform/audio/mac/CAAudioStreamDescription.h:
1152         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1153         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
1154         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
1155         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
1156         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
1157         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
1158         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1159         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit): Renamed to createAudioUnit()
1160         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1161         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1162
1163 2017-02-27  Youenn Fablet  <youenn@apple.com>
1164
1165         [WebRTC] RealtimOutgoingVideoSource should not need to do image conversion
1166         https://bugs.webkit.org/show_bug.cgi?id=168802
1167
1168         Reviewed by Jon Lee.
1169
1170         Covered by manual testing as mock sources do not hit the same code path.
1171
1172         * platform/mediastream/mac/AVVideoCaptureSource.h:
1173         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1174         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
1175         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1176         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1177         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1178         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1179
1180 2017-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1181
1182         [GTK] Downloads attributes tests are failing
1183         https://bugs.webkit.org/show_bug.cgi?id=168871
1184
1185         Reviewed by Michael Catanzaro.
1186
1187         Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
1188         filenameFromHTTPContentDisposition().
1189
1190         Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
1191                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
1192
1193         * platform/network/soup/ResourceResponseSoup.cpp:
1194         (WebCore::ResourceResponse::platformSuggestedFilename):
1195
1196 2017-02-27  Antoine Quint  <graouts@apple.com>
1197
1198         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
1199         https://bugs.webkit.org/show_bug.cgi?id=168820
1200         <rdar://problem/30690281>
1201
1202         Reviewed by Jon Lee.
1203
1204         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
1205         event target when initiating a drag is the controls bar itself and not some of its content.
1206
1207         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
1208         starting over one of the controls and notice that no dragging occurs.
1209
1210         We also fix an issue where we wouldn't update the layout of the left container as its icon
1211         buttons would load, which would cause the layout width of the left container to be incorrect
1212         and the related tests to time out.
1213
1214         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
1215
1216         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1217         (MacOSFullscreenMediaControls.prototype.layout):
1218         (MacOSFullscreenMediaControls.prototype._handleMousedown):
1219
1220 2017-02-27  Alex Christensen  <achristensen@webkit.org>
1221
1222         [libwebrtc] Enable WebRTC in some Production Builds
1223         https://bugs.webkit.org/show_bug.cgi?id=168858
1224
1225         * Configurations/FeatureDefines.xcconfig:
1226
1227 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
1228
1229         [TextureMapper] Clean up BitmapTextureGL construction
1230         https://bugs.webkit.org/show_bug.cgi?id=168909
1231
1232         Reviewed by Carlos Garcia Campos.
1233
1234         Have the BitmapTextureGL constructor accept an rvalue reference pointer
1235         to the GraphicsContext3D object. A static create() method is also added
1236         to help with constructing these objects. Construction sites are updated
1237         appropriately.
1238
1239         The BitmapTextureGL constructor is further cleaned up by moving default
1240         member initializations together with the member declarations.
1241
1242         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1243         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1244         * platform/graphics/texmap/BitmapTextureGL.cpp:
1245         (WebCore::BitmapTextureGL::BitmapTextureGL):
1246         * platform/graphics/texmap/BitmapTextureGL.h:
1247         * platform/graphics/texmap/BitmapTexturePool.cpp:
1248         (WebCore::BitmapTexturePool::createTexture):
1249         * platform/graphics/texmap/TextureMapperGL.cpp:
1250         (WebCore::TextureMapperGL::createTexture):
1251
1252 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
1253
1254         [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
1255         https://bugs.webkit.org/show_bug.cgi?id=168906
1256
1257         Reviewed by Carlos Garcia Campos.
1258
1259         Remove the InterpolationQuality and TextDrawingModeFlags member variables from the
1260         TextureMapper class. These weren't modified anywhere in the code.
1261
1262         BitmapTexture::updateContents() still sets the image interpolation quality and
1263         drawing mode on the ImageBuffer's GraphicsContext, but now uses the default
1264         InterpolationDefault and TextModeFill values.
1265
1266         * platform/graphics/texmap/BitmapTexture.cpp:
1267         (WebCore::BitmapTexture::updateContents):
1268         * platform/graphics/texmap/TextureMapper.cpp:
1269         (WebCore::TextureMapper::TextureMapper): Deleted.
1270         (WebCore::TextureMapper::~TextureMapper): Deleted.
1271         * platform/graphics/texmap/TextureMapper.h:
1272         (WebCore::TextureMapper::setImageInterpolationQuality): Deleted.
1273         (WebCore::TextureMapper::setTextDrawingMode): Deleted.
1274         (WebCore::TextureMapper::imageInterpolationQuality): Deleted.
1275         (WebCore::TextureMapper::textDrawingMode): Deleted.
1276
1277 2017-02-26  Zan Dobersek  <zdobersek@igalia.com>
1278
1279         [CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
1280         https://bugs.webkit.org/show_bug.cgi?id=168903
1281
1282         Reviewed by Carlos Garcia Campos.
1283
1284         Remove the GraphicsContext pointer member from the TextureMapper class
1285         since the getter and setter methods are not used anywhere.
1286
1287         * platform/graphics/texmap/TextureMapper.cpp:
1288         (WebCore::TextureMapper::TextureMapper):
1289         * platform/graphics/texmap/TextureMapper.h:
1290         (WebCore::TextureMapper::setGraphicsContext): Deleted.
1291         (WebCore::TextureMapper::graphicsContext): Deleted.
1292
1293 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
1294
1295         Stop compiling our own cursorMovementIterator()
1296         https://bugs.webkit.org/show_bug.cgi?id=168211
1297
1298         Reviewed by David Hyatt.
1299
1300         Covered by existing tests.
1301
1302         Hook up the caret iterator.
1303
1304         * platform/graphics/ComplexTextController.cpp:
1305         (WebCore::ComplexTextController::offsetForPosition):
1306         * rendering/RenderText.cpp:
1307         (WebCore::RenderText::previousOffset):
1308         (WebCore::RenderText::nextOffset):
1309         * rendering/RenderText.h:
1310
1311 2017-02-26  Commit Queue  <commit-queue@webkit.org>
1312
1313         Unreviewed, rolling out r212942.
1314         https://bugs.webkit.org/show_bug.cgi?id=168882
1315
1316         Made EWS very flaky (Requested by ap on #webkit).
1317
1318         Reverted changeset:
1319
1320         "[Modern Media Controls] Dragging controls in fullscreen on
1321         macOS prevents scrubbing or interacting with controls"
1322         https://bugs.webkit.org/show_bug.cgi?id=168820
1323         http://trac.webkit.org/changeset/212942
1324
1325 2017-02-26  Chris Dumez  <cdumez@apple.com>
1326
1327         HitTestResult's linkSuggestedFilename should sanitize download attribute
1328         https://bugs.webkit.org/show_bug.cgi?id=168856
1329         <rdar://problem/30683109>
1330
1331         Reviewed by Antti Koivisto.
1332
1333         HitTestResult's linkSuggestedFilename should sanitize download attribute.
1334         This is used by the context menu's "Download Linked File" & "Download Linked
1335         File As..." actions.
1336
1337         * rendering/HitTestResult.cpp:
1338         (WebCore::HitTestResult::linkSuggestedFilename):
1339         * rendering/HitTestResult.h:
1340
1341 2017-02-25  Zalan Bujtas  <zalan@apple.com>
1342
1343         Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
1344         https://bugs.webkit.org/show_bug.cgi?id=168872
1345         
1346         Reviewed by Simon Fraser.
1347
1348         SimpleLineLayout.cpp is for core functions only.
1349
1350         No change in functionality.
1351
1352         * CMakeLists.txt:
1353         * WebCore.xcodeproj/project.pbxproj:
1354         * rendering/RenderingAllInOne.cpp:
1355         * rendering/SimpleLineLayout.cpp:
1356         (WebCore::SimpleLineLayout::canUseForWithReason):
1357         (WebCore::SimpleLineLayout::printReason): Deleted.
1358         (WebCore::SimpleLineLayout::printReasons): Deleted.
1359         (WebCore::SimpleLineLayout::printTextForSubtree): Deleted.
1360         (WebCore::SimpleLineLayout::textLengthForSubtree): Deleted.
1361         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Deleted.
1362         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage): Deleted.
1363         (WebCore::SimpleLineLayout::toggleSimpleLineLayout): Deleted.
1364         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList): Deleted.
1365         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage): Deleted.
1366         * rendering/SimpleLineLayout.h:
1367         * rendering/SimpleLineLayoutCoverage.cpp: Added.
1368         (WebCore::SimpleLineLayout::printReason):
1369         (WebCore::SimpleLineLayout::printReasons):
1370         (WebCore::SimpleLineLayout::printTextForSubtree):
1371         (WebCore::SimpleLineLayout::textLengthForSubtree):
1372         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows):
1373         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
1374         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
1375         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList):
1376         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
1377         * rendering/SimpleLineLayoutCoverage.h: Added.
1378
1379 2017-02-25  Zalan Bujtas  <zalan@apple.com>
1380
1381         Text might wrap when its preferred logical width is used for sizing the containing block.
1382         https://bugs.webkit.org/show_bug.cgi?id=168864
1383         <rdar://problem/30690734>
1384
1385         Reviewed by Antti Koivisto.
1386
1387         In certain cases we end up measuring a text run in 2 different ways.
1388         1. preferred width computation -> slow path FontCascade::width() 
1389         2. line breaking logic -> fast path FontCascade::widthForSimpleText()
1390  
1391         FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when
1392         the individual glyph widths are measured to be the same. It's because they run diffrent set of
1393         arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point
1394         precision.
1395         Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path
1396         (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path
1397         for all runs that have been already measured using the slow path (which would be just wasteful).
1398
1399         Test: fast/text/fast-run-width-vs-slow-run-width.html
1400
1401         * platform/graphics/FontCascade.cpp:
1402         (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here.  
1403
1404 2017-02-24  Simon Fraser  <simon.fraser@apple.com>
1405
1406         Improve how multiple codegen-properties are handled in CSSProperties.json
1407         https://bugs.webkit.org/show_bug.cgi?id=168867
1408
1409         Reviewed by Zalan Bujtas.
1410
1411         To make upcoming metadata storage easier, it's better if property entries in CSSProperties.json
1412         are always hashes. One property (line-height) used an array, in order to represent settings for
1413         two different build flags (ENABLE_TEXT_AUTOSIZING and !ENABLE_TEXT_AUTOSIZING).
1414
1415         Fix by making "codegen-properties" optionally be an array. The relevant item is selected in
1416         removeInactiveCodegenProperties() and used to replace the array.
1417
1418         Sort @internalProprerties when generating code, otherwise the contents of isInternalCSSProperty()
1419         are unstable (the order in @allNames is not stable because it's the keys in a hash).
1420
1421         * css/CSSProperties.json:
1422         * css/makeprop.pl:
1423         (matchEnableFlags):
1424         (removeInactiveCodegenProperties):
1425         (isPropertyEnabled):
1426
1427 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
1428
1429         [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
1430         https://bugs.webkit.org/show_bug.cgi?id=168680
1431
1432         Reviewed by Youenn Fablet.
1433
1434         * html/HTMLMediaElement.cpp:
1435         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
1436         Pass in the element so it may be used as the initiator.
1437
1438         * html/HTMLVideoElement.h:
1439         Export create() for TestWebKitAPI to use.
1440
1441         * loader/MediaResourceLoader.cpp:
1442         (WebCore::MediaResourceLoader::MediaResourceLoader):
1443         (WebCore::MediaResourceLoader::contextDestroyed):
1444         (WebCore::MediaResourceLoader::requestResource):
1445         * loader/MediaResourceLoader.h:
1446         Include the HTMLMediaElement as the initiator.
1447
1448 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
1449
1450         [Resource Timing] Gather timing information with reliable responseEnd time
1451         https://bugs.webkit.org/show_bug.cgi?id=168351
1452
1453         Reviewed by Alex Christensen.
1454
1455         This patch replaces the unused `double finishTime` in ResourceLoader's
1456         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
1457         allows the NetworkProcess to give complete timing information, and more
1458         final metrics about the load, to WebCore. Currently this is only used
1459         by ResourceTiming, but it will soon be used by Web Inspector as well.
1460         We may also end up extending this to the didFail path as well, since it
1461         is possible that we have some metrics for load failures.
1462
1463         At the same time we want to start moving away from the legacy path that
1464         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
1465         It doesn't make sense to store this information on the ResourceResponse
1466         for a few reasons: We don't want to store the metrics in our Network Cache and
1467         not all of the load timing metrics have been populated yet (responseEnd).
1468         In an effort to move off of this data we've renamed the accessor to
1469         "deprecatedNetworkLoadMetrics". There are a few remaining clients
1470         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
1471         migrated separately from this patch.
1472
1473         Having both the legacy and new code paths adds a little bit of complexity.
1474         One advantage of the new path is that the complete load timing data
1475         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
1476         be packaged together. The legacy path could not include a responseEnd, so
1477         WebCore faked that value with its own timestamp. Having the fake responseEnd
1478         caused issues as timestamps / clocks are different between processes. In order
1479         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
1480         has the complete network timing metrics it checks isComplete(). If true
1481         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
1482         it must fallback to the legacy value from LoadTiming. Once all of the
1483         deprecatedNetworkLoadMetrics clients go away, we should always have the
1484         complete data and this can be eliminated.
1485
1486         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
1487                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
1488
1489         * PlatformMac.cmake:
1490         * WebCore.xcodeproj/project.pbxproj:
1491         Rename NetworkLoadTiming -> NetworkLoadMetrics.
1492
1493         * page/PerformanceResourceTiming.cpp:
1494         (WebCore::entryStartTime):
1495         (WebCore::entryEndTime):
1496         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1497         (WebCore::PerformanceResourceTiming::nextHopProtocol):
1498         (WebCore::PerformanceResourceTiming::domainLookupStart):
1499         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1500         (WebCore::PerformanceResourceTiming::connectStart):
1501         (WebCore::PerformanceResourceTiming::connectEnd):
1502         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1503         (WebCore::PerformanceResourceTiming::requestStart):
1504         (WebCore::PerformanceResourceTiming::responseStart):
1505         (WebCore::PerformanceResourceTiming::responseEnd):
1506         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1507         * page/PerformanceResourceTiming.h:
1508         Mostly just updating names and types. This does however need to get the
1509         correct endTime based on whether the NetworkLoadMetrics are complete
1510         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
1511
1512         * page/PerformanceResourceTiming.idl:
1513         Add nextHopProtocol.
1514
1515         * page/PerformanceTiming.cpp:
1516         (WebCore::PerformanceTiming::domainLookupStart):
1517         (WebCore::PerformanceTiming::domainLookupEnd):
1518         (WebCore::PerformanceTiming::connectStart):
1519         (WebCore::PerformanceTiming::connectEnd):
1520         (WebCore::PerformanceTiming::secureConnectionStart):
1521         (WebCore::PerformanceTiming::requestStart):
1522         (WebCore::PerformanceTiming::responseStart):
1523         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
1524         * page/PerformanceTiming.h:
1525         Navigation Timing values still uses the NetworkLoadTiming values stored on
1526         the DocumentLoader. This should be moved off of the deprecated path separately.
1527
1528         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
1529         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
1530         (WebCore::NetworkLoadMetrics::isolatedCopy):
1531         (WebCore::NetworkLoadMetrics::reset):
1532         (WebCore::NetworkLoadMetrics::operator==):
1533         (WebCore::NetworkLoadMetrics::operator!=):
1534         (WebCore::NetworkLoadMetrics::isComplete):
1535         (WebCore::NetworkLoadMetrics::markComplete):
1536         (WebCore::NetworkLoadMetrics::encode):
1537         (WebCore::NetworkLoadMetrics::decode):
1538         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
1539         Add protocolName and "complete" boolean.
1540
1541         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
1542         (WebCore::timingValue):
1543         (WebCore::copyTimingData):
1544         (WebCore::setCollectsTimingData):
1545         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
1546         Since we already have to modify all the clients this moves us to use the more
1547         strongly typed units that are less ambiguous then "double". The rest of the
1548         Performance API has already moved to these units.
1549
1550         * inspector/InspectorNetworkAgent.cpp:
1551         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
1552         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
1553         (WebCore::InspectorNetworkAgent::didFinishLoading):
1554         * inspector/InspectorNetworkAgent.h:
1555         Inspector was the only client of the finishTime, and since the value was
1556         erratically coming from clients in different ways it was almost certainly
1557         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
1558
1559         * Modules/fetch/FetchLoader.cpp:
1560         (WebCore::FetchLoader::didFinishLoading):
1561         * Modules/fetch/FetchLoader.h:
1562         * fileapi/FileReaderLoader.cpp:
1563         (WebCore::FileReaderLoader::didFinishLoading):
1564         * fileapi/FileReaderLoader.h:
1565         * html/MediaFragmentURIParser.cpp:
1566         (WebCore::MediaFragmentURIParser::parseNPTTime):
1567         * inspector/InspectorInstrumentation.cpp:
1568         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
1569         * inspector/InspectorInstrumentation.h:
1570         (WebCore::InspectorInstrumentation::didFinishLoading):
1571         * loader/CrossOriginPreflightChecker.cpp:
1572         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
1573         * loader/DocumentLoader.cpp:
1574         (WebCore::DocumentLoader::notifyFinished):
1575         (WebCore::DocumentLoader::finishedLoading):
1576         (WebCore::DocumentLoader::continueAfterContentPolicy):
1577         (WebCore::DocumentLoader::maybeLoadEmpty):
1578         * loader/DocumentLoader.h:
1579         * loader/DocumentThreadableLoader.cpp:
1580         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1581         (WebCore::DocumentThreadableLoader::notifyFinished):
1582         (WebCore::DocumentThreadableLoader::didFinishLoading):
1583         (WebCore::DocumentThreadableLoader::loadRequest):
1584         * loader/DocumentThreadableLoader.h:
1585         * loader/NetscapePlugInStreamLoader.cpp:
1586         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
1587         * loader/NetscapePlugInStreamLoader.h:
1588         * loader/ResourceLoadNotifier.cpp:
1589         (WebCore::ResourceLoadNotifier::didFinishLoad):
1590         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
1591         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
1592         * loader/ResourceLoadNotifier.h:
1593         * loader/ResourceLoader.cpp:
1594         (WebCore::ResourceLoader::deliverResponseAndData):
1595         (WebCore::ResourceLoader::loadDataURL):
1596         (WebCore::ResourceLoader::didFinishLoading):
1597         (WebCore::ResourceLoader::didFinishLoadingOnePart):
1598         * loader/ResourceLoader.h:
1599         * loader/ResourceTiming.cpp:
1600         (WebCore::ResourceTiming::fromLoad):
1601         (WebCore::ResourceTiming::fromSynchronousLoad):
1602         (WebCore::ResourceTiming::ResourceTiming):
1603         (WebCore::ResourceTiming::isolatedCopy):
1604         * loader/ResourceTiming.h:
1605         (WebCore::ResourceTiming::networkLoadMetrics):
1606         (WebCore::ResourceTiming::ResourceTiming):
1607         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
1608         * loader/SubresourceLoader.cpp:
1609         (WebCore::SubresourceLoader::SubresourceLoader):
1610         (WebCore::SubresourceLoader::willSendRequestInternal):
1611         (WebCore::SubresourceLoader::didReceiveResponse):
1612         (WebCore::SubresourceLoader::didFinishLoading):
1613         (WebCore::SubresourceLoader::reportResourceTiming):
1614         * loader/SubresourceLoader.h:
1615         * loader/ThreadableLoaderClient.h:
1616         (WebCore::ThreadableLoaderClient::didFinishLoading):
1617         * loader/ThreadableLoaderClientWrapper.h:
1618         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
1619         * loader/WorkerThreadableLoader.cpp:
1620         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1621         * loader/WorkerThreadableLoader.h:
1622         * loader/appcache/ApplicationCacheGroup.cpp:
1623         (WebCore::ApplicationCacheGroup::didFinishLoading):
1624         * loader/appcache/ApplicationCacheGroup.h:
1625         * loader/cache/CachedResource.h:
1626         (WebCore::CachedResource::setLoadFinishTime):
1627         * loader/ios/QuickLook.mm:
1628         (-[WebPreviewLoader connectionDidFinishLoading:]):
1629         * page/EventSource.cpp:
1630         (WebCore::EventSource::didFinishLoading):
1631         * page/EventSource.h:
1632         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1633         (ResourceHandleStreamingClient::didFinishLoading):
1634         * platform/network/BlobResourceHandle.cpp:
1635         (WebCore::doNotifyFinish):
1636         * platform/network/PingHandle.h:
1637         * platform/network/ResourceHandle.h:
1638         * platform/network/ResourceHandleClient.h:
1639         (WebCore::ResourceHandleClient::didFinishLoading):
1640         * platform/network/ResourceResponseBase.cpp:
1641         (WebCore::ResourceResponseBase::crossThreadData):
1642         (WebCore::ResourceResponseBase::fromCrossThreadData):
1643         (WebCore::ResourceResponseBase::compare):
1644         * platform/network/ResourceResponseBase.h:
1645         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
1646         (WebCore::ResourceResponseBase::encode):
1647         (WebCore::ResourceResponseBase::decode):
1648         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
1649         * platform/network/SynchronousLoaderClient.cpp:
1650         (WebCore::SynchronousLoaderClient::didFinishLoading):
1651         * platform/network/SynchronousLoaderClient.h:
1652         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1653         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1654         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
1655         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1656         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1657         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
1658         * platform/network/curl/ResourceHandleCurl.cpp:
1659         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
1660         * platform/network/curl/ResourceHandleManager.cpp:
1661         (WebCore::calculateWebTimingInformations):
1662         (WebCore::ResourceHandleManager::downloadTimerCallback):
1663         (WebCore::handleDataURL):
1664         (WebCore::milisecondsSinceRequest): Deleted.
1665         * platform/network/mac/ResourceHandleMac.mm:
1666         (WebCore::ResourceHandle::getConnectionTimingData):
1667         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1668         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1669         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
1670         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1671         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1672         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
1673         * platform/network/soup/ResourceHandleSoup.cpp:
1674         (WebCore::restartedCallback):
1675         (WebCore::nextMultipartResponsePartCallback):
1676         (WebCore::sendRequestCallback):
1677         (WebCore::ResourceHandle::didStartRequest):
1678         (WebCore::networkEventCallback):
1679         (WebCore::ResourceHandle::sendPendingRequest):
1680         (WebCore::readCallback):
1681         (WebCore::milisecondsSinceRequest): Deleted.
1682         * workers/WorkerScriptLoader.cpp:
1683         (WebCore::WorkerScriptLoader::didFinishLoading):
1684         * workers/WorkerScriptLoader.h:
1685         * xml/XMLHttpRequest.cpp:
1686         (WebCore::XMLHttpRequest::didFinishLoading):
1687         * xml/XMLHttpRequest.h:
1688         Eliminate the unused finishTime double.
1689
1690 2017-02-24  Chris Dumez  <cdumez@apple.com>
1691
1692         Unreviewed GTK build fix after r212965
1693
1694         * CMakeLists.txt:
1695
1696 2017-02-24  Chris Dumez  <cdumez@apple.com>
1697
1698         Unreviewed, rolling out r212944.
1699
1700         Caused a lot of failures on the debug bots
1701
1702         Reverted changeset:
1703
1704         "[Resource Timing] Gather timing information with reliable
1705         responseEnd time"
1706         https://bugs.webkit.org/show_bug.cgi?id=168351
1707         http://trac.webkit.org/changeset/212944
1708
1709 2017-02-24  Chris Dumez  <cdumez@apple.com>
1710
1711         Unreviewed, follow-up fix after r212972.
1712
1713         Fixes a few assertions on the debug build bots.
1714         URL needs to be exactly the same as the parsed one given
1715         that we are calling the ParsedURLString constructor.
1716
1717         * platform/network/ResourceResponseBase.cpp:
1718         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1719
1720 2017-02-24  Zalan Bujtas  <zalan@apple.com>
1721
1722         Simple line layout: Re-adjust paginated lines when block height changes.
1723         https://bugs.webkit.org/show_bug.cgi?id=168838
1724         <rdar://problem/30701233>
1725
1726         Reviewed by Antti Koivisto.
1727
1728         When the estimated block height is wrong, we issue an additional layout on the inline children
1729         so that we get the pagination right (this layout is setChildNeedsLayout(MarkOnlyThis) only).
1730         Since the height change only affects the struts and page breaks (and again, the relayoutChildren flag is false)
1731         we don't need to re-layout the content, but instead we just need to re-adjust the pagination for the simple lines. 
1732         This patch also moves the pagination logic to SimpleLineLayoutPagination.cpp.
1733
1734         Not enabled yet.
1735
1736         * CMakeLists.txt:
1737         * WebCore.xcodeproj/project.pbxproj:
1738         * rendering/RenderBlockFlow.cpp:
1739         (WebCore::RenderBlockFlow::layoutSimpleLines):
1740         * rendering/RenderingAllInOne.cpp:
1741         * rendering/SimpleLineLayout.cpp:
1742         (WebCore::SimpleLineLayout::canUseForWithReason):
1743         (WebCore::SimpleLineLayout::create):
1744         (WebCore::SimpleLineLayout::Layout::create):
1745         (WebCore::SimpleLineLayout::Layout::Layout):
1746         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Deleted.
1747         (WebCore::SimpleLineLayout::computeLineBreakIndex): Deleted.
1748         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak): Deleted.
1749         (WebCore::SimpleLineLayout::setPageBreakForLine): Deleted.
1750         (WebCore::SimpleLineLayout::updateMinimumPageHeight): Deleted.
1751         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): Deleted.
1752         * rendering/SimpleLineLayout.h:
1753         (WebCore::SimpleLineLayout::Layout::setIsPaginated):
1754         (WebCore::SimpleLineLayout::Layout::setLineStruts):
1755         * rendering/SimpleLineLayoutPagination.cpp: Added.
1756         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
1757         (WebCore::SimpleLineLayout::computeLineBreakIndex):
1758         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
1759         (WebCore::SimpleLineLayout::setPageBreakForLine):
1760         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
1761         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
1762         * rendering/SimpleLineLayoutPagination.h: Added.
1763
1764 2017-02-24  Jon Lee  <jonlee@apple.com>
1765
1766         Alias "system-ui" for the System font name
1767         https://bugs.webkit.org/show_bug.cgi?id=151493
1768
1769         Reviewed by Tim Horton and Joseph Pecoraro.
1770
1771         Updated existing tests.
1772
1773         * WebCore.xcodeproj/project.pbxproj: Add WebKitFontFamilyNames.in for
1774         convenience.
1775         * css/CSSValueKeywords.in: Add system-ui as a keyword.
1776         * css/WebKitFontFamilyNames.in: Add system-ui.
1777
1778         * platform/graphics/ios/FontCacheIOS.mm:
1779         (WebCore::platformFontWithFamilySpecialCase): Include "system-ui" as an
1780         alias.
1781         * platform/graphics/mac/FontCacheMac.mm:
1782         (WebCore::platformFontWithFamilySpecialCase): Ditto.
1783
1784         * rendering/RenderThemeMac.mm:
1785         (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Update
1786         serialization to "system-ui" from "-apple-system".
1787
1788         * css/CSSComputedStyleDeclaration.cpp:
1789         (WebCore::identifierForFamily):
1790         * css/CSSFontFaceSet.cpp:
1791         (WebCore::CSSFontFaceSet::familyNameFromPrimitive):
1792         * css/StyleBuilderCustom.h:
1793         (WebCore::StyleBuilderCustom::applyValueFontFamily):
1794
1795 2017-02-24  Matt Rajca  <mrajca@apple.com>
1796
1797         Media: notify clients when autoplay is denied
1798         https://bugs.webkit.org/show_bug.cgi?id=168840
1799
1800         Reviewed by Alex Christensen.
1801
1802         Added API tests.
1803
1804         * WebCore.xcodeproj/project.pbxproj:
1805         * html/HTMLMediaElement.cpp:
1806         (WebCore::HTMLMediaElement::setReadyState):
1807         (WebCore::HTMLMediaElement::play):
1808         (WebCore::HTMLMediaElement::playInternal):
1809         * page/AutoplayEvent.h: Added.
1810         * page/ChromeClient.h:
1811
1812 2017-02-24  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
1813
1814         curl: Improve errors by including the domain
1815         https://bugs.webkit.org/show_bug.cgi?id=134340
1816
1817         Reviewed by Alex Christensen.
1818
1819         Added proper error domain to ResourceError created by
1820         Curl problem.
1821
1822         * platform/network/curl/ResourceHandleManager.cpp:
1823         (WebCore::ResourceHandleManager::downloadTimerCallback):
1824         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
1825
1826 2017-02-24  Antoine Quint  <graouts@apple.com>
1827
1828         [Modern Media Controls] <audio> controls should center in their container when the page is scaled
1829         https://bugs.webkit.org/show_bug.cgi?id=168841
1830         <rdar://problem/28612794>
1831
1832         Reviewed by Eric Carlson.
1833
1834         When dealing with <audio> elements, we vertically center the controls relative to their containing
1835         media element such that if the controls visually overflow, they overflow equally above and below
1836         to minimize the likelihood of overlap with surrounding elements.
1837
1838         Test: media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html
1839
1840         * Modules/modern-media-controls/controls/media-controls.js:
1841         (MediaControls.prototype.get shouldCenterControlsVertically):
1842         (MediaControls.prototype.set shouldCenterControlsVertically):
1843         (MediaControls.prototype.commitProperty):
1844         * Modules/modern-media-controls/media/media-controller.js:
1845         (MediaController.prototype.get isAudio):
1846         (MediaController.prototype.get layoutTraits):
1847         (MediaController.prototype._updateControlsSize):
1848
1849 2017-02-24  Alex Christensen  <achristensen@webkit.org>
1850
1851         Non-special relative URLs should not ignore extra slashes
1852         https://bugs.webkit.org/show_bug.cgi?id=168834
1853
1854         Reviewed by Sam Weinig.
1855
1856         Special authority ignore slashes state should, as its name implies,
1857         only be reached by special URLs.  See https://url.spec.whatwg.org/#relative-slash-state
1858
1859         Covered by newly passing web platform tests.
1860
1861         * platform/URLParser.cpp:
1862         (WebCore::URLParser::parse):
1863
1864 2017-02-24  Alexey Proskuryakov  <ap@apple.com>
1865
1866         Build fix for newer clang
1867         https://bugs.webkit.org/show_bug.cgi?id=168849
1868         rdar://problem/30638741
1869
1870         Reviewed by Ryosuke Niwa.
1871
1872         * dom/Range.cpp: (WebCore::Range::toString): std::max(0, <unsigned>) is not meaningful,
1873         and now triggers a warning.
1874
1875 2017-02-24  Chris Dumez  <cdumez@apple.com>
1876
1877         Download attribute should be sanitized before being used as suggested filename
1878         https://bugs.webkit.org/show_bug.cgi?id=168839
1879         <rdar://problem/30683109>
1880
1881         Reviewed by Darin Adler.
1882
1883         Sanitize Download attribute before using it as a suggested filename for the download.
1884         We rely on ResourceResponse's sanitizing of the suggested filename to do so, which has
1885         the benefit of being consistent with downloads without the download attribute.
1886
1887         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
1888                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html
1889                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
1890
1891         * html/HTMLAnchorElement.cpp:
1892         (WebCore::HTMLAnchorElement::handleClick):
1893         * platform/network/ResourceResponseBase.cpp:
1894         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1895         * platform/network/ResourceResponseBase.h:
1896
1897 2017-02-24  Miguel Gomez  <magomez@igalia.com>
1898
1899         [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
1900         https://bugs.webkit.org/show_bug.cgi?id=165522
1901
1902         Reviewed by Carlos Garcia Campos.
1903
1904         Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
1905         in some nvidia drivers. Ensure that we set the context as current before performing
1906         that operation, and set the appropriate current context after doing so.
1907
1908         No new tests.
1909
1910         * platform/graphics/glx/GLContextGLX.cpp:
1911         (WebCore::GLContextGLX::~GLContextGLX):
1912
1913 2017-02-24  Chris Dumez  <cdumez@apple.com>
1914
1915         [iOS][WK2] Disable network cache speculative revalidation / loading in low power mode
1916         https://bugs.webkit.org/show_bug.cgi?id=168832
1917         <rdar://problem/30697911>
1918
1919         Reviewed by Antti Koivisto.
1920
1921         Add LowPowerModeNotifier class to monitor low power mode state on iOS.
1922
1923         * WebCore.xcodeproj/project.pbxproj:
1924         * platform/LowPowerModeNotifier.cpp: Added.
1925         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
1926         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
1927         * platform/LowPowerModeNotifier.h: Added.
1928         * platform/ios/LowPowerModeNotifierIOS.mm: Added.
1929         (-[WebLowPowerModeObserver initWithNotifier:]):
1930         (-[WebLowPowerModeObserver dealloc]):
1931         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
1932         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
1933         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
1934         (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
1935         (WebCore::notifyLowPowerModeChanged):
1936
1937 2017-02-24  Chris Dumez  <cdumez@apple.com>
1938
1939         [Mac] Report domains using abnormally high memory usage via enhanced privacy logging
1940         https://bugs.webkit.org/show_bug.cgi?id=168797
1941         <rdar://problem/29964017>
1942
1943         Reviewed by Andreas Kling.
1944
1945         Report domains using abnormally high memory usage (> 2GB) via enhanced privacy
1946         logging on Mac.
1947
1948         * page/DiagnosticLoggingKeys.cpp:
1949         (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey):
1950         * page/DiagnosticLoggingKeys.h:
1951         * page/PerformanceMonitor.cpp:
1952         (WebCore::reportPageOverPostLoadResourceThreshold):
1953         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
1954         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
1955         (WebCore::reportPageOverPostLoadCPUUsageThreshold): Deleted.
1956
1957 2017-02-24  Alex Christensen  <achristensen@webkit.org>
1958
1959         .. should not remove windows drive letters in paths of file URLs
1960         https://bugs.webkit.org/show_bug.cgi?id=168824
1961
1962         Reviewed by Youenn Fablet.
1963
1964         It's specified in https://url.spec.whatwg.org/#shorten-a-urls-path and helps behavior for browsers on Windows.
1965         It can't hurt to pass a few more web platform tests, though.
1966
1967         * platform/URLParser.cpp:
1968         (WebCore::URLParser::copyURLPartsUntil):
1969         (WebCore::URLParser::shouldPopPath):
1970         (WebCore::URLParser::popPath):
1971         (WebCore::URLParser::parse):
1972         * platform/URLParser.h:
1973
1974 2017-02-24  Csaba Osztrogon√°c  <ossy@webkit.org>
1975
1976         [Mac][cmake] Unreviewed buildfix after r212736.
1977
1978         * PlatformMac.cmake:
1979
1980 2017-02-24  John Wilander  <wilander@apple.com>
1981
1982         Resource Load Statistics: Add alternate classification method
1983         https://bugs.webkit.org/show_bug.cgi?id=168347
1984         <rdar://problem/30352793>
1985         <rdar://problem/30646710>
1986         <rdar://problem/30660708>
1987
1988         Reviewed by Alex Christensen.
1989
1990         This patch only adds test infrastructure in WebCore.
1991
1992         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
1993                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
1994                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
1995                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
1996                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
1997                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
1998                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
1999                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
2000
2001         * loader/ResourceLoadObserver.cpp:
2002         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
2003         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
2004         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
2005         * loader/ResourceLoadObserver.h:
2006
2007 2017-02-23  Antoine Quint  <graouts@apple.com>
2008
2009         [Modern Media Controls] No controls are shown for <audio preload="none">
2010         https://bugs.webkit.org/show_bug.cgi?id=168800
2011         <rdar://problem/30652142>
2012
2013         Reviewed by Eric Carlson.
2014
2015         A media element's currentSrc property will only be set when data has started
2016         to load. In the case where preload="none" is used, regardless of whether a
2017         source is specified, currentSrc would be the empty string and we wouldn't
2018         show controls at all. Identifying whether a source is specified is a little
2019         tricky because it could be specified in a variety of ways and dynamically
2020         as well.
2021
2022         So instead we optimistically show controls always provided the "controls"
2023         attribute is set.
2024
2025         * Modules/modern-media-controls/media/controls-visibility-support.js:
2026         (ControlsVisibilitySupport.prototype._updateControls):
2027         (ControlsVisibilitySupport):
2028         * Modules/modern-media-controls/media/start-support.js:
2029         (StartSupport.prototype._shouldShowStartButton):
2030         (StartSupport):
2031
2032 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
2033
2034         [Resource Timing] Gather timing information with reliable responseEnd time
2035         https://bugs.webkit.org/show_bug.cgi?id=168351
2036
2037         Reviewed by Alex Christensen.
2038
2039         This patch replaces the unused `double finishTime` in ResourceLoader's
2040         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
2041         allows the NetworkProcess to give complete timing information, and more
2042         final metrics about the load, to WebCore. Currently this is only used
2043         by ResourceTiming, but it will soon be used by Web Inspector as well.
2044         We may also end up extending this to the didFail path as well, since it
2045         is possible that we have some metrics for load failures.
2046
2047         At the same time we want to start moving away from the legacy path that
2048         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
2049         It doesn't make sense to store this information on the ResourceResponse
2050         for a few reasons: We don't want to store the metrics in our Network Cache and
2051         not all of the load timing metrics have been populated yet (responseEnd).
2052         In an effort to move off of this data we've renamed the accessor to
2053         "deprecatedNetworkLoadMetrics". There are a few remaining clients
2054         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
2055         migrated separately from this patch.
2056
2057         Having both the legacy and new code paths adds a little bit of complexity.
2058         One advantage of the new path is that the complete load timing data
2059         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
2060         be packaged together. The legacy path could not include a responseEnd, so
2061         WebCore faked that value with its own timestamp. Having the fake responseEnd
2062         caused issues as timestamps / clocks are different between processes. In order
2063         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
2064         has the complete network timing metrics it checks isComplete(). If true
2065         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
2066         it must fallback to the legacy value from LoadTiming. Once all of the
2067         deprecatedNetworkLoadMetrics clients go away, we should always have the
2068         complete data and this can be eliminated.
2069
2070         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
2071                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
2072
2073         * PlatformMac.cmake:
2074         * WebCore.xcodeproj/project.pbxproj:
2075         Rename NetworkLoadTiming -> NetworkLoadMetrics.
2076
2077         * page/PerformanceResourceTiming.cpp:
2078         (WebCore::entryStartTime):
2079         (WebCore::entryEndTime):
2080         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2081         (WebCore::PerformanceResourceTiming::nextHopProtocol):
2082         (WebCore::PerformanceResourceTiming::domainLookupStart):
2083         (WebCore::PerformanceResourceTiming::domainLookupEnd):
2084         (WebCore::PerformanceResourceTiming::connectStart):
2085         (WebCore::PerformanceResourceTiming::connectEnd):
2086         (WebCore::PerformanceResourceTiming::secureConnectionStart):
2087         (WebCore::PerformanceResourceTiming::requestStart):
2088         (WebCore::PerformanceResourceTiming::responseStart):
2089         (WebCore::PerformanceResourceTiming::responseEnd):
2090         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
2091         * page/PerformanceResourceTiming.h:
2092         Mostly just updating names and types. This does however need to get the
2093         correct endTime based on whether the NetworkLoadMetrics are complete
2094         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
2095
2096         * page/PerformanceResourceTiming.idl:
2097         Add nextHopProtocol.
2098
2099         * page/PerformanceTiming.cpp:
2100         (WebCore::PerformanceTiming::domainLookupStart):
2101         (WebCore::PerformanceTiming::domainLookupEnd):
2102         (WebCore::PerformanceTiming::connectStart):
2103         (WebCore::PerformanceTiming::connectEnd):
2104         (WebCore::PerformanceTiming::secureConnectionStart):
2105         (WebCore::PerformanceTiming::requestStart):
2106         (WebCore::PerformanceTiming::responseStart):
2107         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
2108         * page/PerformanceTiming.h:
2109         Navigation Timing values still uses the NetworkLoadTiming values stored on
2110         the DocumentLoader. This should be moved off of the deprecated path separately.
2111
2112         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
2113         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
2114         (WebCore::NetworkLoadMetrics::isolatedCopy):
2115         (WebCore::NetworkLoadMetrics::reset):
2116         (WebCore::NetworkLoadMetrics::operator==):
2117         (WebCore::NetworkLoadMetrics::operator!=):
2118         (WebCore::NetworkLoadMetrics::isComplete):
2119         (WebCore::NetworkLoadMetrics::markComplete):
2120         (WebCore::NetworkLoadMetrics::encode):
2121         (WebCore::NetworkLoadMetrics::decode):
2122         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
2123         Add protocolName and "complete" boolean.
2124
2125         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
2126         (WebCore::timingValue):
2127         (WebCore::copyTimingData):
2128         (WebCore::setCollectsTimingData):
2129         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
2130         Since we already have to modify all the clients this moves us to use the more
2131         strongly typed units that are less ambiguous then "double". The rest of the
2132         Performance API has already moved to these units.
2133
2134         * inspector/InspectorNetworkAgent.cpp:
2135         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
2136         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2137         (WebCore::InspectorNetworkAgent::didFinishLoading):
2138         * inspector/InspectorNetworkAgent.h:
2139         Inspector was the only client of the finishTime, and since the value was
2140         erratically coming from clients in different ways it was almost certainly
2141         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
2142
2143         * Modules/fetch/FetchLoader.cpp:
2144         (WebCore::FetchLoader::didFinishLoading):
2145         * Modules/fetch/FetchLoader.h:
2146         * fileapi/FileReaderLoader.cpp:
2147         (WebCore::FileReaderLoader::didFinishLoading):
2148         * fileapi/FileReaderLoader.h:
2149         * html/MediaFragmentURIParser.cpp:
2150         (WebCore::MediaFragmentURIParser::parseNPTTime):
2151         * inspector/InspectorInstrumentation.cpp:
2152         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
2153         * inspector/InspectorInstrumentation.h:
2154         (WebCore::InspectorInstrumentation::didFinishLoading):
2155         * loader/CrossOriginPreflightChecker.cpp:
2156         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2157         * loader/DocumentLoader.cpp:
2158         (WebCore::DocumentLoader::notifyFinished):
2159         (WebCore::DocumentLoader::finishedLoading):
2160         (WebCore::DocumentLoader::continueAfterContentPolicy):
2161         (WebCore::DocumentLoader::maybeLoadEmpty):
2162         * loader/DocumentLoader.h:
2163         * loader/DocumentThreadableLoader.cpp:
2164         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2165         (WebCore::DocumentThreadableLoader::notifyFinished):
2166         (WebCore::DocumentThreadableLoader::didFinishLoading):
2167         (WebCore::DocumentThreadableLoader::loadRequest):
2168         * loader/DocumentThreadableLoader.h:
2169         * loader/NetscapePlugInStreamLoader.cpp:
2170         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
2171         * loader/NetscapePlugInStreamLoader.h:
2172         * loader/ResourceLoadNotifier.cpp:
2173         (WebCore::ResourceLoadNotifier::didFinishLoad):
2174         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2175         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
2176         * loader/ResourceLoadNotifier.h:
2177         * loader/ResourceLoader.cpp:
2178         (WebCore::ResourceLoader::deliverResponseAndData):
2179         (WebCore::ResourceLoader::loadDataURL):
2180         (WebCore::ResourceLoader::didFinishLoading):
2181         (WebCore::ResourceLoader::didFinishLoadingOnePart):
2182         * loader/ResourceLoader.h:
2183         * loader/ResourceTiming.cpp:
2184         (WebCore::ResourceTiming::fromLoad):
2185         (WebCore::ResourceTiming::fromSynchronousLoad):
2186         (WebCore::ResourceTiming::ResourceTiming):
2187         (WebCore::ResourceTiming::isolatedCopy):
2188         * loader/ResourceTiming.h:
2189         (WebCore::ResourceTiming::networkLoadMetrics):
2190         (WebCore::ResourceTiming::ResourceTiming):
2191         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
2192         * loader/SubresourceLoader.cpp:
2193         (WebCore::SubresourceLoader::SubresourceLoader):
2194         (WebCore::SubresourceLoader::willSendRequestInternal):
2195         (WebCore::SubresourceLoader::didReceiveResponse):
2196         (WebCore::SubresourceLoader::didFinishLoading):
2197         (WebCore::SubresourceLoader::reportResourceTiming):
2198         * loader/SubresourceLoader.h:
2199         * loader/ThreadableLoaderClient.h:
2200         (WebCore::ThreadableLoaderClient::didFinishLoading):
2201         * loader/ThreadableLoaderClientWrapper.h:
2202         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
2203         * loader/WorkerThreadableLoader.cpp:
2204         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
2205         * loader/WorkerThreadableLoader.h:
2206         * loader/appcache/ApplicationCacheGroup.cpp:
2207         (WebCore::ApplicationCacheGroup::didFinishLoading):
2208         * loader/appcache/ApplicationCacheGroup.h:
2209         * loader/cache/CachedResource.h:
2210         (WebCore::CachedResource::setLoadFinishTime):
2211         * loader/ios/QuickLook.mm:
2212         (-[WebPreviewLoader connectionDidFinishLoading:]):
2213         * page/EventSource.cpp:
2214         (WebCore::EventSource::didFinishLoading):
2215         * page/EventSource.h:
2216         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2217         (ResourceHandleStreamingClient::didFinishLoading):
2218         * platform/network/BlobResourceHandle.cpp:
2219         (WebCore::doNotifyFinish):
2220         * platform/network/PingHandle.h:
2221         * platform/network/ResourceHandle.h:
2222         * platform/network/ResourceHandleClient.h:
2223         (WebCore::ResourceHandleClient::didFinishLoading):
2224         * platform/network/ResourceResponseBase.cpp:
2225         (WebCore::ResourceResponseBase::crossThreadData):
2226         (WebCore::ResourceResponseBase::fromCrossThreadData):
2227         (WebCore::ResourceResponseBase::compare):
2228         * platform/network/ResourceResponseBase.h:
2229         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
2230         (WebCore::ResourceResponseBase::encode):
2231         (WebCore::ResourceResponseBase::decode):
2232         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
2233         * platform/network/SynchronousLoaderClient.cpp:
2234         (WebCore::SynchronousLoaderClient::didFinishLoading):
2235         * platform/network/SynchronousLoaderClient.h:
2236         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2237         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2238         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
2239         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2240         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
2241         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
2242         * platform/network/curl/ResourceHandleCurl.cpp:
2243         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
2244         * platform/network/curl/ResourceHandleManager.cpp:
2245         (WebCore::calculateWebTimingInformations):
2246         (WebCore::ResourceHandleManager::downloadTimerCallback):
2247         (WebCore::handleDataURL):
2248         (WebCore::milisecondsSinceRequest): Deleted.
2249         * platform/network/mac/ResourceHandleMac.mm:
2250         (WebCore::ResourceHandle::getConnectionTimingData):
2251         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2252         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
2253         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
2254         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2255         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2256         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
2257         * platform/network/soup/ResourceHandleSoup.cpp:
2258         (WebCore::restartedCallback):
2259         (WebCore::nextMultipartResponsePartCallback):
2260         (WebCore::sendRequestCallback):
2261         (WebCore::ResourceHandle::didStartRequest):
2262         (WebCore::networkEventCallback):
2263         (WebCore::ResourceHandle::sendPendingRequest):
2264         (WebCore::readCallback):
2265         (WebCore::milisecondsSinceRequest): Deleted.
2266         * workers/WorkerScriptLoader.cpp:
2267         (WebCore::WorkerScriptLoader::didFinishLoading):
2268         * workers/WorkerScriptLoader.h:
2269         * xml/XMLHttpRequest.cpp:
2270         (WebCore::XMLHttpRequest::didFinishLoading):
2271         * xml/XMLHttpRequest.h:
2272         Eliminate the unused finishTime double.
2273
2274 2017-02-23  Antoine Quint  <graouts@apple.com>
2275
2276         [Modern Media Controls] Controls overflow when media element has border or padding
2277         https://bugs.webkit.org/show_bug.cgi?id=168818
2278         <rdar://problem/30689780>
2279
2280         Reviewed by Jon Lee.
2281
2282         We used to query the media element's layout size to compute the size of the media controls,
2283         which would account for border and padding. Instead, we should use the size of the container,
2284         at the root of the ShadowRoot, which will always match the size of the media.
2285
2286         Test: media/modern-media-controls/media-controller/media-controller-controls-sizing-with-border-and-padding.html
2287
2288         * Modules/modern-media-controls/controls/media-controls.css:
2289         (.media-controls-container,):
2290         * Modules/modern-media-controls/media/media-controller.js:
2291         (MediaController.prototype._updateControlsSize):
2292         (MediaController.prototype._controlsWidth):
2293
2294 2017-02-23  Antoine Quint  <graouts@apple.com>
2295
2296         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
2297         https://bugs.webkit.org/show_bug.cgi?id=168820
2298         <rdar://problem/30690281>
2299
2300         Reviewed by Jon Lee.
2301
2302         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
2303         event target when initiating a drag is the controls bar itself and not some of its content.
2304
2305         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
2306         starting over one of the controls and notice that no dragging occurs.
2307
2308         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
2309
2310         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2311         (MacOSFullscreenMediaControls.prototype._handleMousedown):
2312
2313 2017-02-23  Simon Fraser  <simon.fraser@apple.com>
2314
2315         REGRESSION (r211305): Masks on composited elements with preserve-3d broken
2316         https://bugs.webkit.org/show_bug.cgi?id=168815
2317         rdar://problem/30676846
2318
2319         Reviewed by Jon Lee.
2320
2321         r211305 moved the mask layer to be on the structural layer if there is one, to fix
2322         masking backdrops. However, with preserve-3d the structural layer can be a CATransformLayer,
2323         which doesn't take a mask, so limit the previous change to backdrops only.
2324
2325         Test: compositing/masks/mask-with-preserve-3d.html
2326
2327         * platform/graphics/ca/GraphicsLayerCA.cpp:
2328         (WebCore::GraphicsLayerCA::updateMaskLayer):
2329
2330 2017-02-23  Antoine Quint  <graouts@apple.com>
2331
2332         [Modern Media Controls] Show "Loading" until playback starts
2333         https://bugs.webkit.org/show_bug.cgi?id=168809
2334         <rdar://problem/30687468>
2335
2336         Reviewed by Jon Lee.
2337
2338         We now display the "Loading" status as soon as we've started loading and
2339         until we've obtained enough data to play. No test provided since we don't
2340         have a way to specifically set networkState and readyState to the satisfactory
2341         values.
2342
2343         * Modules/modern-media-controls/media/status-support.js:
2344         (StatusSupport.prototype.syncControl):
2345         (StatusSupport):
2346
2347 2017-02-23  Antoine Quint  <graouts@apple.com>
2348
2349         [Modern Media Controls] Enforce a minimum layout height of 50pt for <audio>
2350         https://bugs.webkit.org/show_bug.cgi?id=168801
2351         <rdar://problem/30683453>
2352
2353         Reviewed by Eric Carlson.
2354
2355         We enforce a 50pt minimum layout height for <audio> elements. There is no way
2356         for the page author to override this value since the min-height property is set
2357         as !important in a <style> element contained in a ShadowRoot.
2358
2359         * Modules/modern-media-controls/controls/media-controls.css:
2360         (:host(audio)):
2361
2362 2017-02-23  Youenn Fablet  <youenn@apple.com>
2363
2364         [WebRTC] Outgoing video quality is poor
2365         https://bugs.webkit.org/show_bug.cgi?id=168778
2366         <rdar://problem/30674673>
2367
2368         Reviewed by Eric Carlson.
2369
2370         Covered by manually ensuring the voice process thread is not spinning.
2371
2372         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Setting the next call to max was not a good idea since the thread process is adding some value to it, making it a negative value.
2373
2374 2017-02-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2375
2376         Data interaction with a URL should navigate the page if the operation is not handled
2377         https://bugs.webkit.org/show_bug.cgi?id=168798
2378         <rdar://problem/30665969>
2379
2380         Reviewed by Tim Horton.
2381
2382         Refactors some drag and drop code on the Mac, and implements PlatformPasteboard::stringForType.
2383
2384         * page/DragController.cpp:
2385         (WebCore::DragController::performDragOperation):
2386         * platform/ios/PlatformPasteboardIOS.mm:
2387         (WebCore::PlatformPasteboard::stringForType):
2388         * platform/mac/DragDataMac.mm:
2389
2390 2017-02-23  Youenn Fablet  <youenn@apple.com>
2391
2392         [WebRTC] RealtimeOutgoingAudioSource does not need to upsample audio buffers
2393         https://bugs.webkit.org/show_bug.cgi?id=168796
2394
2395         Reviewed by Jer Noble.
2396
2397         Covered by manual testing.
2398         Limiting RealtimeOutgoingAudioSource conversion to interleaving and float-to-integer.
2399         Removed the sample rate conversion.
2400
2401         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2402         (WebCore::libwebrtcAudioFormat):
2403         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2404         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2405
2406 2017-02-23  Alex Christensen  <achristensen@webkit.org>
2407
2408         Re-soft-link CoreVideo after r212906
2409         https://bugs.webkit.org/show_bug.cgi?id=168803
2410
2411         Reviewed by Jer Noble.
2412
2413         CoreVideo should be soft linked to reduce startup time.
2414         Linking against the framework just for a few symbols used in one file was the wrong solution.
2415
2416         * Configurations/WebCore.xcconfig:
2417         * platform/cocoa/CoreVideoSoftLink.cpp:
2418         * platform/cocoa/CoreVideoSoftLink.h:
2419         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2420
2421 2017-02-23  Chris Dumez  <cdumez@apple.com>
2422
2423         Report domains using abnormally high CPU usage via enhanced privacy logging
2424         https://bugs.webkit.org/show_bug.cgi?id=168794
2425         <rdar://problem/29964018>
2426
2427         Reviewed by Ryosuke Niwa.
2428
2429         Report domains using abnormally high CPU usage (> 20%) via enhanced privacy
2430         logging.
2431
2432         * page/DiagnosticLoggingKeys.cpp:
2433         (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey):
2434         * page/DiagnosticLoggingKeys.h:
2435         * page/PerformanceMonitor.cpp:
2436         (WebCore::reportPageOverPostLoadCPUUsageThreshold):
2437         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
2438
2439 2017-02-23  Zalan Bujtas  <zalan@apple.com>
2440
2441         Simple line layout: Adjust RunResolver::lineIndexForHeight with line struts.
2442         https://bugs.webkit.org/show_bug.cgi?id=168783
2443         <rdar://problem/30676449>
2444
2445         Reviewed by Antti Koivisto.
2446
2447         When there's a pagination gap between lines the simple lineIndex = y / lineHeight formula does not work anymore.
2448         This patch takes the line gaps into account by offsetting the y position accordingly.
2449
2450         Not enabled yet.
2451
2452         * rendering/SimpleLineLayoutResolver.cpp:
2453         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
2454
2455 2017-02-23  Alex Christensen  <achristensen@webkit.org>
2456
2457         Fix iOS WebRTC build after r212812
2458         https://bugs.webkit.org/show_bug.cgi?id=168790
2459
2460         Reviewed by Tim Horton.
2461
2462         * Configurations/WebCore.xcconfig:
2463
2464 2017-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2465
2466         [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
2467         https://bugs.webkit.org/show_bug.cgi?id=167016
2468
2469         Reviewed by Xabier Rodriguez-Calvar.
2470
2471         This is because we create AudioSourceProviderGStreamer objects that are never loaded. In the destructor the
2472         AudioSourceProviderGStreamer calls gst_bin_get_by_name() on its m_audioSinkBin that is nullptr. We could simply
2473         check m_audioSinkBin in the destructor, but I think it's better to simply not create
2474         AudioSourceProviderGStreamer for nothing. MediaPlayerPrivateGStreamer should create the AudioSourceProvider on demand.
2475
2476         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2477         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Do not create the AudioSourceProvider.
2478         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Call ensureAudioSourceProvider() before using m_audioSourceProvider.
2479         (WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider): Create the AudioSourceProvider if needed.
2480         (WebCore::MediaPlayerPrivateGStreamer::audioSourceProvider): Ensure and return the m_audioSourceProvider.
2481         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2482
2483 2017-02-23  Tomas Popela  <tpopela@redhat.com>
2484
2485         [GTK] Drag and drop is always moving the content even if copy is requested
2486         https://bugs.webkit.org/show_bug.cgi?id=168424
2487
2488         Reviewed by Carlos Garcia Campos.
2489
2490         Drag and drop is always moving the content around even if the copy is
2491         requested (i.e. by pressing the Control key).
2492
2493         Test: editing/pasteboard/drag-drop-copy-content.html
2494
2495         * page/gtk/DragControllerGtk.cpp:
2496         (WebCore::DragController::isCopyKeyDown):
2497
2498 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
2499
2500         [Cocoa] Remove Yosemite-specific font lookup code
2501         https://bugs.webkit.org/show_bug.cgi?id=168682
2502
2503         Reviewed by Zalan Bujtas.
2504
2505         No new tests because there is no behavior change.
2506
2507         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2508         (WebCore::platformFontLookupWithFamily):
2509         (WebCore::fontWithFamily):
2510         * platform/graphics/mac/FontCacheMac.mm:
2511         (WebCore::platformInvalidateFontCache):
2512         (WebCore::acceptableChoice): Deleted.
2513         (WebCore::betterChoice): Deleted.
2514         (WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
2515         (WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
2516         (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
2517         (WebCore::toAppKitFontWeight): Deleted.
2518         (WebCore::appkitWeightToFontWeight): Deleted.
2519         (WebCore::toNSFontTraits): Deleted.
2520         (WebCore::platformFontWithFamily): Deleted.
2521
2522 2017-02-22  Antoine Quint  <graouts@apple.com>
2523
2524         [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS
2525         https://bugs.webkit.org/show_bug.cgi?id=168755
2526         <rdar://problem/30664484>
2527
2528         Reviewed by Dean Jackson.
2529
2530         We now call super in the handleEvent() method of MacOSFullscreenMediaControls if we're not dealing
2531         with an event type and target combination that was specifically registered in this class's scope.
2532         We had mistakenly added the call to super.handleEvent(event) in the wrong method when fixing
2533         https://bugs.webkit.org/show_bug.cgi?id=168515.
2534
2535         Test: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html
2536
2537         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2538         (MacOSFullscreenMediaControls.prototype.handleEvent):
2539         (MacOSFullscreenMediaControls.prototype._handleMousedown):
2540         * Modules/modern-media-controls/controls/macos-media-controls.js:
2541         (MacOSMediaControls.prototype.handleEvent):
2542         (MacOSMediaControls):
2543
2544 2017-02-22  Antoine Quint  <graouts@apple.com>
2545
2546         [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
2547         https://bugs.webkit.org/show_bug.cgi?id=168518
2548         <rdar://problem/30577637>
2549
2550         Reviewed by Dean Jackson.
2551
2552         As we start to scrub, controlValueWillStartChanging() is called on
2553         ScrubberSupport and pauses the media if it's not already paused. This
2554         causes the play/pause button to change icon and for layout() to be
2555         called on MacOSInlineMediaControls. This in turns sets the .children
2556         property on the .controlsBar and eventually yields a DOM manipulation
2557         which re-inserts the scrubber's DOM hierarchy, causing stutters during
2558         user interaction.
2559
2560         Our solution is to make the .children setter smarter about identifying
2561         that the children list hasn't changed and that no DOM invalidation is
2562         necessary.
2563
2564         * Modules/modern-media-controls/controls/layout-node.js:
2565         (LayoutNode.prototype.set children):
2566
2567 2017-02-22  Antoine Quint  <graouts@apple.com>
2568
2569         [Modern Media Controls] Controls bar may disappear while captions menu is visible
2570         https://bugs.webkit.org/show_bug.cgi?id=168751
2571         <rdar://problem/30663411>
2572
2573         Reviewed by Dean Jackson.
2574
2575         We now prevent the controls bar from fading out due to the auto-hide timer firing
2576         when the tracks panel is up, and wait until the track panel is hidden before fading
2577         the controls bar.
2578
2579         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html
2580
2581         * Modules/modern-media-controls/controls/controls-bar.js:
2582         (ControlsBar.prototype.set userInteractionEnabled):
2583         (ControlsBar.prototype._autoHideTimerFired):
2584
2585 2017-02-22  Antoine Quint  <graouts@apple.com>
2586
2587         [Modern Media Controls] Can't set the volume slider with macOS inline controls
2588         https://bugs.webkit.org/show_bug.cgi?id=168747
2589         <rdar://problem/30605528>
2590
2591         Reviewed by Dean Jackson.
2592
2593         Only call super for events we haven't registered specifically in the context
2594         of this class. Otherwise we'd invalidate the volume container visibility for
2595         a "mousedown" event registered by the MacOSMediaControls, the super class.
2596
2597         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2598         (MacOSInlineMediaControls.prototype.handleEvent):
2599
2600 2017-02-22  Antti Koivisto  <antti@apple.com>
2601
2602         Replace SimpleLineLayout::Range by WTF::IteratorRange
2603         https://bugs.webkit.org/show_bug.cgi?id=168742
2604
2605         Reviewed by Zalan Bujtas.
2606
2607         Kill a redundant custom type.
2608
2609         * rendering/SimpleLineLayoutResolver.cpp:
2610         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
2611         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
2612         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
2613         * rendering/SimpleLineLayoutResolver.h:
2614         (WebCore::SimpleLineLayout::LineResolver::rangeForRect):
2615         (WebCore::SimpleLineLayout::Range::Range): Deleted.
2616         (WebCore::SimpleLineLayout::Range::begin): Deleted.
2617         (WebCore::SimpleLineLayout::Range::end): Deleted.
2618
2619 2017-02-22  Simon Fraser  <simon.fraser@apple.com>
2620
2621         Add the Web Authentication API as "Under Consideration".
2622
2623         * features.json:
2624
2625 2017-02-22  Zalan Bujtas  <zalan@apple.com>
2626
2627         Simple line layout: Set the pagination strut on the flow when the first line does not fit the page.
2628         https://bugs.webkit.org/show_bug.cgi?id=168738
2629         <rdar://problem/30659469>
2630
2631         Reviewed by Antti Koivisto.
2632
2633         The pagination strut for the first line is tracked by the parent RenderBlockFlow and not by
2634         the line itself (see RenderBlockFlow::adjustLinePositionForPagination()). Also renamed *PaginationStrut* to
2635         *LineStrut* to make sure we don't confuse it with the block level strut.
2636
2637         Not enabled yet.
2638
2639         * rendering/SimpleLineLayout.cpp:
2640         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
2641         (WebCore::SimpleLineLayout::computeLineBreakIndex):
2642         (WebCore::SimpleLineLayout::setPageBreakForLine):
2643         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2644         (WebCore::SimpleLineLayout::create):
2645         (WebCore::SimpleLineLayout::Layout::create):
2646         (WebCore::SimpleLineLayout::Layout::Layout):
2647         * rendering/SimpleLineLayout.h:
2648         (WebCore::SimpleLineLayout::Layout::hasLineStruts):
2649         (WebCore::SimpleLineLayout::Layout::struts):
2650         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts): Deleted.
2651         * rendering/SimpleLineLayoutFunctions.cpp:
2652         (WebCore::SimpleLineLayout::paintFlow):
2653         * rendering/SimpleLineLayoutFunctions.h:
2654         (WebCore::SimpleLineLayout::computeFlowHeight):
2655         * rendering/SimpleLineLayoutResolver.h:
2656         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
2657
2658 2017-02-22  Youenn Fablet  <youenn@apple.com>
2659
2660         [WebRTC] Disable libwebrtc stderr logging in release mode
2661         https://bugs.webkit.org/show_bug.cgi?id=168734
2662
2663         Reviewed by Tim Horton.
2664
2665         No change of behavior.
2666
2667         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2668         (WebCore::initializePeerConnectionFactoryAndThreads):
2669
2670 2017-02-22  Jer Noble  <jer.noble@apple.com>
2671
2672         MediaStreamSourceNode never receives audio from MockRealtimeAudioSourceMac.
2673         https://bugs.webkit.org/show_bug.cgi?id=168731
2674
2675         Reviewed by Eric Carlson.
2676
2677         Test: fast/mediastream/mock-media-source-webaudio.html
2678
2679         Because the audioSourceProvider can be created before the mock source is configured, explicitly configure the
2680         source if necessary after creating the audioSourceProvider.
2681
2682         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2683         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
2684
2685 2017-02-22  Chris Dumez  <cdumez@apple.com>
2686
2687         Do not aggressively throttle DOM timers until they've reached their max nesting level
2688         https://bugs.webkit.org/show_bug.cgi?id=168700
2689         <rdar://problem/29808005>
2690
2691         Reviewed by Simon Fraser.
2692
2693         Do not aggressively throttle DOM timers until they've actually areached their max
2694         nesting level (5). This overly aggressive throttling of non-nested timers is what
2695         was causing Google Maps to use 100% CPU in background tabs for several minutes.
2696
2697         Test: fast/dom/timer-throttling-hidden-page-non-nested.html
2698
2699         * dom/Document.cpp:
2700         (WebCore::Document::timerAlignmentInterval):
2701
2702 2017-02-22  Eric Carlson  <eric.carlson@apple.com>
2703
2704         [MediaStream iOS] Respond to capture interruptions and notifications
2705         https://bugs.webkit.org/show_bug.cgi?id=168610
2706
2707         Reviewed by Jer Noble.
2708
2709         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2710         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup: don't create
2711         a sample buffer display layer unless there is an active video track.
2712
2713         * platform/mediastream/mac/AVMediaCaptureSource.h:
2714         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2715         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Add static_asserts to ensure that
2716         WebCore::InterruptionReason values map directly to AVCaptureSessionInterruptionReason values.
2717         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource): Minor cleanup.
2718         (WebCore::AVMediaCaptureSource::startProducingData): Start listening for notifications before
2719         starting the session.
2720         (WebCore::AVMediaCaptureSource::stopProducingData): Remove the notification observers before
2721         stopping the session.
2722         (WebCore::AVMediaCaptureSource::setupSession): Minor style cleanup.
2723         (WebCore::AVMediaCaptureSource::captureSessionRuntimeError): New. When the error is AVErrorMediaServicesWereReset,
2724         sometimes caused by a mediaserverd crash, try to restart the session one time.
2725         (WebCore::AVMediaCaptureSource::captureSessionBeginInterruption): Store the interruption reason.
2726         (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Try to restart the session if
2727         it was interrupted because the app went into multi-app layout mode.
2728         (WebCore::sessionKVOProperties): Drive-by cleanup.
2729         (-[WebCoreAVMediaCaptureSourceObserver initWithCallback:]):
2730         (-[WebCoreAVMediaCaptureSourceObserver disconnect]):
2731         (-[WebCoreAVMediaCaptureSourceObserver addNotificationObservers]):
2732         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]):
2733         (-[WebCoreAVMediaCaptureSourceObserver sessionRuntimeError:]):
2734         (-[WebCoreAVMediaCaptureSourceObserver beginSessionInterrupted:]):
2735         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
2736
2737         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2738         (WebCore::AVVideoCaptureSource::initializeCapabilities): Not all AVCaptureSession preset strings
2739         are available on all platforms so load with SOFT_LINK_POINTER_OPTIONAL and NULL check before use.
2740         (WebCore::sizeForPreset): Ditto.
2741         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Ditto.
2742
2743 2017-02-22  Zalan Bujtas  <zalan@apple.com>
2744
2745         Simple line layout: ensureLineBoxes for paginated content.
2746         https://bugs.webkit.org/show_bug.cgi?id=168729
2747         <rdar://problem/30654400>
2748
2749         Reviewed by Antti Koivisto.
2750
2751         This patch sets the layout state bits for paginated subtree layout, when we are switching
2752         over from simple line runs to inline tree. 
2753
2754         Not enabled yet.
2755
2756         * rendering/RenderBlockFlow.cpp:
2757         (WebCore::RenderBlockFlow::ensureLineBoxes):
2758         * rendering/RenderView.cpp:
2759         (WebCore::RenderView::pushLayoutStateForPagination): LayoutUnit(1) is not the real height, it's just
2760         an indicator that we've got paginated content.
2761         * rendering/RenderView.h:
2762         * rendering/SimpleLineLayout.cpp:
2763         (WebCore::SimpleLineLayout::create):
2764         (WebCore::SimpleLineLayout::Layout::create):
2765         (WebCore::SimpleLineLayout::Layout::Layout):
2766         * rendering/SimpleLineLayout.h:
2767         (WebCore::SimpleLineLayout::Layout::isPaginated):
2768         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts):
2769         * rendering/SimpleLineLayoutFunctions.h:
2770         (WebCore::SimpleLineLayout::computeFlowHeight):
2771         * rendering/SimpleLineLayoutResolver.h:
2772         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
2773
2774 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
2775
2776         [Win] Compile fix.
2777         https://bugs.webkit.org/show_bug.cgi?id=168713
2778
2779         Reviewed by Brent Fulgham.
2780
2781         The include file <ANGLE/ShaderLang.h> is not found.
2782
2783         * testing/Internals.cpp:
2784
2785 2017-02-22  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2786
2787         [GStreamer][EME] Fix issue with allowed systems extraction
2788         https://bugs.webkit.org/show_bug.cgi?id=168717
2789
2790         Reviewed by Carlos Garcia Campos.
2791
2792         The allowed systems were not being extracted from the need-context
2793         message because the loop was not stopping on the right condition.
2794
2795         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2796         (WebCore::extractEventsAndSystemsFromMessage): Fix wrong
2797         condition.
2798         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
2799         Add better debug category.
2800
2801 2017-02-22  Antti Koivisto  <antti@apple.com>
2802
2803         REGRESSION(r207669): Crash after mutating selector text
2804         https://bugs.webkit.org/show_bug.cgi?id=168655
2805         <rdar://problem/30632111>
2806
2807         Reviewed by Andreas Kling.
2808
2809         Test: fast/css/selector-text-mutation-crash.html
2810
2811         * style/StyleScope.cpp:
2812         (WebCore::Style::Scope::resolver):
2813         (WebCore::Style::Scope::updateStyleResolver):
2814
2815         Protect against entering scheduleUpdate and wiping style resolver while updating it.
2816         Extension stylesheets can trigger this.
2817
2818         (WebCore::Style::Scope::scheduleUpdate):
2819
2820         Clear the style resolver immediately if style sheet content changes. The resolver may
2821         have data structures that point to the old sheet contents.
2822
2823         The resolver would get wiped anyway when the scheduled update actually occurs.
2824
2825         * style/StyleScope.h:
2826
2827 2017-02-08  Sergio Villar Senin  <svillar@igalia.com>
2828
2829         [css-grid] Move the track sizing algorithm to its own class
2830         https://bugs.webkit.org/show_bug.cgi?id=167988
2831
2832         Reviewed by Manuel Rego Casasnovas.
2833
2834         This is about moving the track sizing algorithm code out of RenderGrid to a new class
2835         GridTrackSizingAlgorithm, making RenderGrid more compact and easy to maintain. A nice side
2836         effect of this patch is the removal of the GridSizingData structure as it is no longer
2837         needed. All the data structures in that class were transferred to GridTrackSizingAlgorithm
2838         as private attribute members. The GridTrack class was also moved to the new file.
2839
2840         The algorithm execution starts with the call to run(). It's mandatory to call setup() before
2841         any call to run() in order to properly configure the behaviour of the algorithm. You can
2842         call setup() & run() multiple times for a single layout operation (normally twice, one for
2843         columns and another one for rows). The algorithm uses a state machine to verify that the
2844         client issues the calls in the proper order (i.e. first columns and then rows). After
2845         finishing the layout, the client should call reset() to allow the algorithm to perform
2846         cleanups and to prepare itself for another round of calls.
2847
2848         In order to implement the different behaviours of the algorithm depending on whether the
2849         available size is definite or not, a strategy pattern was implemented in the
2850         GridTrackSizingAlgorithmStrategy class. It has two subclasses, one for definite sizes and
2851         another one for indefinite ones.
2852
2853         We took advantage of this change to perform some renames of the track sizing algorithm
2854         methods that were still using the names from the first versions of the specs. Not only that,
2855         the original track sizing algorithm method (computeUsedBreadthOfGridTracks) was split in 4
2856         different parts representing the 4 steps of the algorithm.
2857
2858         No new tests as this is about moving code and refactoring.
2859
2860         * CMakeLists.txt:
2861         * WebCore.xcodeproj/project.pbxproj:
2862         * rendering/GridTrackSizingAlgorithm.cpp: Added.
2863         (WebCore::GridTrack::baseSize):
2864         (WebCore::GridTrack::growthLimit):
2865         (WebCore::GridTrack::setBaseSize):
2866         (WebCore::GridTrack::setGrowthLimit):
2867         (WebCore::GridTrack::growthLimitIfNotInfinite):
2868         (WebCore::GridTrack::setTempSize):
2869         (WebCore::GridTrack::growTempSize):
2870         (WebCore::GridTrack::setGrowthLimitCap):
2871         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize):
2872         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
2873         (WebCore::hasOverrideContainingBlockContentSizeForChild):
2874         (WebCore::setOverrideContainingBlockContentSizeForChild):
2875         (WebCore::flowAwareDirectionForChild):
2876         (WebCore::overrideContainingBlockContentSizeForChild):
2877         (WebCore::computeMarginLogicalSizeForChild):
2878         (WebCore::marginIntrinsicLogicalWidthForChild):
2879         (WebCore::GridTrackSizingAlgorithm::setFreeSpace):
2880         (WebCore::GridTrackSizingAlgorithm::rawGridTrackSize):
2881         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
2882         (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
2883         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
2884         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2885         (WebCore::GridTrackSizingAlgorithm::spanningItemCrossesFlexibleSizedTracks):
2886         (WebCore::GridItemWithSpan::GridItemWithSpan):
2887         (WebCore::GridItemWithSpan::gridItem):
2888         (WebCore::GridItemWithSpan::span):
2889         (WebCore::GridItemWithSpan::operator<):
2890         (WebCore::GridTrackSizingAlgorithm::itemSizeForTrackSizeComputationPhase):
2891         (WebCore::shouldProcessTrackForTrackSizeComputationPhase):
2892         (WebCore::trackSizeForTrackSizeComputationPhase):
2893         (WebCore::updateTrackSizeForTrackSizeComputationPhase):
2894         (WebCore::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase):
2895         (WebCore::markAsInfinitelyGrowableForTrackSizeComputationPhase):
2896         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
2897         (WebCore::sortByGridTrackGrowthPotential):
2898         (WebCore::clampGrowthShareIfNeeded):
2899         (WebCore::GridTrackSizingAlgorithm::distributeSpaceToTracks):
2900         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
2901         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
2902         (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
2903         (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize):
2904         (WebCore::GridTrackSizingAlgorithm::computeFlexSizedTracksGrowth):
2905         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize):
2906         (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
2907         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild):
2908         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
2909         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
2910         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
2911         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild):
2912         (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild):
2913         (WebCore::IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
2914         (WebCore::IndefiniteSizeStrategy::maximizeTracks):
2915         (WebCore::normalizedFlexFraction):
2916         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
2917         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2918         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild):
2919         (WebCore::DefiniteSizeStrategy::maximizeTracks):
2920         (WebCore::DefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
2921         (WebCore::DefiniteSizeStrategy::findUsedFlexFraction):
2922         (WebCore::DefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2923         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
2924         (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes):
2925         (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks):
2926         (WebCore::GridTrackSizingAlgorithm::advanceNextState):
2927         (WebCore::GridTrackSizingAlgorithm::isValidTransition):
2928         (WebCore::GridTrackSizingAlgorithm::setup):
2929         (WebCore::GridTrackSizingAlgorithm::run):
2930         (WebCore::GridTrackSizingAlgorithm::reset):
2931         (WebCore::GridTrackSizingAlgorithm::tracksAreWiderThanMinTrackBreadth):
2932         (WebCore::GridTrackSizingAlgorithm::StateMachine::StateMachine):
2933         (WebCore::GridTrackSizingAlgorithm::StateMachine::~StateMachine):
2934         * rendering/GridTrackSizingAlgorithm.h: Added.
2935         (WebCore::GridTrack::GridTrack):
2936         (WebCore::GridTrack::infiniteGrowthPotential):
2937         (WebCore::GridTrack::plannedSize):
2938         (WebCore::GridTrack::setPlannedSize):
2939         (WebCore::GridTrack::tempSize):
2940         (WebCore::GridTrack::infinitelyGrowable):
2941         (WebCore::GridTrack::setInfinitelyGrowable):
2942         (WebCore::GridTrack::growthLimitCap):
2943         (WebCore::GridTrack::growthLimitIsInfinite):
2944         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize):
2945         (WebCore::GridTrackSizingAlgorithmStrategy::GridTrackSizingAlgorithmStrategy):
2946         (WebCore::GridTrackSizingAlgorithmStrategy::computeTrackBasedSize):
2947         (WebCore::GridTrackSizingAlgorithmStrategy::direction):
2948         (WebCore::GridTrackSizingAlgorithmStrategy::findFrUnitSize):
2949         (WebCore::GridTrackSizingAlgorithmStrategy::distributeSpaceToTracks):
2950         (WebCore::GridTrackSizingAlgorithmStrategy::renderGrid):
2951         * rendering/RenderGrid.cpp:
2952         (WebCore::RenderGrid::RenderGrid):
2953         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
2954         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
2955         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
2956         (WebCore::RenderGrid::layoutBlock):
2957         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
2958         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
2959         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
2960         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
2961         (WebCore::RenderGrid::layoutGridItems):
2962         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
2963         (WebCore::RenderGrid::populateGridPositionsForDirection):
2964         (WebCore::RenderGrid::columnAxisOffsetForChild):
2965         (WebCore::RenderGrid::rowAxisOffsetForChild):
2966         (WebCore::RenderGrid::findChildLogicalPosition):
2967         (WebCore::GridTrack::GridTrack): Deleted.
2968         (WebCore::GridTrack::baseSize): Deleted.
2969         (WebCore::GridTrack::growthLimit): Deleted.
2970         (WebCore::GridTrack::setBaseSize): Deleted.
2971         (WebCore::GridTrack::setGrowthLimit): Deleted.
2972         (WebCore::GridTrack::infiniteGrowthPotential): Deleted.
2973         (WebCore::GridTrack::growthLimitIfNotInfinite): Deleted.
2974         (WebCore::GridTrack::plannedSize): Deleted.
2975         (WebCore::GridTrack::setPlannedSize): Deleted.
2976         (WebCore::GridTrack::tempSize): Deleted.
2977         (WebCore::GridTrack::setTempSize): Deleted.
2978         (WebCore::GridTrack::growTempSize): Deleted.
2979         (WebCore::GridTrack::infinitelyGrowable): Deleted.
2980         (WebCore::GridTrack::setInfinitelyGrowable): Deleted.
2981         (WebCore::GridTrack::setGrowthLimitCap): Deleted.
2982         (WebCore::GridTrack::growthLimitCap): Deleted.
2983         (WebCore::GridTrack::growthLimitIsInfinite): Deleted.
2984         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize): Deleted.
2985         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize): Deleted.
2986         (WebCore::RenderGrid::GridSizingData::GridSizingData): Deleted.
2987         (WebCore::RenderGrid::GridSizingData::freeSpace): Deleted.
2988         (WebCore::RenderGrid::GridSizingData::availableSpace): Deleted.
2989         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Deleted.
2990         (WebCore::RenderGrid::GridSizingData::advanceNextState): Deleted.
2991         (WebCore::RenderGrid::GridSizingData::isValidTransition): Deleted.
2992         (WebCore::RenderGrid::GridSizingData::grid): Deleted.
2993         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Deleted.
2994         (WebCore::RenderGrid::computeTrackSizesForDirection): Deleted.
2995         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Deleted.
2996         (WebCore::normalizedFlexFraction): Deleted.
2997         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Deleted.
2998         (WebCore::RenderGrid::computeFlexSizedTracksGrowth): Deleted.
2999         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Deleted.
3000         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Deleted.
3001         (WebCore::RenderGrid::computeFlexFactorUnitSize): Deleted.
3002         (WebCore::RenderGrid::findFlexFactorUnitSize): Deleted.
3003         (WebCore::hasOverrideContainingBlockContentSizeForChild): Deleted.
3004         (WebCore::setOverrideContainingBlockContentSizeForChild): Deleted.
3005         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild): Deleted.
3006         (WebCore::RenderGrid::rawGridTrackSize): Deleted.
3007         (WebCore::RenderGrid::gridTrackSize): Deleted.
3008         (WebCore::RenderGrid::logicalHeightForChild): Deleted.
3009         (WebCore::RenderGrid::minSizeForChild): Deleted.
3010         (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild): Deleted.
3011         (WebCore::RenderGrid::minContentForChild): Deleted.
3012         (WebCore::RenderGrid::maxContentForChild): Deleted.
3013         (WebCore::GridItemWithSpan::GridItemWithSpan): Deleted.
3014         (WebCore::GridItemWithSpan::gridItem): Deleted.
3015         (WebCore::GridItemWithSpan::span): Deleted.
3016         (WebCore::GridItemWithSpan::operator<): Deleted.
3017         (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks): Deleted.
3018         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Deleted.
3019         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Deleted.
3020         (WebCore::trackSizeForTrackSizeComputationPhase): Deleted.
3021         (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Deleted.
3022         (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Deleted.
3023         (WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase): Deleted.
3024         (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Deleted.
3025         (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Deleted.
3026         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems): Deleted.
3027         (WebCore::sortByGridTrackGrowthPotential): Deleted.
3028         (WebCore::clampGrowthShareIfNeeded): Deleted.
3029         (WebCore::RenderGrid::distributeSpaceToTracks): Deleted.
3030         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Deleted.
3031         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Deleted.
3032         (WebCore::RenderGrid::gridAreaBreadthForChild): Deleted.
3033         * rendering/RenderGrid.h:
3034
3035 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
3036
3037         [Win] Crash under CACFLayerTreeHost::acceleratedCompositingAvailable().
3038         https://bugs.webkit.org/show_bug.cgi?id=168711
3039
3040         Reviewed by Alex Christensen.
3041
3042         Add null pointer check.
3043
3044         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
3045         (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable):
3046
3047 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3048
3049         [GStreamer] Crash in MediaPlayerPrivateGStreamerMSE::buffered() when MEDIA_STREAM is disabled
3050         https://bugs.webkit.org/show_bug.cgi?id=168662
3051
3052         Reviewed by Michael Catanzaro.
3053
3054         When MEDIA_STREAM is disabled, if MediaPlayer::loadWithNextMediaEngine is called with a current engine and
3055         there's no type specified, the next media engine that is used is the MSE one. Since there's no actually a media
3056         stream, the engine is created but never loaded. When buffered is called it tries to use its media source that is
3057         nullptr. It doesn't happen when MEDIA_STREAM is enabled, because the next media engine returned is Owr that
3058         doesn't implement buffered and always returns an empty PlatformTimeRanges.
3059
3060         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3061         (WebCore::MediaPlayerPrivateGStreamerMSE::buffered): Return an empty PlatformTimeRanges if m_mediaSource is nullptr.
3062
3063 2017-02-21  Youenn Fablet  <youenn@apple.com>
3064
3065         [WebRTC][Mac] Activate libwebrtc
3066         https://bugs.webkit.org/show_bug.cgi?id=167293
3067
3068         Reviewed by Alex Christensen.
3069
3070         * Configurations/WebCore.xcconfig:
3071         * Configurations/WebCoreTestSupport.xcconfig:
3072         * Configurations/FeatureDefines.xcconfig:
3073
3074 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3075
3076         Unreviewed. Fix WinCairo build after r212703.
3077
3078         * platform/TextureMapper.cmake:
3079
3080 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
3081
3082         Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
3083         https://bugs.webkit.org/show_bug.cgi?id=168601
3084         rdar://problem/30583872
3085
3086         Reviewed by Simon Fraser.
3087
3088         Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
3089         see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
3090         where text is painted in three phases (fill, stroke, markers), where the order follows the
3091         paint-order property. The linecap and linejoin properties are set on the graphics context before
3092         rendering the text.
3093
3094         Tests: fast/css/paint-order.html
3095                fast/css/paint-order-shadow.html
3096
3097         * css/CSSComputedStyleDeclaration.cpp:
3098         (WebCore::paintOrder):
3099         * css/StyleBuilderConverter.h:
3100         (WebCore::StyleBuilderConverter::convertPaintOrder):
3101         * rendering/TextPaintStyle.cpp:
3102         (WebCore::computeTextPaintStyle):
3103         (WebCore::updateGraphicsContext):
3104         * rendering/TextPaintStyle.h:
3105         * rendering/TextPainter.cpp:
3106         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
3107         * rendering/style/RenderStyle.cpp:
3108         (WebCore::RenderStyle::paintTypesForPaintOrder):
3109         * rendering/style/RenderStyle.h:
3110         (WebCore::RenderStyle::setPaintOrder):
3111         (WebCore::RenderStyle::initialPaintOrder):
3112         * rendering/style/RenderStyleConstants.h:
3113         * rendering/style/SVGRenderStyleDefs.h:
3114         * rendering/style/StyleRareInheritedData.cpp:
3115         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3116         * rendering/svg/RenderSVGShape.cpp:
3117         (WebCore::RenderSVGShape::fillStrokeMarkers):
3118         * rendering/svg/SVGInlineTextBox.cpp:
3119         (WebCore::SVGInlineTextBox::paint):
3120
3121 2017-02-21  Joseph Pecoraro  <pecoraro@apple.com>
3122
3123         [User Timing] Throw a SyntaxError for performance.measure if mark name is not found
3124         https://bugs.webkit.org/show_bug.cgi?id=168707
3125
3126         Reviewed by Ryosuke Niwa.
3127
3128         Test: performance-api/performance-measure-name.html
3129
3130         * page/PerformanceUserTiming.cpp:
3131         (WebCore::UserTiming::findExistingMarkStartTime):
3132         Instead of returning zero, throw a SyntaxError. This is more in line
3133         with User Timing Level 1 and behavior in Window. This is an issue with
3134         the Level 2 spec: https://github.com/w3c/user-timing/issues/21
3135
3136 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
3137
3138         Unreviewed attempt to fix the Windows build.
3139
3140         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3141         (PlatformCALayerWin::supportsSubpixelAntialiasedText):
3142
3143 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
3144
3145         Unreviewed, rolling out r212737.
3146
3147         This change caused an existing LayoutTest to crash.
3148
3149         Reverted changeset:
3150
3151         "REGRESSION(r207669): Crash after mutating selector text"
3152         https://bugs.webkit.org/show_bug.cgi?id=168655
3153         http://trac.webkit.org/changeset/212737
3154
3155 2017-02-21  Chris Dumez  <cdumez@apple.com>
3156
3157         REGRESSION (r207720): /more/conformance/conformance/quickCheckAPI-S_V.html test fails
3158         https://bugs.webkit.org/show_bug.cgi?id=168632
3159         <rdar://problem/30620129>
3160
3161         Reviewed by Darin Adler.
3162
3163         After r207720, the following WebGL conformance tests started failing:
3164         - /more/conformance/conformance/quickCheckAPI-S_V.html
3165         - /context/context-lost.html
3166
3167         We started throwing security errors in case where we did not before.
3168         Chrome and Firefox are both passing these tests so our new behavior was not interoperable.
3169
3170         This patch reverts part of r207720 to restore our previous behavior.
3171
3172         * html/canvas/WebGLRenderingContextBase.cpp:
3173         (WebCore::WebGLRenderingContextBase::texSubImage2D):
3174         (WebCore::WebGLRenderingContextBase::texImage2D):
3175         (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
3176         (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement):
3177         (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement):
3178         * html/canvas/WebGLRenderingContextBase.h:
3179
3180 2017-02-21  Dean Jackson  <dino@apple.com>
3181
3182         No need for static attributes when creating a pixel format
3183         https://bugs.webkit.org/show_bug.cgi?id=168688
3184         <rdar://problem/30642256>
3185
3186         Reviewed by Myles Maxfield.
3187
3188         Just create the attributes when needed.
3189
3190         * platform/graphics/mac/GraphicsContext3DMac.mm:
3191         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
3192
3193 2017-02-20  Filip Pizlo  <fpizlo@apple.com>
3194
3195         The collector thread should only start when the mutator doesn't have heap access
3196         https://bugs.webkit.org/show_bug.cgi?id=167737
3197
3198         Reviewed by Keith Miller.
3199
3200         Added new tests in JSTests.
3201         
3202         The WebCore changes involve:
3203         
3204         - Refactoring around new header discipline.
3205         
3206         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
3207
3208         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
3209         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
3210         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
3211         * ForwardingHeaders/heap/RunningScope.h: Added.
3212         * bindings/js/CommonVM.cpp:
3213         * testing/Internals.cpp:
3214         (WebCore::Internals::parserMetaData):
3215         (WebCore::Internals::isReadableStreamDisturbed):
3216         (WebCore::Internals::isGCRunning):
3217         (WebCore::Internals::addGCFinalizationCallback):
3218         (WebCore::Internals::stopSweeping):
3219         (WebCore::Internals::startSweeping):
3220         * testing/Internals.h:
3221         * testing/Internals.idl:
3222
3223 2017-02-20  Simon Fraser  <simon.fraser@apple.com>
3224
3225         Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
3226         https://bugs.webkit.org/show_bug.cgi?id=168620
3227         <rdar://problem/30617772>
3228
3229         Reviewed by Tim Horton.
3230
3231         Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
3232         PlatformCALayer, where it ultimately affects the layer contents format.
3233         
3234         TileControllers are slightly special because we communicate with them via an Obj-C
3235         WebTiledBackingLayer.
3236
3237         Test: compositing/contents-format/subpixel-antialiased-text-enabled.html
3238
3239         * page/Settings.in:
3240         * platform/graphics/GraphicsLayer.cpp:
3241         (WebCore::GraphicsLayer::GraphicsLayer):
3242         (WebCore::GraphicsLayer::dumpProperties):
3243         * platform/graphics/GraphicsLayer.h:
3244         (WebCore::GraphicsLayer::supportsSubpixelAntialiasedText):
3245         (WebCore::GraphicsLayer::setSupportsSubpixelAntialiasedText):
3246         * platform/graphics/ca/GraphicsLayerCA.cpp:
3247         (WebCore::GraphicsLayerCA::setSupportsSubpixelAntialiasedText):
3248         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3249         (WebCore::GraphicsLayerCA::updateSupportsSubpixelAntialiasedText):
3250         * platform/graphics/ca/GraphicsLayerCA.h:
3251         * platform/graphics/ca/PlatformCALayer.cpp:
3252         (WebCore::PlatformCALayer::drawRepaintIndicator):
3253         * platform/graphics/ca/PlatformCALayer.h:
3254         * platform/graphics/ca/TileController.cpp:
3255         (WebCore::TileController::setWantsDeepColorBackingStore):
3256         (WebCore::TileController::setSupportsSubpixelAntialiasedText):
3257         (WebCore::TileController::setTilesOpaque):
3258         * platform/graphics/ca/TileController.h:
3259         * platform/graphics/ca/TileGrid.cpp:
3260         (WebCore::TileGrid::updateTileLayerProperties):
3261         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
3262         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3263         (PlatformCALayerCocoa::supportsSubpixelAntialiasedText):
3264         (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText):
3265         (layerContentsFormat):
3266         (PlatformCALayerCocoa::updateContentsFormat):
3267         (PlatformCALayer::drawLayerContents):
3268         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
3269         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
3270         (-[WebTiledBackingLayer drawsAsynchronously]):
3271         (-[WebTiledBackingLayer setSupportsSubpixelAntialiasedText:]):
3272         (-[WebTiledBackingLayer supportsSubpixelAntialiasedText]):
3273         * platform/spi/cocoa/QuartzCoreSPI.h:
3274         * rendering/RenderLayerBacking.cpp:
3275         (WebCore::RenderLayerBacking::createGraphicsLayer):
3276
3277 2017-02-21  Chris Dumez  <cdumez@apple.com>
3278
3279         REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work
3280         https://bugs.webkit.org/show_bug.cgi?id=168677
3281         <rdar://problem/30640101>
3282
3283         Reviewed by Ryosuke Niwa.
3284
3285         Add quirk to initMouseEvent to unbreak iAd Producer.
3286
3287         * dom/MouseEvent.cpp:
3288         (WebCore::MouseEvent::initMouseEventQuirk):
3289         * dom/MouseEvent.h:
3290         * dom/MouseEvent.idl:
3291         * platform/RuntimeApplicationChecks.h:
3292         * platform/RuntimeApplicationChecks.mm:
3293         (WebCore::MacApplication::isIADProducer):
3294
3295 2017-02-21  Jer Noble  <jer.noble@apple.com>
3296
3297         AudioSampleDataSource doesn't need to use the m_scratchBuffer on the pulling thread
3298         https://bugs.webkit.org/show_bug.cgi?id=168640
3299
3300         Reviewed by Eric Carlson.
3301
3302         Rather than copying the pulled data into a scratch buffer, applying a volume transformation
3303         and then copying back out, just do the volume transformation in-place in the destination
3304         buffer.
3305
3306         * platform/audio/mac/AudioSampleDataSource.cpp:
3307         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3308
3309 2017-02-21  Youenn Fablet  <youenn@apple.com>
3310
3311         [WebRTC] Implement Incoming libwebrtc audio source support.
3312         https://bugs.webkit.org/show_bug.cgi?id=167961
3313
3314         Reviewed by Eric Carlson.
3315
3316         Hook libwebrtc incoming audio source into WebCore audio rendering path.
3317         Manually testing that muted sources produce data with zeros and unmuted sources provide data with non zeros.
3318
3319         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
3320         (WebCore::RealtimeIncomingAudioSource::create):
3321         (WebCore::streamDescription):
3322         (WebCore::RealtimeIncomingAudioSource::OnData):
3323         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
3324         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
3325
3326 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
3327
3328         Fix ImageBitmap comment to not insert a <canvas>.
3329
3330         * features.json:
3331
3332 2017-02-21  Alex Christensen  <achristensen@webkit.org>
3333
3334         Fix CMake build.
3335
3336         * PlatformMac.cmake:
3337
3338 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
3339
3340         Add Media Streams and Capture to features.json.
3341
3342         * features.json:
3343
3344 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
3345
3346         Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.
3347
3348         * features.json:
3349
3350 2017-02-21  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3351
3352         [Readable Streams API] Add ReadableStreamBYOBRequest view getter
3353         https://bugs.webkit.org/show_bug.cgi?id=168652
3354
3355         Reviewed by Youenn Fablet.
3356
3357         Implemented getter for ReadableStreamBYOBRequest view attribute.
3358         
3359         Added 1 test checking that view length corresponds to autoAllocateChunkSize.
3360         Also updated test expectations for W3C imported tests.
3361
3362         * Modules/streams/ReadableByteStreamInternals.js:
3363         (isReadableStreamBYOBRequest): Added.
3364         * Modules/streams/ReadableStreamBYOBRequest.js:
3365         (view): Added.
3366
3367 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
3368
3369         Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.
3370
3371         * features.json:
3372
3373 2017-02-21  Youenn Fablet  <youenn@apple.com>
3374
3375         [WebRTC] ICE candidates should be filtered according a policy
3376         https://bugs.webkit.org/show_bug.cgi?id=168348
3377
3378         Reviewed by Alex Christensen.
3379
3380         Covered by manual tests. Should be covered in the future by layout tests with dedicated internals API.
3381
3382         Adding support for ICE candidate filtering at RTCPeerConnection level.
3383         If ICE candidate filtering is on (by default), host candidates are stored and not sent immediately.
3384         Reflexive candidates are purged from raddr information to not leak the host IP address.
3385
3386         Stored candidates may be advertised to the JS layer if RTCController is notified of a change of filtering policy.
3387         To implement that, PeerConnectionBackend stores all filtered out candidates and RTCPeerConnection register
3388         themselves to RTCController to get notifications of filtering policy changes.
3389
3390         Making RTCPeerConnection use setPendingActivity throughout its lifetime.
3391         This ensures it does not get collected until the page is off or close() is called on the object.
3392
3393         Adding support for enumerating or not all interfaces at libwebrtc level.
3394         This choice is done at creation of the peer connection.
3395
3396         * Modules/mediastream/PeerConnectionBackend.cpp:
3397         (WebCore::PeerConnectionBackend::enableICECandidateFiltering):
3398         (WebCore::PeerConnectionBackend::disableICECandidateFiltering):
3399         (WebCore::filterICECandidate):
3400         (WebCore::PeerConnectionBackend::newICECandidate):
3401         * Modules/mediastream/PeerConnectionBackend.h:
3402         * Modules/mediastream/RTCController.cpp: Added.
3403         (WebCore::RTCController::remove):
3404         (WebCore::RTCController::add):
3405         (WebCore::RTCController::disableICECandidateFiltering):
3406         (WebCore::RTCController::enableICECandidateFiltering):
3407         * Modules/mediastream/RTCController.h: Added.
3408         * Modules/mediastream/RTCPeerConnection.cpp:
3409         (WebCore::RTCPeerConnection::create):
3410         (WebCore::RTCPeerConnection::close):
3411         (WebCore::RTCPeerConnection::rtcController):
3412         (WebCore::RTCPeerConnection::registerToController):
3413         (WebCore::RTCPeerConnection::unregisterFromController):
3414         * Modules/mediastream/RTCPeerConnection.h:
3415         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3416         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
3417         * WebCore.xcodeproj/project.pbxproj:
3418         * page/Page.h:
3419         (WebCore::Page::rtcController):
3420         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3421         (WebCore::LibWebRTCProvider::createPeerConnection):
3422         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3423
3424 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
3425
3426         Unreviewed, update WebCrypto API feature status.
3427
3428         * features.json:
3429
3430 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
3431
3432         Fix the bad JSON.
3433
3434         * features.json:
3435
3436 2017-02-21  Andreas Kling  <akling@apple.com>
3437
3438         [iOS] WebKit1 should use shared memory pressure handler code.
3439         <https://webkit.org/b/168653>
3440
3441         Reviewed by Antti Koivisto.
3442
3443         Remove iOS WebKit1 specific members and code from MemoryPressureHandler in favor
3444         of using the same code that iOS WebKit2 and macOS WebKit uses.
3445
3446         * page/cocoa/MemoryReleaseCocoa.mm:
3447         (WebCore::platformReleaseMemory): Add two cleanup calls that were only in the iOS WebView code.
3448         * platform/MemoryPressureHandler.h:
3449         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): Deleted.
3450         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
3451         (WebCore::respondToMemoryPressureCallback): Deleted.
3452         (WebCore::MemoryPressureHandler::installMemoryReleaseBlock): Deleted.
3453         (WebCore::MemoryPressureHandler::setReceivedMemoryPressure): Deleted.
3454         (WebCore::MemoryPressureHandler::clearMemoryPressure): Deleted.
3455         (WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage): Deleted.
3456         (WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded): Deleted.
3457
3458 2017-02-21  Anders Carlsson  <andersca@apple.com>
3459
3460         Fix two failing WebKit legacy tests
3461         https://bugs.webkit.org/show_bug.cgi?id=168667
3462
3463         Reviewed by Tim Horton.
3464
3465         Handle the NSPasteboardTypeString type.
3466
3467         * platform/mac/PasteboardMac.mm:
3468         (WebCore::Pasteboard::read):
3469         (WebCore::addHTMLClipboardTypesForCocoaType):
3470
3471 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
3472
3473         Add Web Audio and Web MIDI to features.json.
3474
3475         * features.json:
3476
3477 2017-02-21  Antti Koivisto  <antti@apple.com>
3478
3479         REGRESSION(r207669): Crash after mutating selector text
3480         https://bugs.webkit.org/show_bug.cgi?id=168655
3481         <rdar://problem/30632111>
3482
3483         Reviewed by Brent Fulgham.
3484
3485         Test: fast/css/selector-text-mutation-crash.html
3486
3487         * style/StyleScope.cpp:
3488         (WebCore::Style::Scope::scheduleUpdate):
3489
3490         Clear the style resolver immediately if style sheet content changes. The resolver may
3491         have data structures that point to the old sheet contents.
3492
3493         The resolver would get wiped anyway when the scheduled update actually occurs.
3494
3495 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
3496
3497         [WebCrypto] Add support for AES-CFB
3498         https://bugs.webkit.org/show_bug.cgi?id=168344
3499         <rdar://problem/20940221>
3500
3501         Reviewed by Brent Fulgham.
3502
3503         This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
3504         importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
3505         of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.
3506
3507         Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
3508                crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
3509                crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
3510                crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
3511                crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
3512                crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
3513                crypto/subtle/aes-cfb-generate-export-raw-key.html
3514                crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
3515                crypto/subtle/aes-cfb-generate-key.html
3516                crypto/subtle/aes-cfb-import-jwk-key-length-128.html
3517                crypto/subtle/aes-cfb-import-jwk-key-length-192.html
3518                crypto/subtle/aes-cfb-import-jwk-key-length-256.html
3519                crypto/subtle/aes-cfb-import-key-decrypt.html
3520                crypto/subtle/aes-cfb-import-key-encrypt.html
3521                crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
3522                crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
3523                crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
3524                crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
3525                crypto/subtle/aes-cfb-import-raw-key.html
3526                crypto/workers/subtle/aes-cfb-import-key-decrypt.html
3527                crypto/workers/subtle/aes-cfb-import-key-encrypt.html
3528                crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
3529                crypto/workers/subtle/aes-cfb-import-key-wrap-key.html
3530
3531         * CMakeLists.txt:
3532         * DerivedSources.make:
3533         * PlatformGTK.cmake:
3534         * PlatformMac.cmake:
3535         * WebCore.xcodeproj/project.pbxproj:
3536         Add CryptoAlgorithmAES_CFB.cpp,
3537         change AesCbcParams.idl to AesCbcCfbParams.idl.
3538         * bindings/js/JSSubtleCryptoCustom.cpp:
3539         (WebCore::normalizeCryptoAlgorithmParameters):
3540         Add support for AES-CFB.
3541         * crypto/CryptoAlgorithm.h:
3542         Include <wtf/Variant.h>.
3543         * crypto/CryptoAlgorithmParameters.h:
3544         Add support for AES-CFB.
3545         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3546         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
3547         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
3548         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
3549         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
3550         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
3551         (WebCore::CryptoAlgorithmAES_CFB::create):
3552         (WebCore::CryptoAlgorithmAES_CFB::identifier):
3553         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
3554         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
3555         (WebCore::CryptoAlgorithmAES_CFB::generateKey):
3556         (WebCore::CryptoAlgorithmAES_CFB::importKey):
3557         (WebCore::CryptoAlgorithmAES_CFB::exportKey):
3558         * crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
3559         * crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
3560         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3561         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3562         Add dummy support of AES_CFB for GTK+.
3563         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3564         (WebCore::transformAES_CBC):
3565         Drop conditional PLATFORM(COCOA).
3566         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3567         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3568         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
3569         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
3570         (WebCore::transformAES_CFB):
3571         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3572         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3573         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
3574         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
3575         Add support for AES-CFB.
3576         * crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
3577         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
3578         Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.
3579
3580 2017-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3581
3582         Unreviewed, fix the ToT iOS build
3583
3584         Adopt updated UIKit SPI and remove calls to the deprecated version.
3585
3586         * platform/ios/WebItemProviderPasteboard.mm:
3587         (-[WebItemProviderPasteboard setItems:]):
3588
3589 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
3590
3591         [Win] WebView is not painting in accelerated compositing mode.
3592         https://bugs.webkit.org/show_bug.cgi?id=168654
3593
3594         Reviewed by Brent Fulgham.
3595
3596         Initializing the uncommitted layer change flags to CoverageRectChanged in GraphicsLayerCA,
3597         stops WebView painting in accelerated mode.
3598
3599         Covered by existing tests.
3600
3601         * platform/graphics/ca/GraphicsLayerCA.h:
3602
3603 2017-02-21  Jer Noble  <jer.noble@apple.com>
3604
3605         Make logging in high-priority audio threads less expensive
3606         https://bugs.webkit.org/show_bug.cgi?id=168639
3607
3608         Reviewed by Jon Lee.
3609
3610         Logging from inside a high-priority audio thread will make a number of calls to malloc, block, and
3611         therefore cause audio glitches. Make this logging less expensive by dispatching to the main thread
3612         before creating and outputting the log string.
3613
3614         * WebCore.xcodeproj/project.pbxproj:
3615         * platform/audio/mac/AudioSampleDataSource.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSampleDataSource.cpp.
3616         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3617         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3618
3619 2017-02-21  Jer Noble  <jer.noble@apple.com>
3620
3621         Give the Mock audio input a "hum" to make drop-outs more detectable
3622         https://bugs.webkit.org/show_bug.cgi?id=168641
3623
3624         Reviewed by Eric Carlson.
3625
3626         Add two helper functions to generate waveforms: addHum() and writeHum(). Use these methods
3627         to create a bip-bop audio buffer which can be used to "blit" a portion the waveform into the
3628         destination buffer during rendering. The background hum must be seamless across multiple
3629         pull operations, so add the hum sound during rendering.
3630
3631         To ensure the waveform buffer is created, initialize the sampleRate to zero, then call
3632         applySampleRate() with the desired default rate, 44.1kHz.
3633
3634         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
3635         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3636         (WebCore::writeHum):
3637         (WebCore::addHum):
3638         (WebCore::MockRealtimeAudioSource::create):
3639         (WebCore::MockRealtimeAudioSourceMac::render):
3640         (WebCore::MockRealtimeAudioSourceMac::applySampleRate):
3641
3642 2017-02-21  Jer Noble  <jer.noble@apple.com>
3643
3644         Make TrackPrivateBase ThreadSafeRefCounted, so that it can be retained in non-main threads
3645         https://bugs.webkit.org/show_bug.cgi?id=168642
3646
3647         Reviewed by Eric Carlson.
3648
3649         AudioTrackPrivateMediaStreamCocoa has two entry points from background threads:
3650         audioSamplesAvailable() and render(). Protect against being destroyed mid-execution by
3651         retaining this for the duration of those methods.
3652
3653         * platform/graphics/TrackPrivateBase.h:
3654         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3655         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3656         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
3657
3658 2017-02-21  Jer Noble  <jer.noble@apple.com>
3659
3660         Pulling too quickly from an AudioSampleDataSource should increase the pre-buffer amount
3661         https://bugs.webkit.org/show_bug.cgi?id=168645
3662
3663         Reviewed by Eric Carlson.
3664
3665         If a pull operation runs past the end of the buffered range of a CARingBuffer, the underrun
3666         is zero-filled, causing an audible glitch.  In this case, bias m_outputSampleOffset by the
3667         amount of the underrun, which should keep the underrun from reoccurring.
3668
3669         * platform/audio/mac/AudioSampleDataSource.cpp:
3670         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3671
3672 2017-02-21  Jer Noble  <jer.noble@apple.com>
3673
3674         AudioSampleBufferList::zeroABL() takes a byte-count, not a sample-count.
3675         https://bugs.webkit.org/show_bug.cgi?id=168635
3676
3677         Reviewed by Jon Lee.
3678
3679         * platform/audio/mac/AudioSampleDataSource.cpp:
3680         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3681         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3682
3683 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3684
3685         REGRESSION(r212681): Crash when dragging links without a drag image
3686         https://bugs.webkit.org/show_bug.cgi?id=168648
3687
3688         Reviewed by Tim Horton.
3689
3690         This happens in GTK+ port, because we don't use a drag image for links.
3691
3692         Fixes: editing/pasteboard/drop-link.html
3693                editing/pasteboard/drop-text-without-selection.html
3694                editing/pasteboard/files-during-page-drags.html
3695                fast/events/content-changed-during-drop.html
3696                fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html
3697                fast/events/drag-and-drop-link-into-focused-contenteditable.html
3698                fast/events/drag-and-drop-link.html
3699                fast/events/drag-in-frames.html
3700                fast/events/drag-parent-node.html
3701                fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html
3702
3703         * page/DragController.cpp:
3704         (WebCore::DragController::startDrag): Do not try to use drag image and its size when createDragImageForLink
3705         returns nullptr.
3706
3707 2017-02-21  Alex Christensen  <achristensen@webkit.org>
3708
3709         Unreviewed, rolling out r212699.
3710
3711         Internal build not ready
3712
3713         Reverted changeset:
3714
3715         "[WebRTC][Mac] Activate libwebrtc"
3716         https://bugs.webkit.org/show_bug.cgi?id=167293
3717         http://trac.webkit.org/changeset/212699
3718
3719 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3720
3721         Remove ENABLE_THREADED_COMPOSITOR build option
3722         https://bugs.webkit.org/show_bug.cgi?id=168606
3723
3724         Reviewed by Michael Catanzaro.
3725
3726         * platform/TextureMapper.cmake:
3727
3728 2017-02-20  Alex Christensen  <achristensen@webkit.org>
3729
3730         Fix some 32-bit builds after r212699
3731
3732         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3733         (WebCore::RealtimeIncomingVideoSource::OnFrame):
3734         Explicitly cast OSStatus to int for logging.
3735
3736 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
3737
3738         Remove unnecessary PerformanceEntry virtual methods
3739         https://bugs.webkit.org/show_bug.cgi?id=168633
3740
3741         Reviewed by Ryosuke Niwa.
3742
3743         * page/PerformanceEntry.h:
3744         (WebCore::PerformanceEntry::isResource):
3745         (WebCore::PerformanceEntry::isMark):
3746         (WebCore::PerformanceEntry::isMeasure):
3747         Implement based on the Type.
3748
3749         * page/PerformanceMark.h:
3750         * page/PerformanceMeasure.h:
3751         * page/PerformanceResourceTiming.h:
3752         Remove virtual overrides.
3753
3754 2017-02-20  Youenn Fablet  <youenn@apple.com>
3755
3756         [WebRTC][Mac] Activate libwebrtc
3757         https://bugs.webkit.org/show_bug.cgi?id=167293
3758
3759         Reviewed by Alex Christensen.
3760
3761         * Configurations/WebCore.xcconfig:
3762         * Configurations/WebCoreTestSupport.xcconfig:
3763
3764 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
3765
3766         ASSERTION FAILED: m_normalWorld->hasOneRef() under WorkerThread::stop
3767         https://bugs.webkit.org/show_bug.cgi?id=168356
3768         <rdar://problem/30592486>
3769
3770         Reviewed by Ryosuke Niwa.
3771
3772         * page/DOMWindow.cpp:
3773         (WebCore::DOMWindow::removeAllEventListeners):
3774         Remove Performance object EventListeners.
3775
3776         * workers/WorkerGlobalScope.cpp:
3777         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
3778         (WebCore::WorkerGlobalScope::removeAllEventListeners):
3779         (WebCore::WorkerGlobalScope::performance):
3780         * workers/WorkerGlobalScope.h:
3781         Remove Performance object EventListeners.
3782         Also clear Performance early in destruction since its ContextDestructionObserver
3783         destruction makes checks about the WorkerThread.
3784
3785 2017-02-20  Jer Noble  <jer.noble@apple.com>
3786
3787         Local audio-only stream will not trigger playback to begin
3788         https://bugs.webkit.org/show_bug.cgi?id=168412
3789
3790         Reviewed by Youenn Fablet.
3791
3792         Test: fast/mediastream/local-audio-playing-event.html
3793
3794         With video-bearing streams, the first video sample emitted from the stream causes the
3795         readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for
3796         audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method
3797         audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC.
3798         Because this callback may be (and probably will be) called on a background thread, run the
3799         updateReadyState() task in a scheduledDeferredTask().
3800
3801         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3802         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3803         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable):
3804         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3805         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3806         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
3807         * platform/mediastream/MediaStreamTrackPrivate.h:
3808         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
3809
3810 2017-02-20  Zalan Bujtas  <zalan@apple.com>
3811
3812         Simple line layout: Implement absoluteQuadsForRange.
3813         https://bugs.webkit.org/show_bug.cgi?id=168613
3814         <rdar://problem/30614618>
3815
3816         Reviewed by Simon Fraser.
3817
3818         This patch ensures that the commonly used Range::getClientRects calls do not
3819         throw us off of the simple line layout path.
3820
3821         Test: fast/dom/Range/simple-line-layout-getclientrects.html
3822
3823         * rendering/RenderText.cpp:
3824         (WebCore::RenderText::absoluteQuadsForRange):
3825         * rendering/SimpleLineLayoutFunctions.cpp:
3826         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange): Special case empty ranges with multiple empty runs.
3827         * rendering/SimpleLineLayoutFunctions.h:
3828         * rendering/SimpleLineLayoutResolver.cpp:
3829         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
3830         * rendering/SimpleLineLayoutResolver.h:
3831
3832 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
3833
3834         Unreviewed, rolling out r212685.
3835
3836         This change broke the 32-bit Sierra build.
3837
3838         Reverted changeset:
3839
3840         "Resource Load Statistics: Add alternate classification
3841         method"
3842         https://bugs.webkit.org/show_bug.cgi?id=168347
3843         http://trac.webkit.org/changeset/212685
3844
3845 2017-02-20  Sam Weinig  <sam@webkit.org>
3846
3847         [WebIDL] Add support for constructors that have variadic parameters
3848         https://bugs.webkit.org/show_bug.cgi?id=168614
3849
3850         Reviewed by Alex Christensen.
3851
3852         In preparation of removing some more custom bindings, move the constructor calling
3853         code over to using GenerateParametersCheck completely. This required
3854         - Removing special case of NamedConstructors automatically getting a Document passed
3855           to them. The three named constructors that expected this have been updated to add
3856           the required attributes.
3857         - Add a version of the GenerateCallWith prologue for constructors.
3858         - Remove now unnecessary argumentCount return value from GenerateParametersCheck.
3859
3860         * bindings/scripts/CodeGeneratorJS.pm:
3861         (GenerateImplementation):
3862         (GenerateCallWithUsingReferences):
3863         (GenerateCallWithUsingPointers):
3864         (GenerateConstructorCallWithUsingPointers):
3865         (GenerateCallWith):
3866         (GenerateParametersCheck):
3867         (GenerateConstructorDefinition):
3868
3869         * bindings/scripts/test/JS/JSTestInterface.cpp:
3870         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3871         * bindings/scripts/test/JS/JSTestObj.cpp:
3872         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3873         Update results for more consistent placement of ScriptExecutionContext and Document
3874         accessors, add UNLIKELY to context checks, and remove automatic Document passing
3875         for NamedConstructors.
3876
3877         * html/HTMLAudioElement.idl:
3878         * html/HTMLImageElement.idl:
3879         * html/HTMLOptionElement.idl:
3880         Add ConstructorCallWith=Document.
3881
3882 2017-02-20  John Wilander  <wilander@apple.com>
3883
3884         Resource Load Statistics: Add alternate classification method
3885         https://bugs.webkit.org/show_bug.cgi?id=168347
3886         <rdar://problem/30352793>
3887
3888         Reviewed by Alex Christensen.
3889
3890         This patch only adds test infrastructure in WebCore.
3891
3892         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
3893                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
3894                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
3895                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
3896                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
3897                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
3898                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
3899                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
3900
3901         * loader/ResourceLoadObserver.cpp:
3902         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
3903         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
3904         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
3905         * loader/ResourceLoadObserver.h:
3906
3907 2017-02-20  Anders Carlsson  <andersca@apple.com>
3908
3909         Use the new drag code path when dragging links
3910         https://bugs.webkit.org/show_bug.cgi?id=168612
3911
3912         Reviewed by Tim Horton.
3913
3914         * editing/Editor.cpp:
3915         (WebCore::Editor::copyURL):
3916         Use userVisibleString instead of fillInUserVisibleForm.
3917
3918         (WebCore::Editor::pasteboardWriterURL):
3919         New function that returns a PasteboardWriterData::URL for a given URL + title.
3920
3921         * editing/Editor.h:
3922         Add new members.
3923
3924         * editing/mac/EditorMac.mm:
3925         (WebCore::Editor::userVisibleString):
3926         (WebCore::Editor::fillInUserVisibleForm): Deleted.
3927         Add a getter instead of a function that fills in a struct member.
3928
3929         * page/DragController.cpp:
3930         (WebCore::DragController::startDrag):
3931         Add the new DragItem code path when dragging links.
3932
3933         * platform/PasteboardWriterData.cpp:
3934         (WebCore::PasteboardWriterData::isEmpty):
3935         Check for m_url as well.
3936
3937         (WebCore::PasteboardWriterData::setURL):
3938         Set m_url.
3939
3940         * platform/PasteboardWriterData.h:
3941         Add new members.
3942
3943         * platform/mac/PasteboardWriter.mm:
3944         (WebCore::toUTI):
3945         New helper function that returns an UTI from a pasteboard type.
3946
3947         (WebCore::createPasteboardWriter):
3948         Handle converting URLs to the various pasteboard types.
3949
3950 2017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3951
3952         Add plumbing to the UI process for TextIndicatorData when computing the drag image
3953         https://bugs.webkit.org/show_bug.cgi?id=168583
3954         Work towards <rdar://problem/30313681>
3955
3956         Reviewed by Tim Horton.
3957
3958         Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
3959         for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
3960         propagated to the UI process via SetDragImage in the WebDragClient.
3961
3962         Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
3963
3964         No new tests, since there is no behavior change.
3965
3966         * page/DragController.cpp:
3967         (WebCore::DragController::startDrag):
3968         * page/Page.cpp:
3969         (WebCore::Page::hasSelectionAtPosition):
3970         (WebCore::Page::hasDataInteractionAtPosition): Deleted.
3971         * page/Page.h:
3972         * platform/DragImage.cpp:
3973         (WebCore::createDragImageForSelection):
3974         (WebCore::createDragImageForLink):
3975