Fix scrolling tree dumping
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-05-10  Simon Fraser  <simon.fraser@apple.com>
2
3         Fix scrolling tree dumping
4         https://bugs.webkit.org/show_bug.cgi?id=157529
5
6         Reviewed by Tim Horton.
7
8         Scrolling tree dumps cannot contain layerIDs because they are not stable between
9         runs. Fix by adding ScrollingStateTreeAsTextBehavior flags, and not dumping
10         the layerID for tests.
11
12         Sadly RemoteScrollingCoordinatorTransaction has a lot of duplicated code for dumping
13         the scrolling state tree, which should be converted to dumpProperties() at some point.
14         
15         Fix the one test that suffered from this problem, and unskip it.
16
17         Test: fast/scrolling/ios/remove-scrolling-role.html
18
19         * page/scrolling/ScrollingStateFixedNode.cpp:
20         (WebCore::ScrollingStateFixedNode::dumpProperties):
21         * page/scrolling/ScrollingStateFixedNode.h:
22         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
23         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
24         * page/scrolling/ScrollingStateFrameScrollingNode.h:
25         * page/scrolling/ScrollingStateNode.cpp:
26         (WebCore::ScrollingStateNode::dump):
27         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
28         * page/scrolling/ScrollingStateNode.h:
29         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
30         (WebCore::ScrollingStateOverflowScrollingNode::dumpProperties):
31         * page/scrolling/ScrollingStateOverflowScrollingNode.h:
32         * page/scrolling/ScrollingStateScrollingNode.cpp:
33         (WebCore::ScrollingStateScrollingNode::dumpProperties):
34         * page/scrolling/ScrollingStateScrollingNode.h:
35         * page/scrolling/ScrollingStateStickyNode.cpp:
36         (WebCore::ScrollingStateStickyNode::dumpProperties):
37         * page/scrolling/ScrollingStateStickyNode.h:
38
39 2016-05-10  Csaba Osztrogonác  <ossy@webkit.org>
40
41         Fix the !ENABLE(CSS_REGIONS) build after r198990
42         https://bugs.webkit.org/show_bug.cgi?id=157516
43
44         Reviewed by Ryosuke Niwa.
45
46         * style/StyleTreeResolver.cpp:
47         (WebCore::Style::affectsRenderedSubtree):
48
49 2016-05-05  Jer Noble  <jer.noble@apple.com>
50
51         Return a Promise from HTMLMediaElement.play()
52         https://bugs.webkit.org/show_bug.cgi?id=157400
53
54         Reviewed by Eric Carlson.
55
56         Tests: media/media-play-promise-reject-error-notsupported.html
57                media/media-play-promise-reject-load-abort.html
58                media/media-play-promise-reject-pause-abort.html
59                media/media-play-promise-reject-play-notallowed.html
60                media/media-play-promise-reject-play-notsupported.html
61                media/media-play-promise-resolve-when-playing.html
62                media/media-play-promise-resolve.html
63
64         The HTML Living Standard Spec <https://html.spec.whatwg.org/multipage/embedded-content.html>
65         (5 May 2016) adds support for a Promise to be returned by the play() method, to be resolved
66         or rejected at defined points during loading and playback.
67
68         Add utility methods which encapsulate the definitions of the equivalent algorithms from the
69         HTML Spec.  Add a new, overloaded play() method on HTMLMediaElement which takes a DeferredWrapper
70         reference.
71
72         After the change to use scheduleNotifyAboutPlaying() instead of enqueueing the "playing" event
73         directly, we must ensure that the notifyAboutPlaying() task does not get fired before the
74         "play" event preceeding it does. So re-implement GenericEventQueue (which previously used
75         a timer to dispatch events) to use a GenericTaskQueue instead. This ensures that all tasks and
76         events are interleaved in the order in which they were enqueued.
77
78         Additionally, the new pauseAfterDetachedTimerFired() event was firing out of microtask order, which
79         broke some W3C tests after the changes to GenericEventQueue. Move GenericEventQueue and
80         GenericTaskQueue to the same timing source (namely, a WebCore Timer) and interleave Events
81         and Tasks by having GenericEventQueue use GenericTaskQueue to issue its Events. Because
82         Document::postTask() cannot ensure ordering with Timer-based events, switch HTMLMediaElement
83         over to Timer-backed GenericTaskQueues.
84
85         * dom/GenericEventQueue.cpp:
86         (WebCore::GenericEventQueue::GenericEventQueue):
87         (WebCore::GenericEventQueue::enqueueEvent):
88         (WebCore::GenericEventQueue::close):
89         (WebCore::GenericEventQueue::cancelAllEvents):
90         (WebCore::GenericEventQueue::suspend):
91         (WebCore::GenericEventQueue::resume):
92         (WebCore::GenericEventQueue::sharedTimer): Deleted.
93         (WebCore::GenericEventQueue::sharedTimerFired): Deleted.
94         (WebCore::GenericEventQueue::pendingQueues): Deleted.
95         * dom/GenericEventQueue.h:
96         * platform/GenericTaskQueue.cpp: Added.
97         (WebCore::TaskDispatcher<Timer>::~TaskDispatcher):
98         (WebCore::TaskDispatcher<Timer>::postTask):
99         (WebCore::TaskDispatcher<Timer>::sharedTimer):
100         (WebCore::TaskDispatcher<Timer>::sharedTimerFired):
101         (WebCore::TaskDispatcher<Timer>::pendingDispatchers):
102         (WebCore::TaskDispatcher<Timer>::dispatchOneTask):
103         * platform/GenericTaskQueue.h:
104         (WebCore::TaskDispatcher<Timer>::TaskDispatcher): Deleted.
105         (WebCore::TaskDispatcher<Timer>::postTask): Deleted.
106         (WebCore::TaskDispatcher<Timer>::timerFired): Deleted.
107         * html/HTMLMediaElement.cpp:
108         (WebCore::HTMLMediaElement::HTMLMediaElement):
109         (WebCore::HTMLMediaElement::~HTMLMediaElement):
110         (WebCore::HTMLMediaElement::scheduleResolvePendingPlayPromises):
111         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
112         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
113         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
114         (WebCore::HTMLMediaElement::notifyAboutPlaying):
115         (WebCore::HTMLMediaElement::noneSupported):
116         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
117         (WebCore::HTMLMediaElement::setReadyState):
118         (WebCore::HTMLMediaElement::play):
119         (WebCore::HTMLMediaElement::playInternal):
120         (WebCore::HTMLMediaElement::pauseInternal):
121         (WebCore::HTMLMediaElement::contextDestroyed):
122         (WebCore::HTMLMediaElement::stop):
123         (WebCore::HTMLMediaElement::pauseAfterDetachedTask): Renamed from pauseAfterDetachedTimerFired.
124         (WebCore::HTMLMediaElement::removedFrom):
125         (WebCore::HTMLMediaElement::contextDestroyed):
126         * html/HTMLMediaElement.h:
127         * html/HTMLMediaElement.idl:
128         * CMakeLists.txt:
129         * WebCore.xcodeproj/project.pbxproj:
130
131 2016-05-10  Chris Dumez  <cdumez@apple.com>
132
133         Get rid of a lot of calls to RefPtr::release()
134         https://bugs.webkit.org/show_bug.cgi?id=157505
135
136         Reviewed by Alex Christensen.
137
138         Get rid of a lot of calls to RefPtr::release() and use WTFMove() instead.
139
140         * Modules/encryptedmedia/MediaKeySession.cpp:
141         (WebCore::MediaKeySession::addKeyTimerFired):
142         (WebCore::MediaKeySession::sendMessage):
143         (WebCore::MediaKeySession::sendError):
144         * Modules/geolocation/Geolocation.cpp:
145         (WebCore::createGeoposition):
146         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
147         (WebCore::DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension):
148         (WebCore::DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension):
149         * Modules/indexeddb/IDBKey.h:
150         (WebCore::IDBKey::createMultiEntryArray):
151         * Modules/mediasource/MediaSource.cpp:
152         (WebCore::MediaSource::scheduleEvent):
153         * Modules/mediasource/SourceBuffer.cpp:
154         (WebCore::SourceBuffer::scheduleEvent):
155         * Modules/mediasource/SourceBufferList.cpp:
156         (WebCore::SourceBufferList::scheduleEvent):
157         * Modules/notifications/DOMWindowNotifications.cpp:
158         (WebCore::DOMWindowNotifications::disconnectFrameForDocumentSuspension):
159         (WebCore::DOMWindowNotifications::reconnectFrameFromDocumentSuspension):
160         * Modules/webdatabase/DatabaseManager.cpp:
161         (WebCore::DatabaseManager::openDatabaseBackend):
162         * Modules/webdatabase/DatabaseManager.h:
163         * Modules/webdatabase/SQLCallbackWrapper.h:
164         (WebCore::SQLCallbackWrapper::unwrap):
165         * Modules/websockets/WebSocketChannel.cpp:
166         (WebCore::WebSocketChannel::enqueueTextFrame):
167         (WebCore::WebSocketChannel::enqueueRawFrame):
168         (WebCore::WebSocketChannel::enqueueBlobFrame):
169         (WebCore::WebSocketChannel::processOutgoingFrameQueue):
170         * bindings/js/JSBlobCustom.cpp:
171         (WebCore::constructJSBlob):
172         * bindings/js/JSGeolocationCustom.cpp:
173         (WebCore::createPositionOptions):
174         (WebCore::JSGeolocation::getCurrentPosition):
175         (WebCore::JSGeolocation::watchPosition):
176         * bindings/js/JSMessagePortCustom.cpp:
177         (WebCore::fillMessagePortArray):
178         * bindings/js/JSSQLTransactionCustom.cpp:
179         (WebCore::JSSQLTransaction::executeSql):
180         * bindings/js/ScriptControllerMac.mm:
181         (WebCore::ScriptController::createScriptInstanceForWidget):
182         * bindings/scripts/CodeGeneratorJS.pm:
183         (GenerateCallWith):
184         * crypto/mac/CryptoKeyRSAMac.cpp:
185         (WebCore::CryptoKeyRSA::generatePair):
186         * css/CSSBasicShapes.cpp:
187         (WebCore::buildSerializablePositionOffset):
188         * css/CSSComputedStyleDeclaration.cpp:
189         (WebCore::valueForNinePieceImageRepeat):
190         (WebCore::counterToCSSValue):
191         (WebCore::ComputedStyleExtractor::propertyValue):
192         * css/CSSContentDistributionValue.cpp:
193         (WebCore::CSSContentDistributionValue::customCSSText):
194         * css/CSSFilterImageValue.cpp:
195         (WebCore::CSSFilterImageValue::image):
196         * css/CSSFilterImageValue.h:
197         * css/CSSGrammar.y.in:
198         * css/CSSNamedImageValue.cpp:
199         (WebCore::CSSNamedImageValue::image):
200         * css/CSSNamedImageValue.h:
201         * css/CSSParser.cpp:
202         (WebCore::CSSParser::parseFillProperty):
203         (WebCore::CSSParser::parseAnimationProperty):
204         (WebCore::CSSParser::parseInsetRoundedCorners):
205         (WebCore::ShadowParseContext::commitLength):
206         (WebCore::CSSParser::parseShadow):
207         (WebCore::BorderImageSliceParseContext::commitNumber):
208         (WebCore::BorderImageQuadParseContext::commitNumber):
209         (WebCore::CSSParser::parseBorderRadius):
210         (WebCore::CSSParser::parseCounter):
211         (WebCore::CSSParser::parseDeprecatedGradient):
212         (WebCore::CSSParser::parseDeprecatedLinearGradient):
213         (WebCore::CSSParser::parseDeprecatedRadialGradient):
214         (WebCore::CSSParser::parseLinearGradient):
215         (WebCore::CSSParser::parseRadialGradient):
216         (WebCore::CSSParser::parseTransformValue):
217         (WebCore::CSSParser::parseBuiltinFilterArguments):
218         (WebCore::CSSParser::parseTextIndent):
219         (WebCore::CSSParser::popRuleData):
220         (WebCore::CSSParser::markRuleHeaderStart):
221         (WebCore::CSSParser::createViewportRule):
222         * css/CSSParser.h:
223         * css/CSSParserValues.cpp:
224         (WebCore::CSSParserValue::createCSSValue):
225         * css/CSSParserValues.h:
226         * css/CSSValueList.cpp:
227         (WebCore::CSSValueList::copy):
228         * css/CSSValueList.h:
229         * css/SVGCSSComputedStyleDeclaration.cpp:
230         (WebCore::ComputedStyleExtractor::svgPropertyValue):
231         * css/StyleBuilderConverter.h:
232         (WebCore::StyleBuilderConverter::convertClipPath):
233         (WebCore::StyleBuilderConverter::convertReflection):
234         * css/StyleResolver.cpp:
235         (WebCore::StyleResolver::cachedOrPendingFromValue):
236         (WebCore::StyleResolver::setOrPendingFromValue):
237         (WebCore::StyleResolver::cursorOrPendingFromValue):
238         * css/StyleResolver.h:
239         * css/StyleRule.cpp:
240         (WebCore::StyleRuleBase::createCSSOMWrapper):
241         * css/StyleRule.h:
242         * dom/Attr.cpp:
243         (WebCore::Attr::create):
244         * dom/Attr.h:
245         * dom/ContainerNode.h:
246         (WebCore::ChildNodesLazySnapshot::nextNode):
247         * dom/Document.cpp:
248         (WebCore::Document::setFocusedElement):
249         (WebCore::Document::takeDOMWindowFrom):
250         (WebCore::Document::updateHoverActiveState):
251         * dom/Element.cpp:
252         (WebCore::Element::detachAttribute):
253         (WebCore::Element::setAttributeNodeNS):
254         (WebCore::Element::ensureAttr):
255         * dom/Element.h:
256         * dom/MessagePort.cpp:
257         (WebCore::MessagePort::dispatchMessages):
258         (WebCore::MessagePort::entanglePorts):
259         * dom/NodeIterator.cpp:
260         (WebCore::NodeIterator::nextNode):
261         (WebCore::NodeIterator::previousNode):
262         * dom/Range.cpp:
263         (WebCore::Range::processContentsBetweenOffsets):
264         * dom/StyledElement.cpp:
265         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
266         * editing/ApplyBlockElementCommand.cpp:
267         (WebCore::ApplyBlockElementCommand::createBlockElement):
268         * editing/ApplyBlockElementCommand.h:
269         * editing/ApplyStyleCommand.cpp:
270         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
271         * editing/CompositeEditCommand.cpp:
272         (WebCore::CompositeEditCommand::applyCommandToComposite):
273         (WebCore::CompositeEditCommand::appendBlockPlaceholder):
274         (WebCore::CompositeEditCommand::insertBlockPlaceholder):
275         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
276         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
277         (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
278         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
279         (WebCore::CompositeEditCommand::moveParagraphs):
280         * editing/CompositeEditCommand.h:
281         * editing/EditingStyle.cpp:
282         (WebCore::EditingStyle::wrappingStyleForSerialization):
283         (WebCore::styleFromMatchedRulesForElement):
284         (WebCore::extractPropertiesNotIn):
285         (WebCore::backgroundColorInEffect):
286         * editing/EditingStyle.h:
287         * editing/Editor.cpp:
288         (WebCore::Editor::increaseSelectionListLevel):
289         (WebCore::Editor::increaseSelectionListLevelOrdered):
290         (WebCore::Editor::increaseSelectionListLevelUnordered):
291         (WebCore::Editor::findStringAndScrollToVisible):
292         (WebCore::Editor::rangeOfString):
293         * editing/Editor.h:
294         * editing/InsertParagraphSeparatorCommand.cpp:
295         (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):
296         * editing/InsertParagraphSeparatorCommand.h:
297         * editing/MergeIdenticalElementsCommand.cpp:
298         (WebCore::MergeIdenticalElementsCommand::doUnapply):
299         * editing/ModifySelectionListLevel.cpp:
300         (WebCore::IncreaseSelectionListLevelCommand::doApply):
301         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
302         * editing/ModifySelectionListLevel.h:
303         * editing/RemoveNodeCommand.cpp:
304         (WebCore::RemoveNodeCommand::doUnapply):
305         * editing/RemoveNodePreservingChildrenCommand.cpp:
306         (WebCore::RemoveNodePreservingChildrenCommand::doApply):
307         * editing/ReplaceSelectionCommand.cpp:
308         (WebCore::ReplacementFragment::insertFragmentForTestRendering):
309         * editing/SpellingCorrectionCommand.cpp:
310         (WebCore::SpellingCorrectionCommand::doApply):
311         * editing/mac/DictionaryLookup.h:
312         * editing/mac/DictionaryLookup.mm:
313         (WebCore::DictionaryLookup::rangeForSelection):
314         (WebCore::DictionaryLookup::rangeAtHitTestResult):
315         * html/HTMLFormElement.cpp:
316         (WebCore::HTMLFormElement::finishRequestAutocomplete):
317         * html/HTMLMediaElement.cpp:
318         (WebCore::HTMLMediaElement::scheduleEvent):
319         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
320         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
321         (WebCore::HTMLMediaElement::addTextTrack):
322         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
323         * html/HTMLMediaElement.h:
324         * html/canvas/OESVertexArrayObject.cpp:
325         (WebCore::OESVertexArrayObject::createVertexArrayOES):
326         * html/canvas/OESVertexArrayObject.h:
327         * html/canvas/WebGLRenderingContextBase.cpp:
328         (WebCore::WebGLRenderingContextBase::getContextAttributes):
329         * html/canvas/WebGLRenderingContextBase.h:
330         * html/track/VTTCue.cpp:
331         (WebCore::VTTCue::getCueAsHTML):
332         (WebCore::VTTCue::createCueRenderingTree):
333         * html/track/VTTCue.h:
334         * html/track/WebVTTElement.cpp:
335         (WebCore::WebVTTElement::createEquivalentHTMLElement):
336         * html/track/WebVTTElement.h:
337         * html/track/WebVTTParser.cpp:
338         (WebCore::WebVTTTreeBuilder::buildFromString):
339         (WebCore::WebVTTParser::createDocumentFragmentFromCueText):
340         * html/track/WebVTTParser.h:
341
342 2016-05-05  Gavin Barraclough  <barraclough@apple.com>
343
344         Allow some leeway after page load before throttling, to allow post load events to complete.
345         https://bugs.webkit.org/show_bug.cgi?id=157499
346
347         Reviewed by Ryosuke Niwa
348
349         * page/PageThrottler.cpp:
350         (WebCore::PageThrottler::PageThrottler):
351             - m_pageLoadActivityCounter now affects activity state indirecty, via m_pageLoadActivityHysteresis.
352         (WebCore::PageThrottler::pageLoadActivityCounterChanged):
353             - counter updates hysteresis object, which in turn will affect activity state.
354         * page/PageThrottler.h:
355             - added m_pageLoadActivityHysteresis, pageLoadActivityCounterChanged.
356
357 2016-05-10  Zalan Bujtas  <zalan@apple.com>
358
359         REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
360         https://bugs.webkit.org/show_bug.cgi?id=157445
361
362         Reviewed by Simon Fraser.
363
364         When we don't run transitions (becasuse of to/from 'auto' values) we should also not
365         report the 'from' value and behave as if we finished the transition already.
366
367         Test: fast/animation/height-auto-transition-computed-value.html
368
369         * page/animation/KeyframeAnimation.cpp:
370         (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): This is a revert of
371         looping the 'to' value back to the first keyframe when reverse animation is at the start value (last keyframe).
372
373         * platform/Length.cpp:
374         (WebCore::blend):
375
376 2016-05-09  Dean Jackson  <dino@apple.com>
377
378         [iOS] <select> elements should render right-aligned when in RTL mode
379         https://bugs.webkit.org/show_bug.cgi?id=157501
380         <rdar://problem/26187870>
381
382         Reviewed by Antoine Quint.
383
384         This is the equivalent of http://webkit.org/b/157112 for iOS.
385         Handle <select> elements when we're in RTL mode. This means
386         drawing the button with the drop-down arrow on the left
387         side, and the button text right-aligned.
388
389         Test: fast/forms/select-non-native-rendering-direction.html
390         plus a bunch of other ones that needed rebaselining.
391
392         * rendering/RenderThemeIOS.mm: Rename MenuListButtonPaddingRight to MenuListButtonPaddingAfter.
393         (WebCore::RenderThemeIOS::popupInternalPaddingBox): Handle both directions.
394         (WebCore::adjustInputElementButtonStyle):
395         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Handle drawing in
396         RTL mode.
397
398 2016-05-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
399
400         NodeList should be iterable
401         https://bugs.webkit.org/show_bug.cgi?id=131443
402         <rdar://problem/25731519>
403
404         Reviewed by Darin Adler.
405
406         Test: fast/dom/nodeListIterator.html
407
408         Updating JSKeyValueIterator to support map and set iterators,
409         depending on the signature of the result type of DOMClass::Iterator::next method.
410         Symbol.iterator method is made the same as values method for set iterators.
411
412         Adding support for NodeList.
413         Updating FontFaceSet to take benefit of that. 
414
415         * bindings/js/JSDOMBinding.h:
416         (WebCore::jsPair):.
417         * bindings/js/JSKeyValueIterator.h:
418         (WebCore::IteratorInspector::decltype): IteratorInspector detects whether the iterator is a set or map iterator.
419         (WebCore::IteratorInspector::test):
420         (WebCore::fillForEachArgumentsWithIteratorValue): Specializing according set/map iterator.
421         (WebCore::iteratorValueToJS): Ditto.
422         (WebCore::keyValueIteratorForEach):
423         (WebCore::JSKeyValueIterator<JSWrapper>::next):
424         * bindings/scripts/CodeGeneratorJS.pm:
425         (GenerateImplementationIterableFunctions): Removed the line forbidding set iterators.
426         Making Symbol.iterator function equal to values for set iterators.
427         * bindings/scripts/test/JS/JSTestNode.cpp: Rebasing with set iterator functions.
428         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing according updated function names.
429         * bindings/scripts/test/TestNode.idl: Making TestNode set iterable.
430         * css/FontFaceSet.cpp:
431         (WebCore::FontFaceSet::Iterator::next): Refactoring to make it a set iterator.
432         * css/FontFaceSet.h:
433         * css/FontFaceSet.idl:
434         * dom/NodeList.h: Making NodeList iterable.
435         (WebCore::NodeList::Iterator::Iterator):
436         (WebCore::NodeList::Iterator::next):
437         (WebCore::NodeList::createIterator):
438         * dom/NodeList.idl:
439
440 2016-05-09  Sergio Villar Senin  <svillar@igalia.com>
441
442         [css-grid] Implement auto-repeat computation
443         https://bugs.webkit.org/show_bug.cgi?id=157473
444
445         Reviewed by Darin Adler.
446
447         We added support for parsing and style for the new auto-repeat syntax. This patch actually
448         implements the feature by computing the number of auto-repeat tracks that will be part of
449         the explicit grid depending on the available size on the corresponding axis.
450
451         Note that we still do not drop the empty tracks, i.e., auto-fit will work exactly as
452         auto-fill until the empty track removal is implemented.
453
454         Some test results are not totally correct yet because we need to add the line names to the
455         computed style. As that requires a rather large piece of code it will be done in a follow up
456         patch. Track sizes are correct though.
457
458         Tests: fast/css-grid-layout/grid-auto-fill-columns.html
459                fast/css-grid-layout/grid-auto-fill-rows.html
460                fast/css-grid-layout/grid-change-auto-repeat-tracks.html
461                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-001.html
462                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-002.html
463                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-003.html
464                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-004.html
465                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-005.html
466
467         * css/CSSParser.cpp:
468         (WebCore::CSSParser::parseGridTrackRepeatFunction): Add the CSSAutoRepeatValue directly
469         instead of adding the track size.
470         * css/StyleBuilderCustom.h: Store the insertion point in style.
471         * rendering/RenderGrid.cpp:
472         (WebCore::RenderGrid::guttersSize): Replaced size_t by unsigned.
473         (WebCore::RenderGrid::rawGridTrackSize): New function which retrieves the track size from
474         either explicit (including auto-repeat tracks) or implicit tracks.
475         (WebCore::RenderGrid::gridTrackSize): Use rawGridTrackSize().
476         (WebCore::RenderGrid::computeAutoRepeatTracksCount): This is the core of the patch. This
477         method computes the number of auto-repeat tracks that fits on the available size for a given
478         axis (or 1 if that's indefinite).
479         * rendering/RenderGrid.h:
480
481 2016-05-09  Alex Christensen  <achristensen@webkit.org>
482
483         Fix GTK build after r200607
484
485         * Modules/notifications/Notification.h:
486         dir and replaceId are used in WebNotificationManager with NOTIFICATIONS and with LEGACY_NOTIFICATIONS
487
488 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
489
490         Fix the Windows build after r200602, and do some minor tidyup.
491
492         * platform/graphics/ca/PlatformCALayer.h:
493         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
494         (PlatformCALayerCocoa::contentsHidden):
495         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
496         (PlatformCALayerWin::contentsHidden):
497         (PlatformCALayerWin::setContentsHidden):
498         * platform/graphics/ca/win/PlatformCALayerWin.h:
499
500 2016-05-09  Darin Adler  <darin@apple.com>
501
502         Change Notification constructor to take an IDL dictionary instead of a WebCore::Dictionary
503         https://bugs.webkit.org/show_bug.cgi?id=157466
504
505         Reviewed by Alex Christensen.
506
507         * Modules/notifications/Notification.cpp: Got rid of unneeded includes.
508         (WebCore::Notification::Notification): Deleted the unused default constructor. Changed
509         NotificationCenter argument to be reference rather than PassRefPtr. Changed one of the
510         ScriptExecutionContext arguments to be a Document since the code relies on that already.
511         Used the lambda form of timer creation instead of the class member form. Added a FIXME
512         about when m_notificationCenter can be null.
513         (WebCore::Notification::create): Changed NotificationCenter argument to be reference
514         rather than PassRefPtr. Changed options argument to be Options rather than Dictionary.
515         (WebCore::directionString): Added. Helper because the class still wants to store the
516         direction as a string, at least for now.
517         (WebCore::Notification::show): Streamlined the code a bit.
518         (WebCore::Notification::taskTimerFired): Deleted. Not needed now that we use a lambda
519         inside the constructor.
520         (WebCore::Notification::permission): Removed unneeded const from return type.
521         (WebCore::Notification::permissionString): Ditto.
522
523         * Modules/notifications/Notification.h: Used pragma once, updated for changes above.
524         Removed a number of unused functions, including cancel, setIconURL, setLang,
525         stopLoadingIcon, detachPresenter, setBody, startLoadingIcon, finishLoadingIcon, and
526         taskTimerFired.
527
528         * Modules/notifications/Notification.idl: Add NotificationOptions and pass it instead
529         of Dictionary to the constructor. Note that this is only a subset of what is
530         currently specified in the Notifications API document. The latest document specifies
531         a much more complex feature with lots more options.
532
533         * Modules/notifications/NotificationCenter.cpp:
534         (WebCore::NotificationCenter::createNotification): Pass a reference rather than a
535         pointer to this.
536         * Modules/notifications/NotificationClient.h: Use pragma once. Removed unneeded
537         includes and forward declarations. Fixed #if to be easier to read.
538
539         * bindings/js/JSDOMConvert.h: Reworked the convert functions to use Converter and
540         DefaultConverter structs so we can do partial specialization in the future and so
541         we can get custom types for optional values. Used this to make an optional String
542         just be a null String, so it won't try to use Optional<String> instead. Might get
543         more complex latter when we add support for nullable.
544
545         * bindings/scripts/CodeGeneratorJS.pm:
546         (GenerateEnumerationImplementationContent): Generate a blank line to make the output
547         slightly clearer. Tweaked a comment.
548         (GenerateDefaultValue): Added. Converts the default syntax from IDL into the syntax
549         needed in C++ code.
550         (GenerateDefaultValueWithLeadingComma): Added. Helper for use below.
551         (GenerateDictionaryImplementationContent): Use GenerateDefaultValue and
552         GenerateDefaultValueWithLeadingComma to make default values.
553         (GenerateParametersCheck): Use GenerateDefaultValue here in the enumeration code
554         path. This is a step in the direction of being able to make the whole thing more
555         generic in the future.
556
557         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
558         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
559         * bindings/scripts/test/JS/JSTestObj.cpp:
560         * bindings/scripts/test/ObjC/DOMTestObj.h:
561         * bindings/scripts/test/ObjC/DOMTestObj.mm:
562         Regenerated.
563
564         * bindings/scripts/test/TestObj.idl: Simplified and extended some of the test cases
565         to cover more combinations of the dictionary and enumeration support.
566
567 2016-05-09  Brady Eidson  <beidson@apple.com>
568
569         Modern IDB: Have server database connections remember the OpenDB request that spawned them.
570         https://bugs.webkit.org/show_bug.cgi?id=157498
571
572         Reviewed by Tim Horton.
573
574         No new tests (No testable change in behavior, debug only for now).
575
576         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
577         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
578         
579         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
580         (WebCore::IDBServer::UniqueIDBDatabaseConnection::create):
581         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
582         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
583         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didFireVersionChangeEvent):
584         (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
585         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
586         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
587         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
588         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
589         (WebCore::IDBServer::UniqueIDBDatabaseConnection::openRequestIdentifier):
590
591 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
592
593         [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
594         https://bugs.webkit.org/show_bug.cgi?id=157496
595
596         Reviewed by Tim Horton.
597
598         UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
599         with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.
600
601         Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
602         user interaction on these views.
603
604         Test: fast/scrolling/ios/touch-scroll-visibility-hidden.html
605
606         * platform/graphics/ca/GraphicsLayerCA.cpp:
607         (WebCore::GraphicsLayerCA::updateContentsVisibility): We have to tell the scrolling layer
608         if we have visibility:hidden.
609         * platform/graphics/ca/PlatformCALayer.h:
610         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
611         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
612         (PlatformCALayerCocoa::contentsHidden):
613         (PlatformCALayerCocoa::setContentsHidden):
614         * rendering/RenderLayerBacking.cpp:
615         (WebCore::RenderLayerBacking::updateAfterDescendants):
616
617 2016-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
618
619         Web Font is downloaded even when all the characters in the document are outside its unicode-range
620         https://bugs.webkit.org/show_bug.cgi?id=42154
621         <rdar://problem/17779042>
622
623         Reviewed by Darin Adler.
624
625         Fonts are requested in two stages:
626         - For a given font family, all the relevant @font-face rules are consulted. We build up a
627         mapping of unicode-range -> Font object. This result is cached.
628         - Then, when we have the mapping, we look up the character we are trying to render to
629         find the appropriate Font object.
630
631         However, we are not supposed to create any Font objects (because that causes a download to
632         be triggered) until we consult with the character we're trying to render. Therefore, this
633         patch swaps out the Font objects with a FontAccessor. This FontAccessor is essentially a
634         lazily-created Font. When step 2 starts looking up the appropriate character, the
635         FontAccessor will be asked to start the download.
636
637         Test: fast/text/unicode-range-download.html
638
639         * css/CSSFontFace.cpp:
640         (WebCore::CSSFontFace::removeClient): 
641         as a client from all its CSSFontFaces.
642         * css/CSSFontFaceSet.cpp:
643         (WebCore::CSSFontFaceSet::clear): Clearing the CSSFontFaceSet needs to remove itself as a
644         client from all its CSSFontFaces.
645         * css/CSSSegmentedFontFace.cpp:
646         (WebCore::CSSFontAccessor::create): The lazy Font object.
647         (WebCore::CSSFontAccessor::CSSFontAccessor): Ditto.
648         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Appends a FontAccessor.
649         (WebCore::CSSSegmentedFontFace::fontRanges): Create the FontAccessor and use it instead.
650         * platform/graphics/FontCascadeFonts.cpp:
651         (WebCore::FontCascadeFonts::determinePitch): Use the fontForFirstRange() convenience
652         function.
653         (WebCore::glyphPageFromFontRanges): font() may now return nullptr. Update this function to
654         handle that.
655         * platform/graphics/FontRanges.cpp:
656         (WebCore::FontRanges::Range::font): Trigger the lazy initialization.
657         (WebCore::TrivialFontAccessor::create): Used in the case where there is only one font in
658         the Ranges object and it has a full unicode-range.
659         (WebCore::TrivialFontAccessor::TrivialFontAccessor):
660         (WebCore::FontRanges::FontRanges): Use TrivialFontAccessor.
661         (WebCore::FontRanges::glyphDataForCharacter): font() may now return nullptr. Update this
662         function to handle that. This is where the magic happens: this is where we trigger
663         downloads only if the character falls within the unicode-range.
664         (WebCore::FontRanges::fontForFirstRange): Add ASSERT.
665         (WebCore::FontRanges::isLoading): Update to use the new FontAccessor.
666         * platform/graphics/FontRanges.h: Ditto.
667         (WebCore::FontRanges::Range::Range):
668         (WebCore::FontRanges::Range::fontAccessor):
669         (WebCore::FontRanges::appendRange):
670         (WebCore::FontRanges::Range::font): Deleted.
671         * platform/graphics/FontSelector.h: The virtual base class of FontAccessor. This is
672         necessary because it must be shared between platform code and non-platform code.
673         (WebCore::FontAccessor::~FontAccessor):
674
675 2016-05-09  Brady Eidson  <beidson@apple.com>
676
677         Modern IDB: Prevent the same transaction from being commited/aborted twice.
678         https://bugs.webkit.org/show_bug.cgi?id=157494
679
680         Reviewed by Tim Horton.
681
682         When a page navigates or a worker terminates, in rare cases with specific unfortunate timing, the IDBServer
683         might receive a request to commit/abort a transaction that is already in the process of committing/aborting.
684         
685         By moving transactions that are finishing into their own map we can at least detect this situation and
686         return an error. This seems like an improvement over some mysterious ASSERTs/timeouts.
687
688         No new tests:
689         While apparent that this is at least partially to blame for some existing timeouts/ASSERTs, I could not nail 
690         down a reliable way to reproduce this with a dedicated test.
691         
692         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
693         (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase):
694         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
695         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
696         (WebCore::IDBServer::UniqueIDBDatabase::prepareToFinishTransaction):
697         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
698         (WebCore::IDBServer::UniqueIDBDatabase::didPerformCommitTransaction):
699         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
700         (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction):
701         (WebCore::IDBServer::UniqueIDBDatabase::hasUnfinishedTransactions):
702         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
703         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
704         (WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted): Renamed from inProgressTransactionCompleted.
705         (WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted.
706         * Modules/indexeddb/server/UniqueIDBDatabase.h:
707
708 2016-05-09  Tim Horton  <timothy_horton@apple.com>
709
710         Draw border and correct icon for placeholder attachments
711         https://bugs.webkit.org/show_bug.cgi?id=157495
712         rdar://problem/19982510
713
714         Reviewed by Anders Carlsson.
715
716         * Resources/AttachmentPlaceholder.png: Added.
717         * Resources/AttachmentPlaceholder@2x.png: Added.
718         * WebCore.xcodeproj/project.pbxproj:
719         * rendering/RenderThemeMac.mm:
720         (WebCore::attachmentPlaceholderBorderColor):
721         (WebCore::paintAttachmentIconPlaceholder):
722         (WebCore::paintAttachmentProgress):
723         (WebCore::paintAttachmentPlaceholderBorder):
724         (WebCore::RenderThemeMac::paintAttachment):
725         If progress is set, but set to 0, draw a dashed border around the attachment
726         and use the placeholder "download" artwork.
727
728 2016-05-09  Ada Chan  <adachan@apple.com>
729
730         Introduce WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen() and use it in WebVideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen()
731         https://bugs.webkit.org/show_bug.cgi?id=157493
732
733         Reviewed by Dan Bernstein.
734
735         * platform/mac/WebVideoFullscreenInterfaceMac.h:
736         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
737         (WebCore::WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen):
738
739 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
740
741         Clean up iOS text autosizing code
742         https://bugs.webkit.org/show_bug.cgi?id=157489
743
744         Reviewed by Zalan Bujtas.
745
746         Change the TraverseNextInclusionFunction and HeightTypeTraverseNextInclusionFunction
747         to take references.
748         
749         Use downcast<> more.
750         
751         Whitespace cleanup.
752
753         * rendering/RenderBlockFlow.cpp:
754         (WebCore::isNonBlocksOrNonFixedHeightListItems):
755         * rendering/RenderElement.cpp:
756         (WebCore::includeNonFixedHeight):
757         * rendering/RenderObject.cpp:
758         (WebCore::RenderObject::traverseNext):
759         * rendering/RenderObject.h:
760         * rendering/TextAutoSizing.cpp:
761         (WebCore::TextAutoSizingValue::adjustNodeSizes):
762         (WebCore::TextAutoSizingValue::reset):
763
764 2016-05-09  Anders Carlsson  <andersca@apple.com>
765
766         Add injected bundle SPI for getting favicon and touch icon URLs
767         https://bugs.webkit.org/show_bug.cgi?id=157435
768
769         Reviewed by Darin Adler.
770
771         * CMakeLists.txt:
772         Add new files.
773
774         * WebCore.xcodeproj/project.pbxproj:
775         Add new files.
776
777         * html/HTMLLinkElement.cpp:
778         (WebCore::HTMLLinkElement::iconType):
779         * html/HTMLLinkElement.h:
780         Rename LinkRelAttribute::IconType to LinkIconType.
781
782         * html/LinkIconCollector.cpp: Added.
783         (WebCore::iconSize):
784         New helper function that returns the icon size for an icon.
785
786         (WebCore::compareIcons):
787         Icon comparison function, to be used by for sorting.
788
789         (LinkIconCollector::iconsOfTypes):
790         Gather the right icons, sort them (descending by size) and return them.
791
792         * html/LinkIconCollector.h:
793         Added.
794
795         * html/LinkIconType.h:
796         Move icon type declarations here and arrange them so we can use them in an OptionSet.
797
798         * html/LinkRelAttribute.cpp:
799         (WebCore::LinkRelAttribute::LinkRelAttribute):
800         * html/LinkRelAttribute.h:
801         * loader/icon/IconController.cpp:
802         (WebCore::iconFromLinkElements):
803         Rename IconType to LinkIconType.
804
805 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
806
807         [iOS WK2] Font size increases on some pages after navigating then going back
808         https://bugs.webkit.org/show_bug.cgi?id=157441
809         rdar://problem/22873240
810
811         Reviewed by Darin Adler.
812
813         Sometimes I want to dump ViewportConfigurations from WebKit2 so export dump().
814
815         Test: fast/text-autosizing/ios/text-autosizing-after-back.html
816
817         * page/ViewportConfiguration.h:
818
819 2016-05-09  Eric Carlson  <eric.carlson@apple.com>
820
821         "Main content" restrictions should not apply to media documents
822         https://bugs.webkit.org/show_bug.cgi?id=157479
823         <rdar://problem/25840861>
824
825         Reviewed by Jer Noble.
826
827         No new tests, this change only applies to media documents in a top level document so it
828         isn't possible to have a layout test.
829
830         * html/HTMLMediaElement.cpp:
831         (WebCore::HTMLMediaElement::HTMLMediaElement): Don't apply restrictions to a media document.
832
833 2016-05-09  Dean Jackson  <dino@apple.com>
834
835         Update Picture-in-picture artwork
836         https://bugs.webkit.org/show_bug.cgi?id=157484
837         <rdar://problem/26177784>
838
839         Reviewed by Eric Carlson.
840
841         We have new artwork for the picture-in-picture presentation mode. I
842         also converted it to use SVG (and moved the button style to a
843         more consistent part of the file).
844
845         * Modules/mediacontrols/mediaControlsApple.css:
846         (video::-webkit-media-controls-panel .picture-in-picture-button):
847         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture):
848         (video::-webkit-media-controls-panel .picture-in-picture-button:active):
849         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture:active):
850
851 2016-05-09  Chris Dumez  <cdumez@apple.com>
852
853         Optimize [StrictTypeChecking] on IDL operations
854         https://bugs.webkit.org/show_bug.cgi?id=157467
855
856         Reviewed by Darin Adler.
857
858         Optimize [StrictTypeChecking] on IDL operations so that:
859         - Only generate extra code for nullable parameters because for non-nullable
860           parameters, JSXXX::toWrapped() will return null in case of a bad input
861           type. We will then throw a TypeError when null-checking it already.
862         - After the JSValue::isNullOrUndefined() check, avoid calling
863           JSXXX::toWrapped() and set nativeValue to nullptr directly.
864         - Drop the check for JSValue::inherits(JSXXX::info()) and just do a null
865           check on the value returned by JSXXX::toWrapped(). toWrapped() already
866           does a JSValue::inherits(JSXXX::info() check. Since we only call
867           toWrapped() if the JSValue is not null/undefined, a null return value
868           always indicates a bad input type.
869
870         Also update the TypeError message to be more useful when passing null
871         for non-nullable parameters or assigning null to a non-nullable
872         attribute. The message is now consistent with the one used for strict
873         type checking.
874
875         No new tests, rebaselined existing tests.
876
877         * bindings/js/JSDOMBinding.h:
878         * bindings/scripts/CodeGeneratorJS.pm:
879         (GenerateImplementation):
880         (GenerateParametersCheck):
881         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
882         (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
883         * bindings/scripts/test/JS/JSTestInterface.cpp:
884         (WebCore::setJSTestInterfaceImplementsNode):
885         (WebCore::setJSTestInterfaceSupplementalNode):
886         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
887         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
888         * bindings/scripts/test/JS/JSTestObj.cpp:
889         (WebCore::setJSTestObjTestObjAttr):
890         (WebCore::setJSTestObjLenientTestObjAttr):
891         (WebCore::setJSTestObjXMLObjAttr):
892         (WebCore::setJSTestObjTypedArrayAttr):
893         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
894         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
895         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
896         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
897         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
898         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
899         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
900         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
901         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
902         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
903         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
904         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
905         (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
906         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
907         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
908         (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
909         (WebCore::jsTestObjPrototypeFunctionConvert1):
910         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
911         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
912         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
913         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
914         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
915         (WebCore::constructJSTestOverloadedConstructors1):
916         (WebCore::constructJSTestOverloadedConstructors2):
917         (WebCore::constructJSTestOverloadedConstructors3):
918         * bindings/scripts/test/TestObj.idl:
919
920 2016-05-09  Tim Horton  <timothy_horton@apple.com>
921
922         Download progress on attachment elements sometimes exceeds element bounds
923         https://bugs.webkit.org/show_bug.cgi?id=157440
924         <rdar://problem/25245440>
925
926         Reviewed by Darin Adler.
927
928         In the case of very large dynamic type sizes, we can overflow the
929         bounds of the attachment. It turns out that we used to limit to one
930         line in many cases anyway, so only wrap if we have only a title and/or icon.
931         This looks better when you have many of the other elements even in
932         non-large-type modes.
933
934         * rendering/RenderThemeIOS.mm:
935         (WebCore::AttachmentInfo::buildTitleLines):
936         (WebCore::AttachmentInfo::AttachmentInfo):
937         Limit the title to a single line if we have anything
938         other than a title and icon.
939
940         (WebCore::attachmentBorderPath):
941         (WebCore::paintAttachmentBorder):
942         (WebCore::RenderThemeIOS::paintAttachment):
943         Clip to the border, so that even if somehow we paint outside of
944         the bounds, we don't paint over other parts of the page.
945
946 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
947
948         REGRESSION (198056): Unable to use edit buttons on WordPress
949         https://bugs.webkit.org/show_bug.cgi?id=157475
950
951         Reviewed by Antti Koivisto.
952
953         Renamed Event.prototype.deepPath() to composedPath() per discussions on
954         https://github.com/whatwg/dom/issues/242 as the old name was not Web compatible.
955
956         Test: fast/shadow-dom/Extensions-to-Event-Interface.html
957
958         * dom/Event.cpp:
959         (WebCore::Event::composedPath): Renamed from deepPath.
960         * dom/Event.h:
961         * dom/Event.idl:
962
963 2016-05-09  Alex Christensen  <achristensen@webkit.org>
964
965         Don't use DiskCache for media resource loads
966         https://bugs.webkit.org/show_bug.cgi?id=157405
967
968         Reviewed by Darin Adler.
969
970         http/tests/security/video-cross-origin-caching.html was loading from the disk cache.
971         This patch adds an assertion that fires in that test without this fix.
972
973         * loader/MediaResourceLoader.cpp:
974         (WebCore::MediaResourceLoader::requestResource):
975         * platform/graphics/PlatformMediaResourceLoader.h:
976         * platform/network/ResourceRequestBase.h:
977         (WebCore::ResourceRequestBase::hiddenFromInspector):
978         (WebCore::ResourceRequestBase::setHiddenFromInspector):
979         (WebCore::ResourceRequestBase::requester):
980         (WebCore::ResourceRequestBase::setRequester):
981         * platform/network/cocoa/WebCoreNSURLSession.mm:
982         (-[WebCoreNSURLSessionDataTask _restart]):
983         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
984
985 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
986
987         Refactor FocusController::findFocusableElementRecursively
988         https://bugs.webkit.org/show_bug.cgi?id=157415
989
990         Reviewed by Darin Adler.
991
992         Refactor FocusController::findFocusableElementRecursively and related functions. Extracted two functions:
993         nextFocusableElementWithinScope and previousFocusableElementWithinScope out of it since they didn't really share
994         any code other than calling findFocusableElement at the beginning.
995
996         Also renamed internal variant of nextFocusableElement and previousFocusableElement to nextFocusableElementOrScopeOwner
997         and previousFocusableElementOrScopeOwner. It was confusing to have these internal functions in addition to public
998         member functions that are used in Objective-C DOM API.
999
1000         No new tests are added since there should be no behavioral change.
1001
1002         * page/FocusController.cpp:
1003         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): Added a FIXME.
1004         (WebCore::FocusController::advanceFocusInDocumentOrder): Use findFocusableElementAcrossFocusScope instead of manually
1005         calling findFocusableElementRecursively and findFocusableElementDescendingDownIntoFrameDocument separately.
1006         (WebCore::FocusController::findFocusableElementAcrossFocusScope): Now that findFocusableElementWithinScope calls
1007         findFocusableElementDescendingDownIntoFrameDocument internally, there is no need to keep around "found" local variable.
1008         Introduce a few early exists for a better clarity.
1009         (WebCore::FocusController::findFocusableElementWithinScope): Renamed from findFocusableElementRecursively. Also call
1010         findFocusableElementDescendingDownIntoFrameDocument here instead of findFocusableElementAcrossFocusScope.
1011         (WebCore::FocusController::nextFocusableElementWithinScope): Extracted from findFocusableElementRecursively.
1012         (WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
1013         (WebCore::FocusController::findFocusableElement):
1014         (WebCore::FocusController::nextFocusableElement): Added a FIXME.
1015         (WebCore::FocusController::previousFocusableElement): Ditto.
1016         (WebCore::FocusController::findFocusableElementOrScopeOwner): Renamed from findFocusableElement for clarity.
1017         (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
1018         (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
1019         * page/FocusController.h:
1020
1021 2016-05-09  Manuel Rego Casasnovas  <rego@igalia.com>
1022
1023         [css-grid] Fix static position for positioned grid items
1024         https://bugs.webkit.org/show_bug.cgi?id=157417
1025
1026         Reviewed by Darin Adler.
1027
1028         The spec was updated to define properly the static position
1029         for positioned grid items, but we didn't update the implementation yet:
1030         https://drafts.csswg.org/css-grid-1/issues-wd-20150108#issue-1
1031
1032         We were only setting the static position when the start line
1033         was not auto. Otherwise we were using the default one
1034         which includes the padding.
1035         With the spec change we need to set it always,
1036         even if the start line is auto.
1037
1038         * rendering/RenderGrid.cpp:
1039         (WebCore::RenderGrid::layoutPositionedObject):
1040         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1041
1042 2016-05-08  Frederic Wang  <fwang@igalia.com>
1043
1044         RenderMathMLOperator: refactor management of stretchy data and italic correction
1045         https://bugs.webkit.org/show_bug.cgi?id=156913
1046
1047         Reviewed by Darin Adler.
1048
1049         No new tests, behavior is not changed.
1050
1051         The stretchy data uses a shared space to describe horizontal / vertical directions and
1052         unstretched / size variant / glyph assembly. We use a simple struct with some unions to
1053         represent it instead of the current implementation with a class.
1054         We also modify the signature of some functions to retrieve display operator and stretchy
1055         data to use that new structure and prepare the move to a separate MathOperator class.
1056         Finally, we introduce some helper functions to easily set the stretchy data.
1057
1058         * rendering/mathml/RenderMathMLOperator.cpp:
1059         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use the new data members and
1060         function signatures.
1061         (WebCore::RenderMathMLOperator::setSizeVariant): New helper function to set a size variant.
1062         (WebCore::RenderMathMLOperator::setGlyphAssembly): New helper function to set a glyph
1063         assembly.
1064         (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): We change the signature to use a
1065         GlyphAssemblyData.
1066         (WebCore::RenderMathMLOperator::findDisplayStyleLargeOperator): We rename the function and
1067         change its signature to remove the return value. We now also set the italic correction when
1068         a display operator is found.
1069         (WebCore::RenderMathMLOperator::findStretchyData): We change the signature to introduce a
1070         target size and remove the return value. This also does the early return when the base glyph
1071         is large enough.
1072         (WebCore::RenderMathMLOperator::updateStyle): We use the new data members and function
1073         signatures. The check for the base glyph size is now done in findStretchyData, so we just
1074         check whether m_stretchType is Unstretched to do an early return.
1075         (WebCore::RenderMathMLOperator::firstLineBaseline): We use m_stretchType.
1076         (WebCore::RenderMathMLOperator::computeLogicalHeight): Ditto.
1077         (WebCore::RenderMathMLOperator::fillWithVerticalExtensionGlyph): Use the new class members.
1078         (WebCore::RenderMathMLOperator::fillWithHorizontalExtensionGlyph): Ditto.
1079         (WebCore::RenderMathMLOperator::paint): Ditto.
1080         (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): Ditto.
1081         (WebCore::RenderMathMLOperator::paintHorizontalGlyphAssembly): Ditto.
1082         (WebCore::RenderMathMLOperator::paintChildren): Ditto.
1083         (WebCore::RenderMathMLOperator::trailingSpaceError): Ditto.
1084         (WebCore::RenderMathMLOperator::italicCorrection): Moved to RenderMathMLOperator.h.
1085         (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): Deleted.
1086         * rendering/mathml/RenderMathMLOperator.h:
1087         (WebCore::RenderMathMLOperator::italicCorrection): We just return m_italicCorrection.
1088         (WebCore::RenderMathMLOperator::GlyphAssemblyData::GlyphAssemblyData): New class to store an
1089         assembly of GlyphData.
1090         (WebCore::RenderMathMLOperator::StretchyData::mode): Deleted.
1091         (WebCore::RenderMathMLOperator::StretchyData::variant): Deleted.
1092         (WebCore::RenderMathMLOperator::StretchyData::top): Deleted.
1093         (WebCore::RenderMathMLOperator::StretchyData::extension): Deleted.
1094         (WebCore::RenderMathMLOperator::StretchyData::bottom): Deleted.
1095         (WebCore::RenderMathMLOperator::StretchyData::middle): Deleted.
1096         (WebCore::RenderMathMLOperator::StretchyData::left): Deleted.
1097         (WebCore::RenderMathMLOperator::StretchyData::right): Deleted.
1098         (WebCore::RenderMathMLOperator::StretchyData::setNormalMode): Deleted.
1099         (WebCore::RenderMathMLOperator::StretchyData::setSizeVariantMode): Deleted.
1100         (WebCore::RenderMathMLOperator::StretchyData::setGlyphAssemblyMode): Deleted.
1101         (WebCore::RenderMathMLOperator::StretchyData::StretchyData): Deleted.
1102
1103 2016-05-08  Zalan Bujtas  <zalan@apple.com>
1104
1105         iOS selection: Use inflow containing block for positioned <br>.
1106         https://bugs.webkit.org/show_bug.cgi?id=157115
1107         <rdar://problem/25969295>
1108
1109         Reviewed by Ryosuke Niwa.
1110
1111         Similarly to RenderText, we should just use the inflow containing block for
1112         selected <br> even when it is positioned out of flow. This visually matches Mac OS X
1113         behaviour (selection painting does not get extended to the positioned <br>).
1114
1115         Test: fast/text/fixed-positioned-br-crash.html
1116
1117         * rendering/RenderLineBreak.cpp:
1118         (WebCore::RenderLineBreak::collectSelectionRects):
1119
1120 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
1121
1122         [iOS] Build fix after r200563
1123
1124         Unreviewed.
1125
1126         * editing/cocoa/HTMLConverter.mm:
1127         (_font):
1128
1129 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
1130
1131         [OS X] Migrate our Font classes entirely off of NSFont
1132         https://bugs.webkit.org/show_bug.cgi?id=157464
1133
1134         Reviewed by Darin Adler.
1135
1136         Because NSFont and CTFont are toll-free-bridged, we don't need NSFont at all anywhere.
1137
1138         No new tests because there is no behavior change.
1139
1140         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1141         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
1142         (textMarkerRangeFromRange):
1143         (visiblePositionForStartOfTextMarkerRange):
1144         (visiblePositionForEndOfTextMarkerRange):
1145         (AXAttributedStringRangeIsValid):
1146         (AXAttributeStringSetFont):
1147         (CreateCGColorIfDifferent):
1148         (AXAttributeStringSetStyle):
1149         (textMarkerRangeFromVisiblePositions):
1150         * bindings/objc/DOM.mm:
1151         (-[DOMElement _font]):
1152         * bindings/objc/DOMPrivate.h:
1153         * editing/cocoa/HTMLConverter.mm:
1154         (_font):
1155         (WebCore::editingAttributedStringFromRange):
1156         * editing/mac/EditorMac.mm:
1157         (WebCore::Editor::fontAttributesForSelectionStart):
1158         * platform/graphics/Font.h:
1159         (WebCore::Font::getCTFont):
1160         (WebCore::Font::getNSFont): Deleted.
1161         * platform/graphics/FontPlatformData.h:
1162         (WebCore::FontPlatformData::nsFont): Deleted.
1163         * platform/graphics/cocoa/FontCocoa.mm:
1164         (WebCore::Font::determinePitch):
1165         (WebCore::advanceForColorBitmapFont):
1166         (WebCore::Font::platformWidthForGlyph):
1167         (WebCore::renderingStyle): Deleted.
1168         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1169
1170 2016-05-08  Chris Dumez  <cdumez@apple.com>
1171
1172         [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
1173         https://bugs.webkit.org/show_bug.cgi?id=157465
1174
1175         Reviewed by Darin Adler.
1176
1177         Simplify [RequiresExistingAtomicString] IDL extended attribute handling
1178         in the bindings generator.
1179
1180         * bindings/scripts/CodeGeneratorJS.pm:
1181         (GenerateParametersCheck):
1182         Drop code specific to [RequiresExistingAtomicString].
1183
1184         (JSValueToNative):
1185         Deal with [RequiresExistingAtomicString] IDL extended attribute,
1186         similarly to [AtomicString] and [TreatNullAs].
1187
1188         * bindings/scripts/test/JS/JSTestObj.cpp:
1189         * bindings/scripts/test/TestObj.idl:
1190         Add bindings test coverage.
1191
1192         * dom/DocumentFragment.cpp:
1193         (WebCore::DocumentFragment::getElementById):
1194         * svg/SVGSVGElement.cpp:
1195         (WebCore::SVGSVGElement::getElementById):
1196         Add null check for the id parameter. The generated bindings used to do
1197         this null check for us but it is no longer the case (to make the bindings
1198         generator a bit simpler). This extended attribute is not commonly used
1199         and is meant as a micro-optimization for getElementById().
1200
1201 2016-05-08  David Kilzer  <ddkilzer@apple.com>
1202
1203         Roll out: ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
1204         <https://webkit.org/b/157462>
1205
1206         This reverts commit r200554.
1207
1208         This doesn't fix the data race, and the thread leak is a
1209         separate issue.
1210
1211         * page/scrolling/ScrollingThread.cpp:
1212         (WebCore::ScrollingThread::createThreadIfNeeded): Roll out the
1213         change.
1214
1215 2016-05-08  Darin Adler  <darin@apple.com>
1216
1217         Follow-up to that last patch (missed review comments).
1218
1219         * page/EventSource.cpp:
1220         (WebCore::EventSource::parseEventStream): Pre-increment, not post-increment.
1221         (WebCore::EventSource::dispatchMessageEvent): More elegant form without explicit StringView.
1222
1223 2016-05-08  Darin Adler  <darin@apple.com>
1224
1225         Change EventSource constructor to take an IDL dictionary instead of a WebCore::Dictionary
1226         https://bugs.webkit.org/show_bug.cgi?id=157459
1227
1228         Reviewed by Chris Dumez.
1229
1230         Patch also includes some updating of EventSource class to modern idioms.
1231
1232         * page/EventSource.cpp:
1233         (WebCore::EventSource::EventSource): Initialize based on Init.
1234         (WebCore::EventSource::create): Take/pass Init instead of Dictionary.
1235
1236         * bindings/js/SerializedScriptValue.cpp:
1237         (WebCore::CloneSerializer::serialize): Take a StringView instead of a string
1238         so callers don't have to allocate a String just to use this.
1239         (WebCore::SerializedScriptValue::create): Ditto.
1240         * bindings/js/SerializedScriptValue.h: Ditto.
1241
1242         * page/EventSource.cpp: Changed defaultReconnectDelay to be a uint64_t
1243         instead of an unsigned long long.
1244         (WebCore::EventSource::EventSource): Changed constructor to take a struct
1245         instead of a Dictionary for eventSourceInit. Also moved initialization of
1246         data members to the header and used ASCIILiteral.
1247         (WebCore::EventSource::create): Changed type to Init and streamlined code
1248         a little bit using auto.
1249         (WebCore::EventSource::connect): Used a reference instead of a pointer.
1250         Also added a FIXME since I noticed that m_requestInFlight is probably not
1251         needed, since it's basically the same thing as "is m_loader null".
1252         (WebCore::EventSource::url): Moved to the header and made it inline.
1253         (WebCore::EventSource::networkRequestEnded): Removed unneeded check that
1254         is already done by all callers and turned it into an assertion.
1255         (WebCore::EventSource::withCredentials): Ditto.
1256         (WebCore::EventSource::readyState): Ditto.
1257         (WebCore::EventSource::responseIsValid): Added. Helper function to make
1258         the logic in didReceiveResponse easier to read. Fixed logic to compare
1259         MIME type ignoring ASCII case, since that's how MIME types work.
1260         (WebCore::EventSource::didReceiveResponse): Use the helper above, and also
1261         move the m_eventStreamOrigin set up code into the valid response case,
1262         since there is no point doing it if the response is not valid. Also use
1263         the early return idiom.
1264         (WebCore::EventSource::didReceiveData): Removed the unneeded explicit
1265         conversion to StringView here. Also removed a FIXME that I fixed.
1266         (WebCore::EventSource::didFinishLoading): Added code to flush the decoder
1267         as mentioned in didReceiveData. Added FIXME about peculiar clearing code
1268         that exists only here. Removed check for empty receive buffer and data
1269         that is not needed since parseEventStream does sufficient checking.
1270         (WebCore::EventSource::didFail): Added FIXME because of things that
1271         didFinishLoading does that seem equally valuable here.
1272         (WebCore::EventSource::parseEventStream): Tweaked types and names of local
1273         variables, and changed to use Optional instead of magic number -1. Also
1274         added a FIXME about how the buffer type is probably not right since we
1275         keep moving the characters in the buffer as we consume the start of it.
1276         (WebCore::EventSource::parseEventStreamLine): Refactor and reorganize so
1277         this doesn't do so much string allocation and is easier to read
1278         (WebCore::EventSource::canSuspendForDocumentSuspension): Tweaked comment.
1279         (WebCore::EventSource::dispatchMessageEvent): Renamed this from
1280         createMessageEvent, and moved more code in here. We now don't have to
1281         allocate a temporary string just to pass it to SerializedScriptValue.
1282
1283         * page/EventSource.h: Updated for changes above. Use pragma once.
1284         Define and use EventSource::Init struct. Other small cleanup.
1285
1286         * page/EventSource.idl: Define EventSourceInit dictionary and use it.
1287         Other small cleanup.
1288
1289 2016-05-07  Darin Adler  <darin@apple.com>
1290
1291         Change HTMLSlotElement::assignedNodes to take a IDL dictionary instead of a WebCore::Dictionary
1292         https://bugs.webkit.org/show_bug.cgi?id=157457
1293
1294         Reviewed by Chris Dumez.
1295
1296         * html/HTMLSlotElement.cpp:
1297         (WebCore::HTMLSlotElement::removedFrom): Fixed typo in comment.
1298         (WebCore::HTMLSlotElement::assignedNodes): Renamed assignedNodesForBindings back to this
1299         and changed the argument type to Optional<AssignedNodesOptions> instead of Dictionary.
1300         Also streamlined the logic a bit.
1301         (WebCore::HTMLSlotElement::enqueueSlotChangeEvent): Changed to use a pointer to the
1302         enqueued event instead of a boolean. With only a boolean, we could end up clearing the
1303         flag in cases where we don't really want to.
1304         (WebCore::HTMLSlotElement::dispatchEvent): Ditto.
1305         (WebCore::HTMLSlotElement::assignedNodesForBindings): Deleted.
1306         * html/HTMLSlotElement.h: Use pragma once. Added AssignedNodeOptions. Changed for the
1307         above, including changing the data member.
1308         * html/HTMLSlotElement.idl: Removed use of ImplementedAs. Fixed the type of the options
1309         dictionary.
1310
1311 2016-05-08  Chris Dumez  <cdumez@apple.com>
1312
1313         [Bindings] Add convert<>() template specializations for integer types
1314         https://bugs.webkit.org/show_bug.cgi?id=157458
1315
1316         Reviewed by Darin Adler.
1317
1318         Add convert<>() template specializations for integer types and use them
1319         in the JS bindings. Also, treat non-32bit types the same way as the
1320         32bit ones, allowing the compiler to optimize out branching based on
1321         the IntegerConversionConfiguration.
1322
1323         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1324
1325         * bindings/js/JSDOMBinding.cpp:
1326         (WebCore::enforceRange):
1327         (WebCore::toSmallerInt):
1328         (WebCore::toSmallerUInt):
1329         (WebCore::toInt8EnforceRange):
1330         (WebCore::toUInt8EnforceRange):
1331         (WebCore::toInt8Clamp):
1332         (WebCore::toUInt8Clamp):
1333         (WebCore::toInt8):
1334         (WebCore::toUInt8):
1335         (WebCore::toInt16EnforceRange):
1336         (WebCore::toUInt16EnforceRange):
1337         (WebCore::toInt16Clamp):
1338         (WebCore::toUInt16Clamp):
1339         (WebCore::toInt16):
1340         (WebCore::toUInt16):
1341         (WebCore::toInt32EnforceRange):
1342         (WebCore::toInt32Clamp):
1343         (WebCore::toUInt32Clamp):
1344         (WebCore::toUInt32EnforceRange):
1345         (WebCore::toInt64EnforceRange):
1346         (WebCore::toUInt64EnforceRange):
1347         (WebCore::toInt64Clamp):
1348         (WebCore::toUInt64Clamp):
1349         (WebCore::toInt64):
1350         (WebCore::toUInt64):
1351         * bindings/js/JSDOMBinding.h:
1352         - Splt some integer conversion functions into 3 Normal / Clamp /
1353           Enforce versions, similarly to what was done for 32bit types already.
1354           This is so that these can be called from the inline functions in
1355           JSDOMConvert.h, allowing the compiler to optimize out the branches.
1356         - Get rid of some unnecessary state.hadException() checks.
1357
1358         * bindings/js/JSDOMConvert.h:
1359         Add convert<> specializations for integer types.
1360
1361         * bindings/js/JSNodeFilterCustom.cpp:
1362         (WebCore::JSNodeFilter::acceptNode):
1363
1364         * bindings/scripts/CodeGenerator.pm:
1365         - Add utility function to distinguish integer types.
1366         - Have IsNumericType() using the integerType / floatingPointType
1367           hashes to avoid duplication.
1368         - Stop int / unsigned int from integer types as those are not
1369           in Web IDL and they are not used.
1370
1371         * bindings/scripts/CodeGeneratorJS.pm:
1372         (GetIntegerConversionType):
1373         (JSValueToNative):
1374         Use convert<>() for converting JSValue to integer types.
1375
1376         * bindings/scripts/IDLParser.pm:
1377         Stop allowing int / unsigned int types as those are not in Web IDL.
1378
1379         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1380         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1381         * bindings/scripts/test/JS/JSTestObj.cpp:
1382         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1383         Rebaseline bindings tests.
1384
1385 2016-05-08  Darin Adler  <darin@apple.com>
1386
1387         Correct dictionary bindings handling of optional, null, and undefined
1388         https://bugs.webkit.org/show_bug.cgi?id=157463
1389
1390         Reviewed by Chris Dumez.
1391
1392         * bindings/js/JSDOMBinding.cpp:
1393         (WebCore::propertyValue): Deleted.
1394         * bindings/js/JSDOMBinding.h: Deleted propertyValue, not all that helpful for now.
1395
1396         * bindings/scripts/CodeGeneratorJS.pm:
1397         (GenerateDictionaryImplementationContent): Added a new early exit for convert to
1398         a dictionary type when the value is undefined or null and all members are either
1399         optional or have a default value. This returns the default values for everything
1400         without raising an exception. Added checking that requires that the dictionary
1401         argument is an object and not a regular expression, since that's also called for
1402         in the latest draft of the Web IDL specification. This ends up speeding up the
1403         code a bit since we now use JSObject::get for properties instead of JSValue::get.
1404         (GenerateParametersCheck): Renamed some local variables. Taught the code that
1405         optional dictionaries all have a default value; before it was doing that for the
1406         type "Dictionary" but not the real dictionary types (IsDictionaryType).
1407
1408         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1409
1410         * css/FontFace.cpp:
1411         (WebCore::FontFace::create): Changed argument to be Descriptors instead of
1412         Optional<Descriptors>. It would have compiled the other way, but there is now
1413         no caller that will pass a null. Because the IDL dictionary support was new,
1414         this was the only place that was doing it wrong. Good that we "nipped it in the bud"
1415         before doing this in more places.
1416         * css/FontFace.h: Ditto.
1417
1418 2016-05-08  David Kilzer  <ddkilzer@apple.com>
1419
1420         ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
1421         <https://webkit.org/b/157462>
1422
1423         Reviewed by Darin Adler.
1424
1425         Reproduced with multiple existing tests.
1426
1427         * page/scrolling/ScrollingThread.cpp:
1428         (WebCore::ScrollingThread::createThreadIfNeeded): Use a
1429         std::once_flag to initialize Scrolling Thread since this may be
1430         called from background threads.
1431
1432 2016-05-08  Darin Adler  <darin@apple.com>
1433
1434         Try to fix build without rolling out that last change.
1435
1436         * bindings/js/JSDOMConvert.h:
1437         (WebCore::convert<Vector<String>>): Make this an inline. Just call toNativeArray.
1438
1439 2016-05-07  Darin Adler  <darin@apple.com>
1440
1441         Change MutationObserver::observe to take an IDL dictionary, rather than WebCore::Dictionary
1442         https://bugs.webkit.org/show_bug.cgi?id=157456
1443
1444         Reviewed by Chris Dumez.
1445
1446         * bindings/js/JSDOMConvert.h:
1447         (WebCore::convertOptional): Use a specific Optional null rather than Nullopt so we
1448         can compile the ternary operator.
1449         (WebCore::convert<bool>): Added.
1450         (WebCore::convert<Vector<String>>): Added. Later we probably need to change convert to use
1451         a member function of a class template rather than a function template so we can make partial
1452         specialization work and do this just once for all Vector<T>.
1453
1454         * bindings/js/JSMutationObserverCustom.cpp:
1455         (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots): Streamlined code and removed
1456         some local variables. Changed to call the new observedNodes rather than getObservedNodes.
1457
1458         * bindings/scripts/CodeGeneratorJS.pm:
1459         (GenerateDictionaryImplementationContent): Fixed bug where we tried to call the version of
1460         the convert function with a default value even when there was none.
1461
1462         * bindings/scripts/test/TestObj.idl: Added a test case basically identical to what's needed
1463         in MutationObserver.idl.
1464         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1465
1466         * dom/MutationObserver.cpp:
1467         (WebCore::MutationObserver::observe): Chagned function to take a MutationObserver::Init
1468         instead of a Dictionary.
1469         (WebCore::MutationObserver::observationStarted): Changed argument type to a reference.
1470         (WebCore::MutationObserver::observationEnded): Ditto.
1471         (WebCore::MutationObserverMicrotask): Removed unneeded explicit constructor and destructor.
1472         (WebCore::queueMutationObserverCompoundMicrotask): Got rid of unnneeded local variable.
1473         (WebCore::MutationObserver::observedNodes): Renamed to remove the "get" prefix.
1474
1475         * dom/MutationObserver.h: Reduced includes. Added MutationObserver::Init struct and
1476         used it for the type of the argument to the observe function. Changed a few argument
1477         types and removed unused forward declarations.
1478
1479         * dom/MutationObserver.idl: Added MutationObserverInit and used it instead of Dictionary.
1480
1481         * dom/MutationObserverRegistration.cpp:
1482         (WebCore::MutationObserverRegistration::MutationObserverRegistration): Pass a reference.
1483         (WebCore::MutationObserverRegistration::~MutationObserverRegistration): Ditto.
1484
1485 2016-05-07  Chris Dumez  <cdumez@apple.com>
1486
1487         Reduce special handling of XPathNSResolver type in the bindings
1488         https://bugs.webkit.org/show_bug.cgi?id=157454
1489
1490         Reviewed by Darin Adler.
1491
1492         Reduce special handling of XPathNSResolver type in the bindings.
1493
1494         * CMakeLists.txt:
1495         * WebCore.xcodeproj/project.pbxproj:
1496         * bindings/js/JSBindingsAllInOne.cpp:
1497         Add new JSXPathNSResolverCustom.cpp file.
1498
1499         * bindings/js/JSDOMStringListCustom.cpp:
1500         (WebCore::JSDOMStringList::toWrapped):
1501         Take the ExecState by reference instead of pointer.
1502
1503         * bindings/js/JSDOMWindowCustom.cpp:
1504         (WebCore::JSDOMWindow::toWrapped):
1505         Update to take an ExecState& parameter. The bindings now pass
1506         an ExecState to all custom toWrapped() methods for consistency
1507         and flexibility.
1508
1509         * bindings/js/JSDictionary.cpp:
1510         (WebCore::JSDictionary::convertValue):
1511         Pass an ExecState now that those toWrapped() methods expect
1512         it.
1513
1514         * bindings/js/JSEventTargetCustom.cpp:
1515         (WebCore::JSEventTarget::toWrapped):
1516         Update to take an ExecState& parameter.
1517
1518         * bindings/js/JSIDBDatabaseCustom.cpp:
1519         (WebCore::JSIDBDatabase::transaction):
1520         Pass ExecState by reference instead of pointer.
1521
1522         * bindings/js/JSMessageEventCustom.cpp:
1523         (WebCore::handleInitMessageEvent):
1524         Pass ExecState to JSDOMWindow::toWrapped().
1525
1526         * bindings/js/JSXPathNSResolverCustom.cpp: Added.
1527         (WebCore::JSXPathNSResolver::toWrapped):
1528         Provide a custom implementation of JSXPathNSResolver::toWrapped()
1529         instead of having the custom code in the bindings generator.
1530
1531         * bindings/scripts/CodeGeneratorJS.pm:
1532         (AddIncludesForType):
1533         Drop special includes for XPathNSResolver as they are no longer needed.
1534
1535         (GenerateHeader):
1536         Drop special casing of certain types for generating the toWrapped()
1537         declaration by:
1538         1. Relying on GetNativeType() for the return value as certain types
1539            return a RefPtr instead of a raw pointer.
1540         2. Adding an extra ExecState parameter when a custom implementation of
1541            toWrapped() is provided, given that some of them need it.
1542
1543         (GenerateParametersCheck):
1544         Drop custom code for XPathNSResolver and use the normal code path for
1545         this type now. The custom code now resides in the custom implementation
1546         of JSXPathNSResolver::toWrapped(), in custom bindings.
1547
1548         (JSValueToNative):
1549         - Drop NodeFilter from the nativeType hash map as it was updated to
1550           be a callback interface a while back.
1551         - Add XPathNSResolver to nativeType hash map so that we now to use
1552           a RefPtr<> instead of a raw pointer in the bindings. We should
1553           probably add an IDL extended attribute for this at some point.
1554         - Drop special casing for DOMStringList which was outdated since there
1555           is no toDOMStringList() function. DOMStringList has a custom
1556           toWrapped() function instead nowadays so we now call this one
1557           instead. We apparently do not have any DOMStringList parameters
1558           outside our bindings tests at the moment, which is why no one
1559           noticed.
1560         - Pass an ExecState to toWrapped() if the interface has the
1561           JSCustomToNativeObject IDL extended attribute.
1562
1563         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
1564         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
1565         * bindings/scripts/test/JS/JSTestObj.cpp:
1566         * bindings/scripts/test/ObjC/DOMTestObj.h:
1567         * bindings/scripts/test/ObjC/DOMTestObj.mm:
1568         * bindings/scripts/test/TestObj.idl:
1569         Add bindings test coverage for having an operation with an
1570         XPathNSResolver parameter.
1571
1572         * dom/Document.idl:
1573         * xml/XPathEvaluator.idl:
1574         Drop some unnecessary default parameter values.
1575
1576         * xml/XPathNSResolver.idl:
1577         Add JSCustomToNativeObject IDL extended attribute so that we can
1578         provide our own custom implementation of JSXPathNSResolver::toWrapped(),
1579         instead of having the custom code in the bindings generator.
1580
1581         * dom/Document.cpp:
1582         (WebCore::Document::createExpression):
1583         (WebCore::Document::evaluate):
1584         * dom/Document.h:
1585         * inspector/InspectorNodeFinder.cpp:
1586         * xml/XPathEvaluator.cpp:
1587         (WebCore::XPathEvaluator::createExpression):
1588         (WebCore::XPathEvaluator::evaluate):
1589         * xml/XPathEvaluator.h:
1590         * xml/XPathExpression.cpp:
1591         (WebCore::XPathExpression::createExpression):
1592         * xml/XPathExpression.h:
1593         * xml/XPathParser.cpp:
1594         (WebCore::XPath::Parser::Parser):
1595         (WebCore::XPath::Parser::parseStatement):
1596         * xml/XPathParser.h:
1597         Take XPathNSResolver parameter as a Ref<XPathNSResolver>&& as this is
1598         what the generated bindings now provide us, given that this sometimes
1599         have to create a wrapper around a JSObject.
1600
1601 2016-05-07  Darin Adler  <darin@apple.com>
1602
1603         Fix crash introduced by the last patch.
1604
1605         Fix suggested by Chris Dumez.
1606
1607         * css/FontFace.cpp:
1608         (WebCore::FontFace::FontFace): Roll out incorrect change. Things were getting
1609         initialized in the wrong order in a change I had made to the FontFace constructor
1610         that takes a CSSFontSelector.
1611
1612 2016-05-07  Chris Dumez  <cdumez@apple.com>
1613
1614         Unreviewed, rebaseline bindings tests after r200547.
1615
1616         * bindings/scripts/test/JS/JSTestObj.cpp:
1617         (WebCore::convert<TestObj::FontFaceDescriptors>):
1618
1619 2016-05-07  Darin Adler  <darin@apple.com>
1620
1621         Next step on dictionary bindings, along with other bindings refinements
1622         https://bugs.webkit.org/show_bug.cgi?id=157451
1623
1624         Reviewed by Chris Dumez.
1625
1626         Converted one dictionary, the one passed to the constructor in FontFace.
1627
1628         * WebCore.xcodeproj/project.pbxproj: Updated for name change of JSDOMBuild.h to
1629         JSDOMConvert.h and also let Xcode update a file type.
1630
1631         * bindings/js/JSDOMBinding.cpp:
1632         (WebCore::propertyValue): Added.
1633         * bindings/js/JSDOMBinding.h: Use pragma once. Remove unnecessary forward declaration.
1634         Move all declarations to the top of the file, separating them from definitions. This
1635         is a small step toward better overview of what's in this file and paves the way for
1636         future simplifications and improvements we can make after we observe patterns.
1637         Also removed a couple unused functions.
1638
1639         * bindings/js/JSDOMConvert.h: Renamed from JSDOMBuild.h.
1640         Renamed function templates from build to convert. Added convertOptional.
1641
1642         * bindings/js/ReadableStreamController.cpp:
1643         (WebCore::callFunction): Use auto and remove some unneeded namespacing.
1644         (WebCore::ReadableStreamController::invoke): Ditto. Also remove use of helper function
1645         getPropertyFromObject, since this was the only call site and it was not very helpful.
1646         (WebCore::ReadableStreamController::isControlledReadableStreamLocked): Ditto.
1647         (WebCore::createReadableStream): Ditto.
1648         (WebCore::getReadableStreamReader): Ditto.
1649
1650         * bindings/scripts/CodeGeneratorJS.pm:
1651         (GenerateEnumerationImplementationContent): Updated for name change from build to
1652         convert and JSDOMBuild.h to JSDOMConvert.h.
1653         (GenerateDictionaryImplementationContent): Ditto. Also added code to handle optional
1654         and added explicit exception checking, using local variables. Not clear longer term
1655         if the local variable approach is OK since this will unnecessarily change types like
1656         const String& to String.
1657         (GenerateParametersCheck): Removed local variable $optional and use $parameter->isOptional
1658         directly consistently. This is slightly clearer because the old code used a mix of the
1659         two, and also is a better pattern for when we refactor this into smaller functions.
1660         Note that this function name is not good any more--this is a lot more then parameter checks.
1661         (GetNativeType): Return appropriate name for dictionary types.
1662         (JSValueToNative): Updated for name change from build to convert and JSDOMBuild.h to
1663         JSDOMConvert.h.
1664
1665         * bindings/scripts/test/JS/JSTestObj.cpp:
1666         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1667         Regenerated results.
1668
1669         * bindings/scripts/test/TestObj.idl: Added another dictionary test case, just a copy
1670         of the current state of the one in FontFace.idl.
1671
1672         * css/CSSFontFace.cpp:
1673         (WebCore::CSSFontFace::setUnicodeRange): Update for simplified UnicodeRange struct.
1674         (WebCore::CSSFontFace::setFeatureSettings): Fix to correctly handle being called
1675         with "normal". Also fix so it doesn't call fontPropertyChanged if nothing changed.
1676         Also got rid of return value, which had no real value: it was returning false for
1677         some bad inputs, but others would just lead to assertions, and the real reason this
1678         was OK is that this function is only passed known-valid values.
1679
1680         * css/CSSFontFace.h: Used prama once. Tweaked formatting. Removed return value from
1681         the setFeatureSettings function. Changed UnicodeRange to be struct with public data
1682         members instead a struct with a constructor and getter functions.
1683
1684         * css/CSSFontSelector.cpp:
1685         (WebCore::CSSFontSelector::addFontFaceRule): Updated since setFeatureSettings no
1686         longer has a boolean return value.
1687
1688         * css/CSSSegmentedFontFace.cpp:
1689         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Updated for simplified
1690         UnicodeRange struct.
1691
1692         * css/FontFace.cpp:
1693         (WebCore::valueFromDictionary): Deleted.
1694         (WebCore::FontFace::create): Updated to take the descriptors as a struct instead of
1695         a WebCore::Dictionary. Also made that argument optional as specified in the current
1696         specification draft.
1697         (WebCore::FontFace::setFeatureSettings): Updated since setFeatureSettings no longer
1698         has a boolean return value.
1699         (WebCore::FontFace::unicodeRange): Updated for simplified UnicodeRange struct.
1700
1701         * css/FontFace.h: Used pragma once. Removed unneeded includes and forward declarations.
1702         Derived privately from CSSFontFace::Client. Added a FontFace::Descriptors struct and
1703         used it as an argument to the create function as described above.
1704
1705         * css/FontFace.idl: Added FontFaceDescriptors and changed the argument to the
1706         constructor to be an optional FontFaceDescriptors instead of a Dictionary.
1707
1708 2016-05-07  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1709
1710         Rework FontFace promise attribute handling
1711         https://bugs.webkit.org/show_bug.cgi?id=157310
1712
1713         Reviewed by Myles C. Maxfield.
1714
1715         Making promise attributes cached attributes, so that they are created only once.
1716         They are created in the custom binding code and passed to DOM class as needed.
1717
1718         Removed usage of ExecState& from DOM iterators.
1719
1720         No change should be visible from user scripts.
1721
1722         * Modules/fetch/FetchHeaders.cpp:
1723         (WebCore::FetchHeaders::Iterator::next): Removing ExecState parameter.
1724         * Modules/fetch/FetchHeaders.h:
1725         * bindings/js/JSDOMIterator.h:
1726         (WebCore::keyValueIteratorForEach):
1727         (WebCore::JSDOMIterator<JSWrapper>::next): Ditto.
1728         * bindings/js/JSDOMPromise.cpp:
1729         (WebCore::DeferredWrapper::promise): Removed deferred() and added access to promise directly.
1730         * bindings/js/JSDOMPromise.h:
1731         * bindings/js/JSFontFaceCustom.cpp:
1732         (WebCore::JSFontFace::loaded): Using cached attribute to call FontFace::loaded only once.
1733         * bindings/js/JSFontFaceSetCustom.cpp:
1734         (WebCore::JSFontFaceSet::ready): Using cached attribute to call FontFaceSet::ready only once.
1735         * css/CSSFontFace.cpp:
1736         (WebCore::CSSFontFace::wrapper): Removing ExecState parameter.
1737         * css/CSSFontFace.h:
1738         * css/FontFace.cpp:
1739         (WebCore::FontFace::create): Ditto.
1740         (WebCore::FontFace::FontFace): Ditto.
1741         (WebCore::FontFace::fontStateChanged): Updating promise handling.
1742         (WebCore::FontFace::registerLoaded): Resolving/rejecting promise if backing CSSFontFace loading is ended.
1743         (WebCore::FontFace::load): Calling backing load.
1744         * css/FontFace.h:
1745         * css/FontFaceSet.cpp:
1746         (WebCore::FontFaceSet::Iterator::next): Removing ExecState parameter.
1747         (WebCore::FontFaceSet::load): Removing ExecState and ExceptionCode parameter.
1748         (WebCore::FontFaceSet::registerReady): Resolving promise if ready otherwise storing it for resolving it later.
1749         (WebCore::FontFaceSet::completedLoading): Resolving promise if any is stored.
1750         (WebCore::FontFaceSet::create): Deleted.
1751         * css/FontFaceSet.h:
1752         * css/FontFaceSet.idl:
1753
1754 2016-05-07  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1755
1756         Fix an incorrect usage of OS(DARWIN) with PLATFORM(COCOA)
1757         https://bugs.webkit.org/show_bug.cgi?id=157167
1758
1759         Reviewed by Myles C. Maxfield.
1760
1761         * platform/graphics/FontPlatformData.h:
1762         (WebCore::FontPlatformData::hash):
1763
1764 2016-05-07  Joanmarie Diggs  <jdiggs@igalia.com>
1765
1766         REGRESSION(r196222): [AX][GTK] accessibility/gtk/caret-offsets.html failing
1767         https://bugs.webkit.org/show_bug.cgi?id=153956
1768
1769         Reviewed by Chris Fleizach.
1770
1771         The reason the test began failing is that it was checking the new caret offset
1772         synchronously. For most of the test cases, this was not a problem. But when the
1773         caret was moved out of a focused link, the focus change (and associated repainting)
1774         delayed the caret-moved event long enough to cause the associated test case to fail.
1775         The test now uses shouldBecomeEqualToString() instead of shouldBeEqualToString().
1776
1777         The test also had a supposedly-correct expectation which was wrong: When moving the
1778         caret to a valid accessible offset, the caret-moved event should be for that offset.
1779         This was not the case for the list item test case because emitTextSelectionChange()
1780         was not adjusting the offset for the RenderListMarker, the text of which is exposed
1781         as part of the ATK_ROLE_LIST_ITEM object. This bug was also fixed and the test case
1782         updated accordingly.
1783
1784         No new tests are needed. The previously-failing test is now passing.
1785
1786         * editing/atk/FrameSelectionAtk.cpp:
1787         (WebCore::emitTextSelectionChange):
1788
1789 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1790
1791         Rename HitTestRequest DisallowShadowContent to DisallowUserAgentShadowContent
1792         https://bugs.webkit.org/show_bug.cgi?id=157447
1793
1794         Reviewed by Ryosuke Niwa.
1795
1796         HitTesting is intended to reach nodes inside shadow content. This property
1797         on the HitTestRequest is intended to avoid hit testing in UserAgent shadow
1798         content. Rename the enum value, and cascading methods for clarity.
1799
1800         * html/MediaElementSession.cpp:
1801         (WebCore::isMainContent):
1802         * page/EventHandler.cpp:
1803         (WebCore::EventHandler::eventMayStartDrag):
1804         (WebCore::EventHandler::updateSelectionForMouseDrag):
1805         (WebCore::EventHandler::hitTestResultAtPoint):
1806         (WebCore::EventHandler::handleMousePressEvent):
1807         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1808         (WebCore::EventHandler::mouseMoved):
1809         (WebCore::EventHandler::handleMouseMoveEvent):
1810         (WebCore::EventHandler::handleMouseReleaseEvent):
1811         (WebCore::EventHandler::handleMouseForceEvent):
1812         (WebCore::EventHandler::updateDragAndDrop):
1813         (WebCore::EventHandler::isInsideScrollbar):
1814         (WebCore::EventHandler::sendContextMenuEvent):
1815         (WebCore::EventHandler::sendContextMenuEventForKey):
1816         (WebCore::EventHandler::hoverTimerFired):
1817         (WebCore::EventHandler::dragSourceEndedAt):
1818         (WebCore::EventHandler::handleDrag):
1819         (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
1820         * page/EventHandler.h:
1821         * page/FocusController.cpp:
1822         (WebCore::updateFocusCandidateIfNeeded):
1823         * rendering/HitTestRequest.h:
1824         (WebCore::HitTestRequest::HitTestRequest):
1825         (WebCore::HitTestRequest::disallowsUserAgentShadowContent):
1826         (WebCore::HitTestRequest::disallowsShadowContent): Deleted.
1827         * rendering/HitTestResult.cpp:
1828         (WebCore::HitTestResult::setToNonUserAgentShadowAncestor):
1829         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
1830         (WebCore::HitTestResult::setToNonShadowAncestor): Deleted.
1831         * rendering/HitTestResult.h:
1832         * rendering/RenderEmbeddedObject.cpp:
1833         (WebCore::RenderEmbeddedObject::isReplacementObscured):
1834         * rendering/RenderLayer.cpp:
1835         (WebCore::RenderLayer::calculateClipRects):
1836         * rendering/svg/RenderSVGResourceClipper.cpp:
1837         (WebCore::RenderSVGResourceClipper::hitTestClipContent):
1838         * testing/Internals.cpp:
1839         (WebCore::Internals::nodesFromRect):
1840
1841 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1842
1843         Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
1844         https://bugs.webkit.org/show_bug.cgi?id=157446
1845         <rdar://problem/24688447>
1846
1847         Reviewed by Ryosuke Niwa.
1848
1849         * inspector/InspectorDOMAgent.cpp:
1850         (WebCore::InspectorDOMAgent::innerParentNode):
1851         The Inspector backend was informing the frontend that all ShadowRoots
1852         were floating and had no parent. Get the host element for ShadowRoots.
1853
1854         * rendering/HitTestResult.cpp:
1855         (WebCore::moveOutOfUserAgentShadowTree):
1856         (WebCore::HitTestResult::setToNonShadowAncestor):
1857         EventHandler::mouseMoved is calling setToNonShadowAncestor before
1858         notifying Page::chrome / Inspector about the moused over element.
1859         This should be the deepest non-user-agent-shadow node.
1860
1861 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1862
1863         Web Inspector: Misc CommandLineAPI cleanup
1864         https://bugs.webkit.org/show_bug.cgi?id=157450
1865
1866         Reviewed by Ryosuke Niwa.
1867
1868         * inspector/CommandLineAPIModuleSource.js:
1869         (bind):
1870
1871 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
1872
1873         Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
1874         https://bugs.webkit.org/show_bug.cgi?id=157432
1875         rdar://problem/16406720
1876
1877         Reviewed by Dean Jackson.
1878
1879         Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
1880
1881         Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
1882         preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
1883         These two settings are shared with TEXT_AUTOSIZING.
1884
1885         Add a TextAutosizing log channel, which is useful for generated -expected.html results.
1886
1887         Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
1888         without changes.
1889
1890         An implication of this set of changes is that the way clients enable text autosizing
1891         has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
1892         Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
1893         on iPhone only, not iPad.
1894
1895         Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
1896         instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
1897
1898         UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
1899         which will now always return 15, but had no other code that toggled this. So it's safe to just rely
1900         on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
1901
1902         Test: fast/text-autosizing/ios/autosize-width.html
1903
1904         * Configurations/FeatureDefines.xcconfig:
1905         * dom/Document.cpp:
1906         (WebCore::Document::addAutoSizingNode):
1907         * page/FrameView.cpp:
1908         (WebCore::FrameView::layout):
1909         * page/Settings.cpp:
1910         (WebCore::Settings::Settings): Deleted.
1911         (WebCore::Settings::setTextAutosizingEnabled): Deleted.
1912         (WebCore::Settings::setTextAutosizingWindowSizeOverride): Deleted.
1913         * page/Settings.h:
1914         (WebCore::Settings::textAutosizingEnabled): Deleted.
1915         (WebCore::Settings::textAutosizingWindowSizeOverride): Deleted.
1916         * page/Settings.in:
1917         * page/cocoa/SettingsCocoa.mm:
1918         (WebCore::Settings::defaultMinimumZoomFontSize):
1919         (WebCore::Settings::defaultTextAutosizingEnabled):
1920         * platform/Logging.h:
1921         * rendering/RenderBlockFlow.cpp:
1922         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
1923         * rendering/RenderElement.cpp:
1924         (WebCore::includeNonFixedHeight):
1925         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
1926         (WebCore::RenderElement::resetTextAutosizing):
1927         * rendering/RenderElement.h:
1928         * rendering/RenderObject.cpp:
1929         (WebCore::includeNonFixedHeight): Deleted.
1930         (WebCore::RenderObject::adjustComputedFontSizesOnBlocks): Deleted.
1931         (WebCore::RenderObject::resetTextAutosizing): Deleted.
1932         * rendering/RenderObject.h:
1933         * rendering/TextAutoSizing.cpp:
1934         (WebCore::TextAutoSizingValue::adjustNodeSizes):
1935         * testing/InternalSettings.cpp:
1936         (WebCore::InternalSettings::Backup::Backup):
1937         (WebCore::InternalSettings::Backup::restoreTo):
1938         (WebCore::InternalSettings::setTextAutosizingEnabled):
1939         (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
1940         * testing/InternalSettings.h:
1941
1942 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1943
1944         Web Inspector: Console: Variables defined with let/const aren't accessible outside of console's scope
1945         https://bugs.webkit.org/show_bug.cgi?id=150752
1946         <rdar://problem/23343385>
1947
1948         Reviewed by Mark Lam.
1949
1950         Test: inspector/runtime/evaluate-CommandLineAPI.html
1951
1952         * inspector/CommandLineAPIModuleSource.js:
1953         (bind):
1954         (this.member.toString):
1955         (CommandLineAPI):
1956         (CommandLineAPIImpl.prototype):
1957         (slice): Deleted.
1958         (bound): Deleted.
1959         (bound.toString): Deleted.
1960         (inScopeVariables): Deleted.
1961         (customToStringMethod): Deleted.
1962         Simplify now that we don't need to do our own variable shadow checking.
1963
1964 2016-05-06  Tim Horton  <timothy_horton@apple.com>
1965
1966         <attachment> element should understand UTIs
1967         https://bugs.webkit.org/show_bug.cgi?id=157425
1968         <rdar://problem/25585401>
1969
1970         Reviewed by Anders Carlsson.
1971
1972         UTIs are often much more specific than MIME types, so we should allow
1973         clients of <attachment> to use them to get more accurate icons.
1974
1975         Test: fast/attachment/attachment-uti.html
1976
1977         * platform/graphics/Icon.h:
1978         * platform/graphics/mac/IconMac.mm:
1979         (WebCore::Icon::createIconForMIMEType): Deleted.
1980         Remove the now-unused createIconForMIMEType.
1981
1982         * platform/network/mac/UTIUtilities.h:
1983         * platform/network/mac/UTIUtilities.mm:
1984         (WebCore::isDeclaredUTI):
1985         Expose UTTypeIsDeclared as isDeclaredUTI.
1986
1987         * rendering/RenderThemeIOS.mm:
1988         (WebCore::iconForAttachment):
1989         * rendering/RenderThemeMac.mm:
1990         (WebCore::iconForAttachment):
1991         If the attachment's type is a UTI, request the icon for it directly.
1992         If it's a MIME type, convert to a UTI before requesting.
1993
1994 2016-05-06  Chris Dumez  <cdumez@apple.com>
1995
1996         Clean up converting from JSValue to float / double in the bindings generator
1997         https://bugs.webkit.org/show_bug.cgi?id=157407
1998
1999         Reviewed by Darin Adler.
2000
2001         Clean up converting from JSValue to float / double in the bindings generator:
2002         - Handle all aspects of converting to float / double inside JSValueToNative()
2003           instead of relying partly on the call sites.
2004         - Add a build<>() template function to JSDOMBuild.h that is now
2005           called from the bindings to convert to float / double and deal with
2006           non-finite values.
2007         - Provide a better message with the TypeError that is thrown for non-finite
2008           values.
2009
2010         No new tests, rebaselined existing tests.
2011
2012         * bindings/js/JSDOMBinding.cpp:
2013         (WebCore::throwSequenceTypeError):
2014         (WebCore::throwNonFiniteTypeError):
2015         * bindings/js/JSDOMBinding.h:
2016         * bindings/js/JSDOMBuild.h:
2017         (WebCore::build):
2018         * bindings/scripts/CodeGenerator.pm:
2019         (IsFloatingPointType):
2020         * bindings/scripts/CodeGeneratorJS.pm:
2021         (JSValueToNative):
2022         (GenerateImplementation): Deleted.
2023         (GenerateParametersCheck): Deleted.
2024         (GenerateReturnParameters): Deleted.
2025         * bindings/scripts/test/JS/JSTestObj.cpp:
2026         (WebCore::setJSTestObjStrictFloat):
2027         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
2028         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
2029         (WebCore::jsTestObjPrototypeFunctionStrictFunction):
2030         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
2031         (WebCore::jsTestObjPrototypeFunctionAny):
2032         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
2033         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
2034         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2035         (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
2036
2037 2016-05-06  Dean Jackson  <dino@apple.com>
2038
2039         Regions, Shapes and Tracks don't need runtime features
2040         https://bugs.webkit.org/show_bug.cgi?id=157426
2041         <rdar://problem/26146262>
2042
2043         Reviewed by Simon Fraser.
2044
2045         The following RuntimeEnabledFeatures can be removed since
2046         we have no need to disable them (they are stable and have
2047         shipped for a while):
2048         - CSS Regions
2049         - CSS Shapes
2050         - Media tracks
2051
2052         * bindings/generic/RuntimeEnabledFeatures.cpp:
2053         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Deleted.
2054         * bindings/generic/RuntimeEnabledFeatures.h:
2055         (WebCore::RuntimeEnabledFeatures::setCSSShapesEnabled): Deleted.
2056         (WebCore::RuntimeEnabledFeatures::cssShapesEnabled): Deleted.
2057         (WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled): Deleted.
2058         (WebCore::RuntimeEnabledFeatures::cssRegionsEnabled): Deleted.
2059         (WebCore::RuntimeEnabledFeatures::setCSSCompositingEnabled): Deleted.
2060         (WebCore::RuntimeEnabledFeatures::cssCompositingEnabled): Deleted.
2061         (WebCore::RuntimeEnabledFeatures::webkitVideoTrackEnabled): Deleted.
2062         (WebCore::RuntimeEnabledFeatures::setWebkitVideoTrackEnabled): Deleted.
2063         * css/CSSParser.cpp:
2064         (WebCore::isSimpleLengthPropertyID):
2065         (WebCore::isValidKeywordPropertyAndValue):
2066         (WebCore::CSSParser::parseValue):
2067         (WebCore::CSSParser::parseFillProperty):
2068         (WebCore::CSSParser::createRegionRule):
2069         (WebCore::CSSParserContext::CSSParserContext): Deleted.
2070         (WebCore::operator==): Deleted.
2071         (WebCore::CSSParser::parseShapeProperty): Deleted.
2072         (WebCore::CSSParser::cssRegionsEnabled): Deleted.
2073         (WebCore::CSSParser::cssCompositingEnabled): Deleted.
2074         (WebCore::CSSParser::parseFlowThread): Deleted.
2075         (WebCore::CSSParser::parseRegionThread): Deleted.
2076         * css/CSSParser.h:
2077         * css/CSSParserMode.h:
2078         * dom/Document.cpp:
2079         (WebCore::Document::webkitGetNamedFlows):
2080         (WebCore::Document::cssRegionsEnabled): Deleted.
2081         (WebCore::Document::cssCompositingEnabled): Deleted.
2082         * dom/Document.h:
2083         * dom/Element.cpp:
2084         (WebCore::Element::unregisterNamedFlowContentElement):
2085         (WebCore::Element::webkitRegionOverset):
2086         (WebCore::Element::webkitGetRegionFlowRanges): Deleted.
2087         * html/HTMLMediaElement.cpp:
2088         (WebCore::HTMLMediaElement::scheduleDelayedAction):
2089         (WebCore::HTMLMediaElement::pendingActionTimerFired):
2090         (WebCore::HTMLMediaElement::prepareForLoad):
2091         (WebCore::HTMLMediaElement::loadInternal):
2092         (WebCore::HTMLMediaElement::setReadyState):
2093         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
2094         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2095         (WebCore::HTMLMediaElement::userCancelledLoad):
2096         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2097         (WebCore::HTMLMediaElement::hasClosedCaptions):
2098         (WebCore::HTMLMediaElement::setClosedCaptionsVisible):
2099         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
2100         (WebCore::HTMLMediaElement::finishParsingChildren): Deleted.
2101         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Deleted.
2102         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Deleted.
2103         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Deleted.
2104         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Deleted.
2105         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Deleted.
2106         (WebCore::HTMLMediaElement::addAudioTrack): Deleted.
2107         (WebCore::HTMLMediaElement::addTextTrack): Deleted.
2108         (WebCore::HTMLMediaElement::addVideoTrack): Deleted.
2109         (WebCore::HTMLMediaElement::removeAudioTrack): Deleted.
2110         (WebCore::HTMLMediaElement::removeTextTrack): Deleted.
2111         (WebCore::HTMLMediaElement::removeVideoTrack): Deleted.
2112         (WebCore::HTMLMediaElement::audioTracks): Deleted.
2113         (WebCore::HTMLMediaElement::textTracks): Deleted.
2114         (WebCore::HTMLMediaElement::videoTracks): Deleted.
2115         (WebCore::HTMLMediaElement::didAddTextTrack): Deleted.
2116         (WebCore::HTMLMediaElement::didRemoveTextTrack): Deleted.
2117         * html/HTMLTrackElement.cpp:
2118         (WebCore::HTMLTrackElement::parseAttribute):
2119         (WebCore::HTMLTrackElement::scheduleLoad): Deleted.
2120         (WebCore::HTMLTrackElement::canLoadURL): Deleted.
2121         * rendering/RenderBlockFlow.cpp:
2122         (WebCore::RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded):
2123         * testing/InternalSettings.cpp:
2124         (WebCore::InternalSettings::Backup::Backup):
2125         (WebCore::InternalSettings::Backup::restoreTo): Deleted.
2126         (WebCore::InternalSettings::setCSSShapesEnabled): Deleted.
2127         * testing/InternalSettings.h:
2128         * testing/InternalSettings.idl:
2129
2130 2016-05-06  Brady Eidson  <beidson@apple.com>
2131
2132         Modern IDB (Workers): Start running a lot of the workers tests.
2133         https://bugs.webkit.org/show_bug.cgi?id=157424
2134
2135         Reviewed by Sam Weinig.
2136
2137         No new tests (Covered by enabling a whole bunch of existing tests).
2138
2139         * Modules/indexeddb/IDBDatabase.cpp:
2140         (WebCore::IDBDatabase::stop): Call removeAllEventListeners() to clean up the Worker VM
2141           before it shuts down.
2142
2143         * Modules/indexeddb/IDBRequest.cpp:
2144         (WebCore::IDBRequest::stop): Call removeAllEventListeners()
2145
2146         * Modules/indexeddb/IDBTransaction.cpp:
2147         (WebCore::IDBTransaction::IDBTransaction): Initialize with the correct VM.
2148         (WebCore::IDBTransaction::stop): Call removeAllEventListeners()
2149         (WebCore::IDBTransaction::operationDidComplete):
2150
2151         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2152         (WebCore::IDBClient::IDBConnectionProxy::takeIDBOpenDBRequest):
2153         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): Don't take the request from
2154           the map, but rather let the request take itself from its appropriate thread.
2155         * Modules/indexeddb/client/IDBConnectionProxy.h:
2156
2157         * Modules/indexeddb/client/TransactionOperation.h:
2158         (WebCore::IDBClient::TransactionOperation::completed): Rework clearing out the completion 
2159           handler, as the handler itself might hold the last reference to `this`.
2160
2161         * page/SecurityOrigin.h:
2162         (WebCore::SecurityOrigin::hasUniversalAccess):
2163
2164         * workers/WorkerGlobalScope.cpp:
2165         (WebCore::WorkerGlobalScope::WorkerGlobalScope): If the parent context's SecurityOrigin had
2166           universal access, grant it to this one.
2167
2168 2016-05-06  Ryosuke Niwa  <rniwa@webkit.org>
2169
2170         FKA: No way to get focus from DOM to shadow DOM components (Was: HTML5 media controls not keyboard accessible)
2171         https://bugs.webkit.org/show_bug.cgi?id=117857
2172
2173         Reviewed by Jer Noble.
2174
2175         The bug was caused by hasCustomFocusLogic returning true on media elements.
2176
2177         Fix the bug by removing this function so that FocusController will walk into the shadow tree of media elements
2178         to look for focusable elements. This will allow AT such as Voice Over to iterate through controls.
2179
2180         We don't seem to draw focus rings inside the media elements but that could be tweaked in a separate patch.
2181
2182         Test: media/tab-focus-inside-media-elements.html
2183
2184         * html/HTMLMediaElement.cpp:
2185         (WebCore::HTMLMediaElement::hasCustomFocusLogic): Deleted.
2186         * html/HTMLMediaElement.h:
2187
2188 2016-05-06  Anders Carlsson  <andersca@apple.com>
2189
2190         Tidy up the LinkRelAttribute code
2191         https://bugs.webkit.org/show_bug.cgi?id=157429
2192
2193         Reviewed by Sam Weinig.
2194
2195         Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
2196         Remove the InvalidIcon enum declaration and use WTF::Optional instead.
2197
2198         * WebCore.xcodeproj/project.pbxproj:
2199         * dom/IconURL.h: Removed.
2200         * html/HTMLLinkElement.cpp:
2201         (WebCore::HTMLLinkElement::iconType):
2202         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
2203         * html/HTMLLinkElement.h:
2204         * html/LinkRelAttribute.cpp:
2205         (WebCore::LinkRelAttribute::LinkRelAttribute):
2206         * html/LinkRelAttribute.h:
2207         * html/parser/HTMLPreloadScanner.cpp:
2208         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
2209         * loader/FrameLoader.h:
2210         * loader/FrameLoaderClient.h:
2211         * loader/icon/IconController.cpp:
2212         (WebCore::iconFromLinkElements):
2213
2214 2016-05-06  Jer Noble  <jer.noble@apple.com>
2215
2216         Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
2217         https://bugs.webkit.org/show_bug.cgi?id=157404
2218         <rdar://problem/26016802>
2219
2220         Reviewed by Eric Carlson.
2221
2222         Test: media/audio-playback-restriction-play-muted.html
2223
2224         Add element.muted() as a critera of whether playback is permitted when
2225         RequireUserGestureForAudioRateChange is set. Also, make sure to re-evaluate whether the
2226         element should be playing when muted is changed without a user gesture.
2227
2228         * html/HTMLMediaElement.cpp:
2229         (WebCore::HTMLMediaElement::setMuted):
2230         * html/MediaElementSession.cpp:
2231         (WebCore::MediaElementSession::playbackPermitted):
2232
2233 2016-05-06  Brent Fulgham  <bfulgham@apple.com>
2234
2235         Don't use invalidated ResourceLoadStatistics iterators
2236         https://bugs.webkit.org/show_bug.cgi?id=157412
2237         <rdar://problem/26133153>
2238
2239         Reviewed by Chris Dumez.
2240
2241         ResourceLoadObserver::logFrameNavigation was using references bound to the 'value'
2242         member of iterators from the ResourceLoadStatistics HashMap. When new entries were
2243         added, these iterators were invalidated causing the references to refer to invalid
2244         memory.
2245
2246         Renamed 'resourceStatisticsForPrimaryDomain' to 'ensureResourceStatisticsForPrimaryDomain'
2247         to clarify that it may mutate the underlying HashMap, thereby invalidating any
2248         existing iterators.
2249
2250         * loader/ResourceLoadObserver.cpp:
2251         (WebCore::ResourceLoadObserver::logFrameNavigation): Protect against HashMap
2252         elements being copied/moved when new intries are added.
2253         * loader/ResourceLoadStatisticsStore.cpp:
2254         (WebCore::ResourceLoadStatisticsStore::setResourceStatisticsForPrimaryDomain): Added.
2255         * loader/ResourceLoadStatisticsStore.h:
2256
2257 2016-05-06  Manuel Rego Casasnovas  <rego@igalia.com>
2258
2259         [css-grid] Unprefix CSS Grid Layout properties
2260         https://bugs.webkit.org/show_bug.cgi?id=157137
2261
2262         Reviewed by Simon Fraser.
2263
2264         Remove "-webkit" prefix from all the grid layout properties,
2265         including the display value.
2266         Update the source code to remove the prefix where it was used too.
2267
2268         * css/CSSComputedStyleDeclaration.cpp:
2269         (WebCore::isLayoutDependent):
2270         (WebCore::ComputedStyleExtractor::propertyValue):
2271         * css/CSSParser.cpp:
2272         (WebCore::isSimpleLengthPropertyID):
2273         (WebCore::isValidKeywordPropertyAndValue):
2274         (WebCore::CSSParser::parseValue):
2275         (WebCore::CSSParser::parseGridGapShorthand):
2276         (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
2277         (WebCore::CSSParser::parseGridTemplateShorthand):
2278         (WebCore::CSSParser::parseGridShorthand):
2279         (WebCore::CSSParser::parseGridAreaShorthand):
2280         * css/CSSPrimitiveValueMappings.h:
2281         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2282         * css/CSSPropertyNames.in:
2283         * css/CSSValueKeywords.in:
2284         * css/StyleBuilderCustom.h:
2285         (WebCore::StyleBuilderCustom::applyInitialGridTemplateAreas):
2286         (WebCore::StyleBuilderCustom::applyInheritGridTemplateAreas):
2287         (WebCore::StyleBuilderCustom::applyValueGridTemplateAreas):
2288         (WebCore::StyleBuilderCustom::applyInitialGridTemplateColumns):
2289         (WebCore::StyleBuilderCustom::applyInheritGridTemplateColumns):
2290         (WebCore::StyleBuilderCustom::applyValueGridTemplateColumns):
2291         (WebCore::StyleBuilderCustom::applyInitialGridTemplateRows):
2292         (WebCore::StyleBuilderCustom::applyInheritGridTemplateRows):
2293         (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
2294         * css/StyleProperties.cpp:
2295         (WebCore::StyleProperties::getPropertyValue):
2296
2297 2016-05-06  Nan Wang  <n_wang@apple.com>
2298
2299         AX: <attachment> element should have a replacement character
2300         https://bugs.webkit.org/show_bug.cgi?id=157406
2301
2302         Reviewed by Chris Fleizach.
2303
2304         Make sure attachment element is considered as a replaced node.
2305
2306         Test: accessibility/mac/attachment-element-replacement-character.html
2307
2308         * editing/TextIterator.cpp:
2309         (WebCore::isRendererReplacedElement):
2310
2311 2016-05-06  Nan Wang  <n_wang@apple.com>
2312
2313         AX: String for document range is empty if end visible position anchors to a ignored replaced node
2314         https://bugs.webkit.org/show_bug.cgi?id=157403
2315
2316         Reviewed by Chris Fleizach.
2317
2318         The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
2319         to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in 
2320         such case.
2321
2322         Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
2323
2324         * accessibility/AXObjectCache.cpp:
2325         (WebCore::characterOffsetsInOrder):
2326         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
2327         (WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
2328
2329 2016-05-05  David Kilzer  <ddkilzer@apple.com>
2330
2331         [iOS] WebCore does not need to link to CoreAudio, GraphicsServices, SystemConfiguration frameworks
2332         <https://webkit.org/b/157413>
2333         <rdar://problem/26104189>
2334
2335         Reviewed by Gavin Barraclough.
2336
2337         * Configurations/WebCore.xcconfig:
2338         (OTHER_LDFLAGS_BASE_ios): Remove "-framework GraphicsServices".
2339         (OTHER_LDFLAGS_PLATFORM[sdk=macosx*]): Add "-framework CoreAudio"
2340         and "-framework SystemConfiguration".
2341         * WebCore.xcodeproj/project.pbxproj: Remove CoreAudio.framework
2342         and SystemConfiguration.framework from the project file.
2343
2344 2016-05-05  Brady Eidson  <beidson@apple.com>
2345
2346         Modern IDB (Workers): Get everything to the right threads.
2347         https://bugs.webkit.org/show_bug.cgi?id=157398
2348
2349         Reviewed by Alex Christensen.
2350
2351         No new tests (No current change in behavior, will be tested as bug 149953 is resolved, enabling IDB in workers).
2352
2353         * dom/ScriptExecutionContext.h:
2354         (WebCore::ScriptExecutionContext::postCrossThreadTask): Add a helper to post a CrossThreadTask to a context.
2355                 
2356         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2357         (WebCore::IDBClient::performCallbackOnCorrectThread): Helper to perform an IDB callback on either the main thread
2358           or Worker thread as necessary.
2359         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2360         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2361         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2362         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2363         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2364         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2365         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2366         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2367         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2368         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2369         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2370         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2371         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2372         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2373         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2374         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2375         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2376         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2377         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2378         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2379         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2380         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2381         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2382         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2383         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2384         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2385         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2386         (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks):
2387         (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks):
2388         * Modules/indexeddb/client/IDBConnectionProxy.h:
2389         (WebCore::IDBClient::IDBConnectionProxy::callConnectionOnMainThread): Helper to marshall IDB operations from the
2390           Worker thread to the main thread.
2391         (WebCore::IDBClient::IDBConnectionProxy::postMainThreadTask):
2392
2393         * Modules/indexeddb/IDBTransaction.cpp:
2394         (WebCore::IDBTransaction::originThreadID):
2395         * Modules/indexeddb/IDBTransaction.h:
2396         
2397         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2398         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2399         * Modules/indexeddb/client/IDBConnectionToServer.h:
2400
2401         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2402
2403         * Modules/indexeddb/client/TransactionOperation.cpp:
2404         (WebCore::IDBClient::TransactionOperation::scriptExecutionContext):
2405         * Modules/indexeddb/client/TransactionOperation.h:
2406
2407         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2408         (WebCore::nextClientResourceNumber):
2409
2410         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2411         (WebCore::InProcessIDBServer::putOrAdd):
2412         * Modules/indexeddb/shared/InProcessIDBServer.h:
2413
2414 2016-05-05  Dean Jackson  <dino@apple.com>
2415
2416         4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
2417         https://bugs.webkit.org/show_bug.cgi?id=157402
2418         <rdar://problem/26131142>
2419
2420         Reviewed by Simon Fraser.
2421
2422         Noel and Tab from Google alerted me to the fact I broke some legacy
2423         HTML color attributes when I added support for 4 and 8 digit hex colors
2424         in CSS. The fix is to favor the "crazy" parsing unless we know it is a 3 or 6
2425         digit hex value (in which case we try the CSS algorithm first).
2426
2427         Covered by reverting an existing test.
2428
2429         * html/HTMLElement.cpp:
2430         (WebCore::HTMLElement::addHTMLColorToStyle):
2431
2432 2016-05-05  Brady Eidson  <beidson@apple.com>
2433
2434         Modern IDB (Workers): Remove the need for IDBConnectionProxy to expose its IDBConnectionToServer.
2435         https://bugs.webkit.org/show_bug.cgi?id=157394
2436
2437         Reviewed by Alex Christensen.
2438
2439         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2440
2441         * Modules/indexeddb/IDBDatabase.cpp:
2442         (WebCore::IDBDatabase::transaction):
2443         (WebCore::IDBDatabase::fireVersionChangeEvent):
2444         (WebCore::IDBDatabase::dispatchEvent):
2445         * Modules/indexeddb/IDBDatabase.h:
2446         (WebCore::IDBDatabase::serverConnection): Deleted.
2447
2448         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2449         (WebCore::IDBOpenDBRequest::requestCompleted):
2450
2451         * Modules/indexeddb/IDBRequest.cpp:
2452         (WebCore::IDBRequest::IDBRequest):
2453
2454         * Modules/indexeddb/IDBTransaction.cpp:
2455         (WebCore::IDBTransaction::connectionProxy):
2456         (WebCore::IDBTransaction::serverConnection): Deleted.
2457         * Modules/indexeddb/IDBTransaction.h:
2458
2459         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2460         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2461         (WebCore::IDBClient::IDBConnectionProxy::connectionToServer): Deleted.
2462         * Modules/indexeddb/client/IDBConnectionProxy.h:
2463
2464         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2465         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
2466
2467         * Modules/indexeddb/client/TransactionOperation.h:
2468         (WebCore::IDBClient::TransactionOperation::TransactionOperation):
2469
2470         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2471         (WebCore::IDBCursorInfo::IDBCursorInfo):
2472
2473         * Modules/indexeddb/shared/IDBRequestData.cpp:
2474         (WebCore::IDBRequestData::IDBRequestData):
2475
2476         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2477         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2478         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2479
2480         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
2481         (WebCore::IDBTransactionInfo::clientTransaction):
2482         * Modules/indexeddb/shared/IDBTransactionInfo.h:
2483
2484 2016-05-05  Commit Queue  <commit-queue@webkit.org>
2485
2486         Unreviewed, rolling out r200479.
2487         https://bugs.webkit.org/show_bug.cgi?id=157397
2488
2489         A LayoutTest added with this change is crashing on Mac WK1
2490         test runs. (Requested by ryanhaddad on #webkit).
2491
2492         Reverted changeset:
2493
2494         "For keyboard users, activating a fragment URL should transfer
2495         focus and caret to the destination"
2496         https://bugs.webkit.org/show_bug.cgi?id=116046
2497         http://trac.webkit.org/changeset/200479
2498
2499 2016-05-05  Chris Dumez  <cdumez@apple.com>
2500
2501         CORS check is sometimes incorrectly failing for media loads
2502         https://bugs.webkit.org/show_bug.cgi?id=157370
2503         <rdar://problem/26071607>
2504
2505         Reviewed by Alex Christensen.
2506
2507         When the media library is issuing a conditional request for a media
2508         element that had the 'crossorigin' attribute, we would fail the CORS
2509         check and log an error if the server were to respond with a "304 Not
2510         Modified" response because the 304 response usually does not have
2511         the necessary "Access-Control-Allow-Origin: *" header (At least for
2512         Apache) and we cannot use the cached headers either since WebKit
2513         does not have them.
2514
2515         To work around the problem in the short term, we now drop the
2516         conditional headers from the request that the media library is
2517         giving us when the media element has the 'crossorigin' attribute
2518         set. As a result, the server will never respond with a 304 and we
2519         will be able to do a CORS check on the full (e.g. 206) response.
2520
2521         In the long term, we need to deal with this better as this means
2522         we may sometimes fail to reuse cached data. For now, this is only
2523         potentially inefficient in the cases that were broken (i.e. no
2524         video would play and we would log an error in the console).
2525
2526         Test: http/tests/security/video-cross-origin-caching.html
2527
2528         * loader/MediaResourceLoader.cpp:
2529         (WebCore::MediaResourceLoader::requestResource):
2530         Make the request unconditional if the media element has the
2531         'crossorigin' attribute set.
2532
2533         * platform/network/ResourceRequestBase.cpp:
2534         (WebCore::ResourceRequestBase::isConditional):
2535         (WebCore::ResourceRequestBase::makeUnconditional):
2536         When fixing the bug above, I noticed that those method do not do
2537         the right thing if the m_httpHeaderFields data member has not
2538         been populated yet. m_httpHeaderFields is lazily initialized so
2539         we need to call updateResourceRequest() before using it.
2540
2541 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2542
2543         Stop traversing at the container block when computing RTL inline static distance.
2544         https://bugs.webkit.org/show_bug.cgi?id=157349
2545         <rdar://problem/25994087>
2546
2547         Reviewed by David Hyatt.
2548
2549         When computing the inline static distance for a child renderer, we start at its enclosing box
2550         and traverse up all the way to the container block.
2551         However when the enclosing box is the ancestor of the container block, we
2552         should just bail out right away since there's no container to use to adjust the position.
2553
2554         Test: fast/multicol/positioned-rtl-column-crash.html
2555
2556         * rendering/RenderBox.cpp:
2557         (WebCore::computeInlineStaticDistance):
2558
2559 2016-05-05  Ada Chan  <adachan@apple.com>
2560
2561         Add WebKitAdditions extension points in media controls related code in RenderThemeMac
2562         https://bugs.webkit.org/show_bug.cgi?id=157390
2563
2564         Reviewed by Anders Carlsson.
2565
2566         * rendering/RenderThemeMac.mm:
2567         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2568         (WebCore::RenderThemeMac::mediaControlsScript):
2569
2570 2016-05-05  Jer Noble  <jer.noble@apple.com>
2571
2572         [WK2] Media controls don't update if controller is created after the interface is created
2573         https://bugs.webkit.org/show_bug.cgi?id=157376
2574
2575         Reviewed by Beth Dakin.
2576
2577         Add getter methods to WebPlaybackSessionModel so that the model's values can be retrieved
2578         if those values were missed before the equivalent WebPlaybackSessionInterface methods were
2579         called. This necessatates a bunch of changes in HTMLMediaElement and related classes to
2580         change PassRefPtr<TimeRanges> types to Ref<TimeRanges> (and one change in TimeRanges itself).
2581         WebPlaybackSessionModelMediaElement can implement these new getter methods by querying the
2582         values from the HTMLMediaElement, something it was doing already, so most of those changes
2583         are simple refactoring.
2584
2585         There's no reason any longer for WebVideoFullscreenModel to inherit from WebPlaybackSessionModel,
2586         so remove that superclass.
2587
2588         In WebPlaybackSessionInterfaceMac, when a new WebPlaybackControlsManager is set, use the new
2589         getter methods on WebPlaybackSessionModel to update the values in the manager.
2590
2591         * html/HTMLMediaElement.cpp:
2592         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2593         (WebCore::HTMLMediaElement::maxBufferedTime):
2594         (WebCore::HTMLMediaElement::played):
2595         (WebCore::HTMLMediaElement::buffered): Deleted.
2596         (WebCore::HTMLMediaElement::seekable): Deleted.
2597         * html/HTMLMediaElement.h:
2598         * html/MediaController.cpp:
2599         (MediaController::buffered):
2600         (MediaController::seekable):
2601         (MediaController::played):
2602         * html/MediaController.h:
2603         * html/MediaControllerInterface.h:
2604         * html/TimeRanges.cpp:
2605         (WebCore::TimeRanges::copy):
2606         * html/TimeRanges.h:
2607         * platform/cocoa/WebPlaybackSessionModel.h:
2608         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2609         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2610         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface):
2611         (WebPlaybackSessionModelMediaElement::updateForEventName):
2612         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
2613         (WebPlaybackSessionModelMediaElement::observedEventNames):
2614         (WebPlaybackSessionModelMediaElement::eventNameAll):
2615         (WebPlaybackSessionModelMediaElement::duration):
2616         (WebPlaybackSessionModelMediaElement::currentTime):
2617         (WebPlaybackSessionModelMediaElement::bufferedTime):
2618         (WebPlaybackSessionModelMediaElement::isPlaying):
2619         (WebPlaybackSessionModelMediaElement::playbackRate):
2620         (WebPlaybackSessionModelMediaElement::seekableRanges):
2621         (WebPlaybackSessionModelMediaElement::canPlayFastReverse):
2622         (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
2623         (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
2624         (WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions):
2625         (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
2626         (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
2627         (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
2628         * platform/cocoa/WebVideoFullscreenModel.h:
2629         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2630         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2631         (WebVideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
2632         (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
2633         (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
2634         (WebVideoFullscreenModelVideoElement::observedEventNames): Deleted.
2635         (WebVideoFullscreenModelVideoElement::eventNameAll): Deleted.
2636         (WebVideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
2637         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
2638         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2639         (WebVideoFullscreenControllerContext::play): Deleted.
2640         (WebVideoFullscreenControllerContext::pause): Deleted.
2641         (WebVideoFullscreenControllerContext::togglePlayState): Deleted.
2642         (WebVideoFullscreenControllerContext::beginScrubbing): Deleted.
2643         (WebVideoFullscreenControllerContext::endScrubbing): Deleted.
2644         (WebVideoFullscreenControllerContext::seekToTime): Deleted.
2645         (WebVideoFullscreenControllerContext::fastSeek): Deleted.
2646         (WebVideoFullscreenControllerContext::beginScanningForward): Deleted.
2647         (WebVideoFullscreenControllerContext::beginScanningBackward): Deleted.
2648         (WebVideoFullscreenControllerContext::endScanning): Deleted.
2649         (WebVideoFullscreenControllerContext::selectAudioMediaOption): Deleted.
2650         (WebVideoFullscreenControllerContext::selectLegibleMediaOption): Deleted.
2651         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2652         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2653         (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2654         (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2655         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2656         (WebCore::timeRangesToArray):
2657         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
2658         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2659         * platform/mac/WebVideoFullscreenInterfaceMac.h:
2660
2661 2016-05-05  Brady Eidson  <beidson@apple.com>
2662
2663         Modern IDB (Workers): Move TransactionOperation management from IDBConnectionToServer to IDBConnectionProxy.
2664         https://bugs.webkit.org/show_bug.cgi?id=157392
2665
2666         Reviewed by Alex Christensen.
2667
2668         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2669
2670         Set up TransactionOperations on the IDBConnectionProxy instead of the IDBConnectionToServer:
2671         * Modules/indexeddb/IDBTransaction.cpp:
2672         (WebCore::IDBTransaction::createObjectStoreOnServer):
2673         (WebCore::IDBTransaction::createIndexOnServer):
2674         (WebCore::IDBTransaction::openCursorOnServer):
2675         (WebCore::IDBTransaction::iterateCursorOnServer):
2676         (WebCore::IDBTransaction::getRecordOnServer):
2677         (WebCore::IDBTransaction::getCountOnServer):
2678         (WebCore::IDBTransaction::deleteRecordOnServer):
2679         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2680         (WebCore::IDBTransaction::putOrAddOnServer):
2681         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2682         (WebCore::IDBTransaction::deleteIndexOnServer):
2683         
2684         IDBConnectionProxy is now the owner of dispatched TransactionOperations:
2685         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2686         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2687         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2688         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2689         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2690         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2691         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2692         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2693         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2694         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2695         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2696         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2697         (WebCore::IDBClient::IDBConnectionProxy::saveOperation):
2698         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2699         * Modules/indexeddb/client/IDBConnectionProxy.h:
2700         
2701         Proxy this in-and-out calls to the ConnectionProxy:
2702         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2703         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
2704         (WebCore::IDBClient::IDBConnectionToServer::didCreateObjectStore):
2705         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
2706         (WebCore::IDBClient::IDBConnectionToServer::didDeleteObjectStore):
2707         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
2708         (WebCore::IDBClient::IDBConnectionToServer::didClearObjectStore):
2709         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
2710         (WebCore::IDBClient::IDBConnectionToServer::didCreateIndex):
2711         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
2712         (WebCore::IDBClient::IDBConnectionToServer::didDeleteIndex):
2713         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2714         (WebCore::IDBClient::IDBConnectionToServer::didPutOrAdd):
2715         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
2716         (WebCore::IDBClient::IDBConnectionToServer::didGetRecord):
2717         (WebCore::IDBClient::IDBConnectionToServer::getCount):
2718         (WebCore::IDBClient::IDBConnectionToServer::didGetCount):
2719         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
2720         (WebCore::IDBClient::IDBConnectionToServer::didDeleteRecord):
2721         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
2722         (WebCore::IDBClient::IDBConnectionToServer::didOpenCursor):
2723         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
2724         (WebCore::IDBClient::IDBConnectionToServer::didIterateCursor):
2725         (WebCore::IDBClient::IDBConnectionToServer::saveOperation): Deleted.
2726         (WebCore::IDBClient::IDBConnectionToServer::completeOperation): Deleted.
2727         * Modules/indexeddb/client/IDBConnectionToServer.h:
2728
2729         - Give TransactionOperation a ThreadIdentifier member
2730         - Privatize most public methods from TransactionOperation
2731         - Make IDBRequestData a friend so it can get at the private methods
2732         * Modules/indexeddb/client/TransactionOperation.h:
2733         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
2734         (WebCore::IDBClient::TransactionOperation::perform):
2735         (WebCore::IDBClient::TransactionOperation::completed):
2736         (WebCore::IDBClient::TransactionOperation::originThreadID):
2737         (WebCore::IDBClient::TransactionOperation::transactionIdentifier):
2738         (WebCore::IDBClient::TransactionOperation::objectStoreIdentifier):
2739         (WebCore::IDBClient::TransactionOperation::indexIdentifier):
2740         (WebCore::IDBClient::TransactionOperation::cursorIdentifier):
2741         (WebCore::IDBClient::TransactionOperation::transaction):
2742         (WebCore::IDBClient::TransactionOperation::indexRecordType):
2743
2744 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2745
2746         Do not attempt to compute min/max width.
2747         https://bugs.webkit.org/show_bug.cgi?id=157320
2748
2749         Reviewed by David Hyatt.
2750
2751         Replaced elements with no intrinsic size (only with ratio) should not call the containing
2752         block to compute the min/max width when the containing block's min/max width
2753         depends on the children's intrinsic size. It could lead to infinite recursion.
2754
2755         Test: fast/replaced/before-content-intrinsic-crash.html
2756
2757         * rendering/RenderBox.cpp:
2758         (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): Unrelated code change.
2759         * rendering/RenderImage.cpp: Unrelated code change.
2760         (WebCore::RenderImage::RenderImage): Deleted.
2761         * rendering/RenderImage.h:
2762         * rendering/RenderReplaced.cpp:
2763         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
2764
2765 2016-05-04  Brady Eidson  <beidson@apple.com>
2766
2767         Modern IDB: Move all IDB DOM object management from IDBConnectionToServer to IDBConnectionProxy.
2768         https://bugs.webkit.org/show_bug.cgi?id=157348
2769
2770         Reviewed by Alex Christensen.
2771
2772         No new tests (Refactor, no change in behavior yet).
2773
2774         This is in-progress IDB-in-Workers code that is isolated enough to land right now.
2775         
2776         The goal is to have IDBConnectionToServer be a main-thread-only object, leaving IDBConnectionProxy
2777         as the threading bridge between the worker thread and the main thread.
2778         
2779         As such, IDBConnectionToServer no longer maintains maps of IDB DOM objects, but instead the proxy
2780         does and guards that access with locks.
2781         
2782         No threading changes takes place in this patch but it does scatter some isMainThread() checks and FIXMEs 
2783         accurately representing where threading changes will take place once I can return to this.
2784         
2785         * Modules/indexeddb/IDBDatabase.cpp:
2786         (WebCore::IDBDatabase::IDBDatabase):
2787         (WebCore::IDBDatabase::~IDBDatabase):
2788         (WebCore::IDBDatabase::maybeCloseInServer):
2789
2790         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2791         (WebCore::IDBOpenDBRequest::dispatchEvent):
2792
2793         * Modules/indexeddb/IDBTransaction.cpp:
2794         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2795         (WebCore::IDBTransaction::commitOnServer):
2796         (WebCore::IDBTransaction::establishOnServer):
2797
2798         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2799         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2800         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2801         (WebCore::IDBClient::IDBConnectionProxy::didOpenDatabase):
2802         (WebCore::IDBClient::IDBConnectionProxy::didDeleteDatabase):
2803         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2804         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2805         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2806         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2807         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2808         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2809         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2810         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2811         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2812         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2813         (WebCore::IDBClient::IDBConnectionProxy::hasRecordOfTransaction):
2814         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2815         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2816         (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection):
2817         (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection):
2818         * Modules/indexeddb/client/IDBConnectionProxy.h:
2819         
2820         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2821         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
2822         (WebCore::IDBClient::IDBConnectionToServer::didDeleteDatabase):
2823         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
2824         (WebCore::IDBClient::IDBConnectionToServer::didOpenDatabase):
2825         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
2826         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
2827         (WebCore::IDBClient::IDBConnectionToServer::didCommitTransaction):
2828         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
2829         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
2830         (WebCore::IDBClient::IDBConnectionToServer::didAbortTransaction):
2831         (WebCore::IDBClient::IDBConnectionToServer::fireVersionChangeEvent):
2832         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
2833         (WebCore::IDBClient::IDBConnectionToServer::didStartTransaction):
2834         (WebCore::IDBClient::IDBConnectionToServer::notifyOpenDBRequestBlocked):
2835         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
2836         (WebCore::IDBClient::IDBConnectionToServer::registerDatabaseConnection): Deleted.
2837         (WebCore::IDBClient::IDBConnectionToServer::unregisterDatabaseConnection): Deleted.
2838         (WebCore::IDBClient::IDBConnectionToServer::hasRecordOfTransaction): Deleted.
2839         * Modules/indexeddb/client/IDBConnectionToServer.h:
2840         
2841         * Modules/indexeddb/shared/IDBRequestData.cpp:
2842         (WebCore::IDBRequestData::IDBRequestData):
2843         * Modules/indexeddb/shared/IDBRequestData.h:
2844         
2845         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2846         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2847         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2848
2849 2016-05-04  Brady Eidson  <beidson@apple.com>
2850
2851         Modern IDB: Add isolatedCopy to a few more objects.
2852         https://bugs.webkit.org/show_bug.cgi?id=157330
2853
2854         Reviewed by Alex Christensen.
2855
2856         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2857
2858         * Modules/indexeddb/shared/IDBRequestData.cpp:
2859         (WebCore::IDBRequestData::IDBRequestData):
2860         (WebCore::IDBRequestData::isolatedCopy):
2861         * Modules/indexeddb/shared/IDBRequestData.h:
2862
2863         * Modules/indexeddb/shared/IDBResultData.cpp:
2864         (WebCore::IDBResultData::IDBResultData):
2865         (WebCore::IDBResultData::isolatedCopy):
2866         * Modules/indexeddb/shared/IDBResultData.h:
2867
2868 2016-05-04  Brady Eidson  <beidson@apple.com>
2869
2870         Modern IDB: Add thread identifiers and assertions to IDB DOM objects.
2871         https://bugs.webkit.org/show_bug.cgi?id=157329
2872
2873         Reviewed by Alex Christensen.
2874
2875         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2876
2877         * Modules/indexeddb/IDBCursor.cpp:
2878         (WebCore::IDBCursor::IDBCursor):
2879         (WebCore::IDBCursor::~IDBCursor):
2880         (WebCore::IDBCursor::sourcesDeleted):
2881         (WebCore::IDBCursor::transaction):
2882         (WebCore::IDBCursor::direction):
2883         (WebCore::IDBCursor::update):
2884         (WebCore::IDBCursor::advance):
2885         (WebCore::IDBCursor::continueFunction):
2886         (WebCore::IDBCursor::uncheckedIterateCursor):
2887         (WebCore::IDBCursor::deleteFunction):
2888         (WebCore::IDBCursor::setGetResult):
2889         
2890         * Modules/indexeddb/IDBDatabase.cpp:
2891         (WebCore::IDBDatabase::~IDBDatabase):
2892         (WebCore::IDBDatabase::hasPendingActivity):
2893         (WebCore::IDBDatabase::name):
2894         (WebCore::IDBDatabase::version):
2895         (WebCore::IDBDatabase::objectStoreNames):
2896         (WebCore::IDBDatabase::createObjectStore):
2897         (WebCore::IDBDatabase::transaction):
2898         (WebCore::IDBDatabase::deleteObjectStore):
2899         (WebCore::IDBDatabase::close):
2900         (WebCore::IDBDatabase::maybeCloseInServer):
2901         (WebCore::IDBDatabase::activeDOMObjectName):
2902         (WebCore::IDBDatabase::canSuspendForDocumentSuspension):
2903         (WebCore::IDBDatabase::stop):
2904         (WebCore::IDBDatabase::startVersionChangeTransaction):
2905         (WebCore::IDBDatabase::didStartTransaction):
2906         (WebCore::IDBDatabase::willCommitTransaction):
2907         (WebCore::IDBDatabase::didCommitTransaction):
2908         (WebCore::IDBDatabase::willAbortTransaction):
2909         (WebCore::IDBDatabase::didAbortTransaction):
2910         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
2911         (WebCore::IDBDatabase::fireVersionChangeEvent):
2912         (WebCore::IDBDatabase::dispatchEvent):
2913         (WebCore::IDBDatabase::didCreateIndexInfo):
2914         (WebCore::IDBDatabase::didDeleteIndexInfo):
2915         * Modules/indexeddb/IDBDatabase.h:
2916         (WebCore::IDBDatabase::originThreadID):
2917         
2918         * Modules/indexeddb/IDBIndex.cpp:
2919         (WebCore::IDBIndex::IDBIndex):
2920         (WebCore::IDBIndex::~IDBIndex):
2921         (WebCore::IDBIndex::name):
2922         (WebCore::IDBIndex::objectStore):
2923         (WebCore::IDBIndex::keyPath):
2924         (WebCore::IDBIndex::unique):
2925         (WebCore::IDBIndex::multiEntry):
2926         (WebCore::IDBIndex::openCursor):
2927         (WebCore::IDBIndex::doCount):
2928         (WebCore::IDBIndex::openKeyCursor):
2929         (WebCore::IDBIndex::doGet):
2930         (WebCore::IDBIndex::doGetKey):
2931         (WebCore::IDBIndex::markAsDeleted):
2932         
2933         * Modules/indexeddb/IDBObjectStore.cpp:
2934         (WebCore::IDBObjectStore::IDBObjectStore):
2935         (WebCore::IDBObjectStore::~IDBObjectStore):
2936         (WebCore::IDBObjectStore::name):
2937         (WebCore::IDBObjectStore::keyPath):
2938         (WebCore::IDBObjectStore::indexNames):
2939         (WebCore::IDBObjectStore::transaction):
2940         (WebCore::IDBObjectStore::autoIncrement):
2941         (WebCore::IDBObjectStore::openCursor):
2942         (WebCore::IDBObjectStore::get):
2943         (WebCore::IDBObjectStore::putOrAdd):
2944         (WebCore::IDBObjectStore::doDelete):
2945         (WebCore::IDBObjectStore::clear):
2946         (WebCore::IDBObjectStore::createIndex):
2947         (WebCore::IDBObjectStore::index):
2948         (WebCore::IDBObjectStore::deleteIndex):
2949         (WebCore::IDBObjectStore::doCount):
2950         (WebCore::IDBObjectStore::markAsDeleted):
2951         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
2952         
2953         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2954         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
2955         (WebCore::IDBOpenDBRequest::onError):
2956         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
2957         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
2958         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
2959         (WebCore::IDBOpenDBRequest::dispatchEvent):
2960         (WebCore::IDBOpenDBRequest::onSuccess):
2961         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
2962         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
2963         (WebCore::IDBOpenDBRequest::requestCompleted):
2964         (WebCore::IDBOpenDBRequest::requestBlocked):
2965         
2966         * Modules/indexeddb/IDBRequest.cpp:
2967         (WebCore::IDBRequest::~IDBRequest):
2968         (WebCore::IDBRequest::errorCode):
2969         (WebCore::IDBRequest::error):
2970         (WebCore::IDBRequest::setSource):
2971         (WebCore::IDBRequest::setVersionChangeTransaction):
2972         (WebCore::IDBRequest::transaction):
2973         (WebCore::IDBRequest::readyState):
2974         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
2975         (WebCore::IDBRequest::sourceIndexIdentifier):
2976         (WebCore::IDBRequest::requestedIndexRecordType):
2977         (WebCore::IDBRequest::eventTargetInterface):
2978         (WebCore::IDBRequest::activeDOMObjectName):
2979         (WebCore::IDBRequest::canSuspendForDocumentSuspension):
2980         (WebCore::IDBRequest::hasPendingActivity):
2981         (WebCore::IDBRequest::stop):
2982         (WebCore::IDBRequest::enqueueEvent):
2983         (WebCore::IDBRequest::dispatchEvent):
2984         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
2985         (WebCore::IDBRequest::setResult):
2986         (WebCore::IDBRequest::setResultToStructuredClone):
2987         (WebCore::IDBRequest::clearResult):
2988         (WebCore::IDBRequest::setResultToUndefined):
2989         (WebCore::IDBRequest::resultCursor):
2990         (WebCore::IDBRequest::willIterateCursor):
2991         (WebCore::IDBRequest::didOpenOrIterateCursor):
2992         (WebCore::IDBRequest::requestCompleted):
2993         (WebCore::IDBRequest::onError):
2994         (WebCore::IDBRequest::onSuccess):
2995         * Modules/indexeddb/IDBRequest.h:
2996         (WebCore::IDBRequest::originThreadID):
2997         
2998         * Modules/indexeddb/IDBTransaction.cpp:
2999         (WebCore::IDBTransaction::IDBTransaction):
3000         (WebCore::IDBTransaction::~IDBTransaction):
3001         (WebCore::IDBTransaction::mode):
3002         (WebCore::IDBTransaction::db):
3003         (WebCore::IDBTransaction::serverConnection):
3004         (WebCore::IDBTransaction::error):
3005         (WebCore::IDBTransaction::objectStore):
3006         (WebCore::IDBTransaction::abortDueToFailedRequest):
3007         (WebCore::IDBTransaction::transitionedToFinishing):
3008         (WebCore::IDBTransaction::abort):
3009         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
3010         (WebCore::IDBTransaction::activeDOMObjectName):
3011         (WebCore::IDBTransaction::canSuspendForDocumentSuspension):
3012         (WebCore::IDBTransaction::hasPendingActivity):
3013         (WebCore::IDBTransaction::stop):
3014         (WebCore::IDBTransaction::isActive):
3015         (WebCore::IDBTransaction::isFinishedOrFinishing):
3016         (WebCore::IDBTransaction::addRequest):
3017         (WebCore::IDBTransaction::removeRequest):
3018         (WebCore::IDBTransaction::scheduleOperation):
3019         (WebCore::IDBTransaction::scheduleOperationTimer):
3020         (WebCore::IDBTransaction::operationTimerFired):
3021         (WebCore::IDBTransaction::commit):
3022         (WebCore::IDBTransaction::commitOnServer):
3023         (WebCore::IDBTransaction::finishAbortOrCommit):
3024         (WebCore::IDBTransaction::didStart):
3025         (WebCore::IDBTransaction::notifyDidAbort):
3026         (WebCore::IDBTransaction::didAbort):
3027         (WebCore::IDBTransaction::didCommit):
3028         (WebCore::IDBTransaction::fireOnComplete):
3029         (WebCore::IDBTransaction::fireOnAbort):
3030         (WebCore::IDBTransaction::enqueueEvent):
3031         (WebCore::IDBTransaction::dispatchEvent):
3032         (WebCore::IDBTransaction::createObjectStore):
3033         (WebCore::IDBTransaction::createObjectStoreOnServer):
3034         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
3035         (WebCore::IDBTransaction::createIndex):
3036         (WebCore::IDBTransaction::createIndexOnServer):
3037         (WebCore::IDBTransaction::didCreateIndexOnServer):
3038         (WebCore::IDBTransaction::requestOpenCursor):
3039         (WebCore::IDBTransaction::doRequestOpenCursor):
3040         (WebCore::IDBTransaction::openCursorOnServer):
3041         (WebCore::IDBTransaction::didOpenCursorOnServer):
3042         (WebCore::IDBTransaction::iterateCursor):
3043         (WebCore::IDBTransaction::iterateCursorOnServer):
3044         (WebCore::IDBTransaction::didIterateCursorOnServer):
3045         (WebCore::IDBTransaction::requestGetRecord):
3046         (WebCore::IDBTransaction::requestGetValue):
3047         (WebCore::IDBTransaction::requestGetKey):
3048         (WebCore::IDBTransaction::requestIndexRecord):
3049         (WebCore::IDBTransaction::getRecordOnServer):
3050         (WebCore::IDBTransaction::didGetRecordOnServer):
3051         (WebCore::IDBTransaction::requestCount):
3052         (WebCore::IDBTransaction::getCountOnServer):
3053         (WebCore::IDBTransaction::didGetCountOnServer):
3054         (WebCore::IDBTransaction::requestDeleteRecord):
3055         (WebCore::IDBTransaction::deleteRecordOnServer):
3056         (WebCore::IDBTransaction::didDeleteRecordOnServer):
3057         (WebCore::IDBTransaction::requestClearObjectStore):
3058         (WebCore::IDBTransaction::clearObjectStoreOnServer):
3059         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
3060         (WebCore::IDBTransaction::requestPutOrAdd):
3061         (WebCore::IDBTransaction::putOrAddOnServer):
3062         (WebCore::IDBTransaction::didPutOrAddOnServer):
3063         (WebCore::IDBTransaction::deleteObjectStore):
3064         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
3065         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
3066         (WebCore::IDBTransaction::deleteIndex):
3067         (WebCore::IDBTransaction::deleteIndexOnServer):
3068         (WebCore::IDBTransaction::didDeleteIndexOnServer):
3069         (WebCore::IDBTransaction::operationDidComplete):
3070         (WebCore::IDBTransaction::establishOnServer):
3071         (WebCore::IDBTransaction::activate):
3072         (WebCore::IDBTransaction::deactivate):
3073
3074 2016-05-05  Nan Wang  <n_wang@apple.com>
3075
3076         For keyboard users, activating a fragment URL should transfer focus and caret to the destination
3077         https://bugs.webkit.org/show_bug.cgi?id=116046
3078
3079         Reviewed by Ryosuke Niwa.
3080
3081         Added a sequential focus navigation starting node to document. When TAB or SHIFT-TAB is pressed
3082         and there is no focused element, we start searching for next focus candidates at the sequential
3083         focus navigation node.
3084
3085         Test: fast/events/sequential-focus-navigation-starting-point.html
3086
3087         * dom/Document.cpp:
3088         (WebCore::Document::removedLastRef):
3089         (WebCore::Document::destroyRenderTree):
3090         (WebCore::Document::removeFocusedNodeOfSubtree):
3091         (WebCore::Document::hoveredElementDidDetach):
3092         (WebCore::Document::setFocusedElement):
3093         (WebCore::isNodeFrameOrDocument):
3094         (WebCore::Document::setFocusNavigationStartingNode):
3095         (WebCore::Document::focusNavigationStartingNode):
3096         (WebCore::Document::setCSSTarget):
3097         (WebCore::Document::nodeChildrenWillBeRemoved):
3098         (WebCore::Document::nodeWillBeRemoved):
3099         (WebCore::fallbackFocusNavigationStartingNodeAfterRemoval):
3100         (WebCore::Document::updateFocusNavigationStartingNodeWithNodeRemoval):
3101         (WebCore::Document::textInserted):
3102         * dom/Document.h:
3103         (WebCore::Document::userActionElements):
3104         * page/EventHandler.cpp:
3105         (WebCore::EventHandler::handleMousePressEvent):
3106         * page/FocusController.cpp:
3107         (WebCore::FocusController::advanceFocusInDocumentOrder):
3108         * page/FrameView.cpp:
3109         (WebCore::FrameView::scrollToAnchor):
3110
3111 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3112
3113         Another iOS debug build fix after r200464.
3114
3115         * dom/EventContext.h:
3116         (WebCore::EventContext::isUnreachableNode):
3117
3118 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3119
3120         iOS debug build fix after r200464.
3121
3122         * dom/EventContext.cpp:
3123         (WebCore::TouchEventContext::checkReachability):
3124
3125 2016-05-05  Simon Fraser  <simon.fraser@apple.com>
3126
3127         Revert r200390, thus putting r199259 and r200161 and back.
3128
3129         * loader/HistoryController.cpp:
3130         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
3131         * page/FrameView.cpp:
3132         (WebCore::FrameView::adjustTiledBackingScrollability):
3133         * page/Page.h:
3134         (WebCore::Page::obscuredInset):
3135         (WebCore::Page::setObscuredInset):
3136         (WebCore::Page::enclosedInScrollableAncestorView):
3137         (WebCore::Page::setEnclosedInScrollableAncestorView):
3138         * platform/ScrollView.h:
3139         (WebCore::ScrollView::platformObscuredInset): Deleted.
3140         (WebCore::ScrollView::platformSetObscuredInset): Deleted.
3141
3142 2016-05-05  Sam Weinig  <sam@webkit.org>
3143
3144         Fix the build.
3145
3146         * platform/network/cf/CertificateInfo.h:
3147
3148 2016-05-05  Eric Carlson  <eric.carlson@apple.com>
3149
3150         [iOS] Media information is sometimes not shown in Control Center
3151         https://bugs.webkit.org/show_bug.cgi?id=157377
3152
3153         Reviewed by Jer Noble.
3154
3155         * platform/audio/ios/MediaSessionManagerIOS.h:
3156         * platform/audio/ios/MediaSessionManagerIOS.mm:
3157         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Store values passed to MPNowPlayingInfoCenter
3158           individually instead of in a dictionary.
3159
3160 2016-05-04  Simon Fraser  <simon.fraser@apple.com>
3161
3162         Comments on wired.com are blurry
3163         https://bugs.webkit.org/show_bug.cgi?id=148630
3164         rdar://problem/22499655
3165
3166         Reviewed by Tim Horton.
3167
3168         Make sure to set -rasterizationScale on TileGrid container layers to avoid blurry layers
3169         with some configurations of transforms, perspective and clipping.
3170
3171         Test: compositing/contents-scale/rasterization-scale.html
3172
3173         * platform/graphics/ca/TileController.cpp:
3174         (WebCore::TileController::TileController): Initialize m_deviceScaleFactor before m_tileGrid,
3175         because TileGrid's constructor needs to read the device scale.
3176         * platform/graphics/ca/TileController.h:
3177         * platform/graphics/ca/TileGrid.cpp:
3178         (WebCore::TileGrid::TileGrid): Push a contentsScale (which also sets rasterizationScale) onto 
3179         the tile grid container layer on constructions, and in setScale().
3180         (WebCore::TileGrid::setScale):
3181
3182 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3183
3184         event.target shouldn't be retargeted as the event bubbles into a slot
3185         https://bugs.webkit.org/show_bug.cgi?id=157369
3186
3187         Reviewed by Antti Koivisto.
3188
3189         When an event bubbles up from an assigned node to its assigned slot, we shouldn't be adjusting
3190         event.target to point to the slot. Since a shadow tree should have access to nodes outside
3191         the shadow tree, event.target is accessible inside the shadow tree of such a slot.
3192
3193         New behavior matches the behavior of Google Chrome Canary as well as the shadow DOM specification:
3194         http://w3c.github.io/webcomponents/spec/shadow/#dfn-retargeting-algorithm
3195
3196         Test: fast/shadow-dom/event-inside-slotted-node.html
3197
3198         * dom/Event.cpp:
3199         (WebCore::Event::deepPath):
3200         * dom/EventContext.h:
3201         (WebCore::EventContext::isUnreachableNode): Use Node::isUnclosedNode instead of isReachable.
3202         (WebCore::EventContext::isReachable): Deleted.
3203         * dom/EventPath.cpp:
3204         (WebCore::EventPath::EventPath): Don't set the target to the slot when entering a slot. Also moved
3205         the code to adjust the target as we exit a shadow tree to the end of the outer loop for clarity.
3206         (WebCore::isUnclosedNodeOf): Deleted. Renamed to Node::isUnclosedNode.
3207         (WebCore::EventPath::setRelatedTarget):
3208         (WebCore::EventPath::computePathUnclosedToTarget): Renamed from computePathDisclosedToTarget.
3209         (WebCore::moveOutOfAllShadowRoots): Extracted from RelatedNodeRetargeter::RelatedNodeRetargeter.
3210         (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): Fixed a bug that we were exiting early
3211         without setting m_hasDifferentTreeRoot true when target and relatedNode are disconnected from
3212         a document.
3213         (WebCore::RelatedNodeRetargeter::currentNode):
3214         (WebCore::RelatedNodeRetargeter::checkConsistency): Updated to match the spec with one exception.
3215         We don't use null as the adjusted related target when the (original) related target and the target
3216         are in two distinct disconnected trees since such a behavior is not Web compatible. This spec bug is
3217         tracked by https://github.com/w3c/webcomponents/issues/494
3218         * dom/EventPath.h:
3219         (WebCore::EventPath::eventTargetRespectingTargetRules): Returns Node* instead of EventTarget* since
3220         we need a Node in RelatedNodeRetargeter::checkConsistency.
3221         * dom/Node.cpp:
3222         (WebCore::Node::isUnclosedNode): Moved from RelatedNodeRetargeter.cpp
3223         * dom/Node.h:
3224
3225 2016-05-02  Sam Weinig  <sam@webkit.org>
3226
3227         On platforms that support it, use a SecTrustRef as the basis of CertificateInfo instead of a chain of SecCertificateRefs.
3228         https://bugs.webkit.org/show_bug.cgi?id=157220
3229
3230         Reviewed by Darin Adler.
3231
3232         * platform/network/cf/CertificateInfo.h:
3233         (WebCore::CertificateInfo::CertificateInfo):
3234         (WebCore::CertificateInfo::trust):
3235         (WebCore::CertificateInfo::isEmpty):
3236         (WebCore::CertificateInfo::setCertificateChain): Deleted.
3237         (WebCore::CertificateInfo::certificateChain): Deleted.
3238         * platform/network/mac/CertificateInfoMac.mm:
3239         (WebCore::CertificateInfo::type):
3240         (WebCore::CertificateInfo::certificateChain):
3241         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate):
3242         (WebCore::CertificateInfo::dump):
3243         When supported, allow CertificateInfo to contain a SecTrustRef instead of a certificate chain. We keep
3244         support for holding on to a certificate chain as well, since there is API that depends on this.
3245
3246         * platform/network/cocoa/ResourceResponseCocoa.mm:
3247         (WebCore::ResourceResponse::platformCertificateInfo):
3248         When supported, use the SecTrustRef from the error instead of extracting it's certificate chain.
3249
3250 2016-05-04  Ada Chan  <adachan@apple.com>
3251
3252         When exiting fullscreen, call a JS method immediately to implement the style changes for the presentation mode change right away
3253         https://bugs.webkit.org/show_bug.cgi?id=157359
3254
3255         Reviewed by Eric Carlson.
3256
3257         No new tests as this is done to just mitigate a visual glitch.
3258
3259         * html/HTMLMediaElement.cpp:
3260         (WebCore::HTMLMediaElement::exitFullscreen):
3261         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
3262         * html/HTMLMediaElement.h:
3263
3264 2016-05-04  Alex Christensen  <achristensen@webkit.org>
3265
3266         Blocked redirected main resource requests need descriptive errors
3267         https://bugs.webkit.org/show_bug.cgi?id=156828
3268         rdar://problem/25711316
3269
3270         Reviewed by Daniel Bates.
3271
3272         Test: http/tests/contentextensions/main-resource-redirect-error.html
3273
3274         * loader/DocumentLoader.cpp:
3275         (WebCore::DocumentLoader::startLoadingMainResource):
3276         Call cancelMainResourceLoad() so that InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame()
3277         is called to be consistent with blocked redirected main resource requests.
3278         * loader/ResourceLoader.cpp:
3279         (WebCore::ResourceLoader::willSendRequestInternal):
3280         (WebCore::ResourceLoader::blockedError):
3281         (WebCore::ResourceLoader::blockedByContentBlockerError):
3282         (WebCore::ResourceLoader::cannotShowURLError):
3283         * loader/ResourceLoader.h:
3284         Use a blockedByContentBlockerError() instead of a cannotShowURLError() when we blocked the load.
3285
3286 2016-05-05  Zan Dobersek  <zdobersek@igalia.com>
3287
3288         Fix assertions in debug builds for the GTK+ port.
3289
3290         Rubber-stamped by Carlos Garcia Campos.
3291
3292         * platform/graphics/texmap/TextureMapperGL.cpp:
3293         (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
3294         Switch back to the find() + add() combo for retrieving the pointer
3295         to the SharedGLData object stored for the specific GraphicsContext3D.
3296         add() + isNewEntry is causing assertions in debug builds when adding
3297         the first entry.
3298
3299 2016-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3300
3301         [GStreamer] Adaptive streaming issues
3302         https://bugs.webkit.org/show_bug.cgi?id=144040
3303
3304         Reviewed by Philippe Normand.
3305
3306         In the case of adaptive streaming, the GST URI downloader object is creating the source object, in our case
3307         WebKitWebSrc, without taking its ownership. This is breaking the lifetime of the WebKitWebSrc element. We are
3308         using GRefPtr in WebKitWebSrc to ref/unref the object when sending notifications to the main thread, ensuring
3309         that the object is not destroyed before the main thread dispatches the message. But our smart pointers are so
3310         smart that in case of receiving a floating reference, it's converted to a full reference, so that the first time
3311         we try to take a ref of a WebKitWebSrc having a floating reference we are actually taking the ownership
3312         instead. When we try to release the reference, we are actuallty destroying the object, something that the actual
3313         owner is not expecting and causing runtime critical warnings and very often web process crashes.
3314
3315             (WebKitWebProcess:6863): GStreamer-CRITICAL **:
3316             Trying to dispose element appsrc1, but it is in READY instead of the NULL state.
3317             You need to explicitly set elements to the NULL state before
3318             dropping the final reference, to allow them to clean up.
3319             This problem may also be caused by a refcounting bug in the
3320             application or some element.
3321
3322             (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_handler_get_uri: assertion 'GST_IS_URI_HANDLER(handler)' failed
3323
3324             (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_get_protocol: assertion 'uri != NULL' failed
3325
3326         This should be fixed in GST, but we can workaround it in WebKit while it's fixed in GST or to prevent this from
3327         happening if other users make the same mistake. The idea is to add a ensureGRef() only available for GRefPtr
3328         when using WebKitWebSrc objects that consumes the floating reference if needed before taking the actual reference.
3329
3330         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
3331         (WTF::ensureGRef): Consume the floating ref if needed.
3332         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
3333         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3334         (webKitWebSrcChangeState): Use ensureGRef().
3335
3336 2016-05-05  Csaba Osztrogonác  <ossy@webkit.org>
3337
3338         [Mac][cmake] Unreviewed speculative buildfix after r200433, just for fun.
3339
3340         * PlatformMac.cmake:
3341
3342 2016-05-04  Zan Dobersek  <zdobersek@igalia.com>
3343
3344         [TexMap] Clean up TextureMapperShaderProgram
3345         https://bugs.webkit.org/show_bug.cgi?id=157302
3346
3347         Reviewed by Carlos Garcia Campos.
3348
3349         Clean up the header and the implementation file of the
3350         TextureMapperShaderProgram class. Reference the GraphicsContext3D
3351         object through a Ref<>, and have the context() return a reference,
3352         not a pointer.
3353
3354         Sort the parts of the implementation file into something more
3355         sensible. StringBuilder usage in create() is improved. getLocation()
3356         only needs to do one lookup in the m_variables map by using ensure().
3357
3358         No new tests -- no change in behavior.
3359
3360         * platform/graphics/surfaces/GLTransportSurface.cpp:
3361         (WebCore::GLTransportSurface::initializeShaderProgram):
3362         * platform/graphics/texmap/TextureMapperGL.cpp:
3363         (WebCore::TextureMapperGLData::SharedGLData::getShaderProgram):
3364         (WebCore::prepareFilterProgram):
3365         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
3366         (WebCore::TextureMapperShaderProgram::create):
3367         (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
3368         (WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
3369         (WebCore::TextureMapperShaderProgram::setMatrix):
3370         (WebCore::TextureMapperShaderProgram::getLocation):
3371         * platform/graphics/texmap/TextureMapperShaderProgram.h:
3372         (WebCore::TextureMapperShaderProgram::context):
3373