e34698a682a1e360f7469f84baca3165fad5987d
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-03-31  Zalan Bujtas  <zalan@apple.com>
2
3         putImageData leaves visible artifacts on retina display
4         https://bugs.webkit.org/show_bug.cgi?id=156039
5         <rdar://problem/25482243>
6
7         Reviewed by Simon Fraser.
8
9         Inflate the repaint rect to cover anti-aliasing bits.
10
11         Test: fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html
12
13         * html/HTMLCanvasElement.cpp:
14         (WebCore::HTMLCanvasElement::didDraw):
15
16 2016-04-01  Jiewen Tan  <jiewen_tan@apple.com>
17
18         WebKit should dispatchDidFailProvisionalLoad while loading invalid URLs
19         https://bugs.webkit.org/show_bug.cgi?id=155995
20         <rdar://problem/14967004>
21
22         Reviewed by Andy Estes.
23
24         Added API Tests.
25
26         If a loading request contains an invalid URL, DocumentLoader will now dispatch
27         cannotShowURLError to the clients.
28
29         * loader/DocumentLoader.cpp:
30         (WebCore::DocumentLoader::startLoadingMainResource):
31
32 2016-04-01  Frederic Wang  <fwang@igalia.com>
33
34         Reset CSS spacing rules on the <math> element.
35         https://bugs.webkit.org/show_bug.cgi?id=155433
36
37         Reviewed by Brent Fulgham.
38
39         Test: mathml/presentation/css-spacing.html
40
41         When the authors has changed some CSS spacing rules on a page, they are currently inherited on MathML too, potentially causing broken math rendering.
42         For example, this caused a bug in Firefox on Wikipedia in the past. Hence we align on Gecko and just reset the CSS spacing rules by default. We also import Mozilla's test.
43
44         * css/mathml.css:
45         (math): Set line-height, word-spacing and letter-spacing to normal.
46
47 2016-04-01  Daniel Bates  <dabates@apple.com>
48
49         CSP: child-src violations reported as frame-src violation
50         https://bugs.webkit.org/show_bug.cgi?id=156092
51         <rdar://problem/25478509>
52
53         Reviewed by Andy Estes.
54
55         Tests: http/tests/security/contentSecurityPolicy/1.1/securityviolationpolicy-block-frame-using-child-src.html
56                http/tests/security/contentSecurityPolicy/1.1/securityviolationpolicy-block-frame-using-default-src.html
57                http/tests/security/contentSecurityPolicy/1.1/securityviolationpolicy-block-frame-using-frame-src.html
58
59         * page/csp/ContentSecurityPolicy.cpp:
60         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Determine the name of the effective violation
61         directive from the name of the violated directive. If the name of the violated directive is "frame-src"
62         then use that name for the name of the effective violated directive. Otherwise, use "child-src" for the
63         name of the effective violated directive. A byproduct of this decision is that we report child-src as the
64         effective violated directive when a frame load was blocked by the default-src directive. This seems reasonable
65         because directive frame-src is deprecated in Content Security Policy Level 2. The child-src directive is
66         its replacement.
67
68 2016-04-01  Alex Christensen  <achristensen@webkit.org>
69
70         Compile DumpRenderTree with CMake on Mac
71         https://bugs.webkit.org/show_bug.cgi?id=156088
72
73         Reviewed by Brent Fulgham.
74
75         * PlatformMac.cmake:
76         * platform/mock/mediasource/MockBox.cpp:
77
78 2016-03-31  Antti Koivisto  <antti@apple.com>
79
80         Separate render tree updating from style resolve
81         https://bugs.webkit.org/show_bug.cgi?id=155298
82
83         Reviewed by Andreas Kling.
84
85         This patch splits computing document style and applying the results into two distinct steps:
86
87         Style::TreeResolver::resolve()
88                 |
89                 | Style::Update
90                 V
91         RenderTreeUpdater::commit()
92
93         Style::TreeResolver::resolve() returns a Style::Update object that contains all the changes to be made
94         for the whole composed tree. RenderTreeUpdater then applies the changes updating, building or tearing
95         down portions of the render tree as needed.
96
97         Style::Update consists of a map that contains new style for each newly resolved element along with some
98         metadata. A separate map contains text nodes that require reconstruction. It also tracks change roots so
99         RenderTreeUpdater needs to traverse the changed subtrees only.
100
101         The patch eliminates the recursive render tree build code path replacing it with iterative functions.
102
103         This will enable future optimizations. For example we won't need to commit to immediate rendering
104         changes simply because some script or internal function requires up-to-date style.
105
106         * CMakeLists.txt:
107         * WebCore.xcodeproj/project.pbxproj:
108         * css/StyleResolver.cpp:
109         (WebCore::StyleResolver::State::State):
110         (WebCore::StyleResolver::styleForElement):
111         * css/StyleResolver.h:
112         (WebCore::StyleResolver::setOverrideDocumentElementStyle):
113         (WebCore::StyleResolver::State::State):
114
115             Root element style is needed for resolving other elements. Add a way to provide it without looking
116             into active document style.
117
118         * dom/Document.cpp:
119         (WebCore::Document::recalcStyle):
120
121             Resolve the document style and commit it immediately (for now).
122
123         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
124         * dom/Document.h:
125         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
126         (WebCore::Document::inStyleRecalc):
127         (WebCore::Document::inRenderTreeUpdate):
128         * dom/Element.cpp:
129         (WebCore::Element::setChildIndex):
130
131             Setting the unique bit is now done by style relations update code.
132
133         * dom/Node.cpp:
134         (WebCore::Node::setNeedsStyleRecalc):
135
136             Prevent spurious style invalidation during render tree updating.
137
138         * rendering/RenderBox.cpp:
139         (WebCore::RenderBox::styleDidChange):
140
141             Capturing body element color for color:-webkit-text is now done by TreeResolver.
142
143         * rendering/RenderElement.h:
144         (WebCore::RenderElement::setAnimatableStyle): Deleted.
145
146             No longer used.
147
148         * style/RenderTreePosition.cpp:
149         (WebCore::RenderTreePosition::nextSiblingRenderer):
150
151             Skip over non-rendered slot elements.
152
153         * style/RenderTreeUpdater.cpp: Added.
154         (WebCore::RenderTreeUpdater::Parent::Parent):
155         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
156         (WebCore::hasDisplayContents):
157         (WebCore::findRenderingRoot):
158         (WebCore::RenderTreeUpdater::commit):
159
160             Call updateRenderTree for each change root.
161
162         (WebCore::shouldCreateRenderer):
163         (WebCore::RenderTreeUpdater::updateRenderTree):
164
165             Iteratively traverse the composed tree starting for a change root.
166             Apply the changes calling updateElementRenderer and updateTextRenderer as needed.
167             Enter subtrees that haves changes to apply.
168
169         (WebCore::RenderTreeUpdater::renderTreePosition):
170
171             We may not create renderers for all elements (<slot> or more generally display:contents) that
172             have rendered descendants. Search the parent stack to find the valid position.
173
174         (WebCore::RenderTreeUpdater::pushParent):
175         (WebCore::RenderTreeUpdater::popParent):
176         (WebCore::RenderTreeUpdater::popParentsToDepth):
177
178             Maintain parent stack.
179
180         (WebCore::pseudoStyleCacheIsInvalid):
181         (WebCore::RenderTreeUpdater::updateElementRenderer):
182
183             Create, delete or update the renderer.
184
185         (WebCore::moveToFlowThreadIfNeeded):
186         (WebCore::RenderTreeUpdater::createRenderer):
187         (WebCore::textRendererIsNeeded):
188         (WebCore::createTextRenderer):
189         (WebCore::RenderTreeUpdater::updateTextRenderer):
190         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
191
192             This is moved from TreeResolver.
193
194         (WebCore::needsPseudoElement):
195         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
196
197             Pseudo elements are handled entirely during render tree construction. Compute their style and
198             create or delete them as needed.
199
200         * style/RenderTreeUpdater.h: Added.
201         (WebCore::RenderTreeUpdater::parent):
202         * style/StyleRelations.cpp:
203         (WebCore::Style::commitRelationsToRenderStyle):
204         (WebCore::Style::commitRelations):
205
206             Commit to Style::Update instead of the document if needed.
207
208         (WebCore::Style::commitRelationsToDocument): Deleted.
209         * style/StyleRelations.h:
210         * style/StyleSharingResolver.cpp:
211         (WebCore::Style::elementHasDirectionAuto):
212         (WebCore::Style::SharingResolver::resolve):
213
214             Fetch the shareable style from Style::Update instead of the active document style.
215
216         (WebCore::Style::SharingResolver::findSibling):
217         (WebCore::Style::SharingResolver::canShareStyleWithElement):
218         * style/StyleSharingResolver.h:
219         * style/StyleTreeResolver.cpp:
220         (WebCore::Style::TreeResolver::Parent::Parent):
221
222             No need for render tree position anymore.
223
224         (WebCore::Style::TreeResolver::popScope):
225         (WebCore::Style::TreeResolver::styleForElement):
226         (WebCore::Style::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
227         (WebCore::Style::createTextRendererIfNeeded):
228         (WebCore::Style::updateTextRendererAfterContentChange):
229         (WebCore::Style::resetStyleForNonRenderedDescendants):
230         (WebCore::Style::detachChildren):
231         (WebCore::Style::detachSlotAssignees):
232         (WebCore::Style::detachRenderTree):
233         (WebCore::Style::TreeResolver::resolveElement):
234
235             Just resolve the style and return it, no more applying or entering render tree construction code paths.
236
237         (WebCore::Style::resolveTextNode):
238         (WebCore::Style::elementImplicitVisibility):
239         (WebCore::Style::TreeResolver::pushParent):
240         (WebCore::Style::TreeResolver::popParent):
241         (WebCore::Style::TreeResolver::popParentsToDepth):
242         (WebCore::Style::shouldResolvePseudoElement):
243         (WebCore::Style::TreeResolver::resolveComposedTree):
244
245             Add style changes to Style::Update.
246
247         (WebCore::Style::TreeResolver::resolve):
248
249             Return Style::Update object if non-empty.
250
251         (WebCore::Style::postResolutionCallbackQueue):
252         (WebCore::Style::shouldCreateRenderer): Deleted.
253         (WebCore::Style::moveToFlowThreadIfNeeded): Deleted.
254         (WebCore::Style::TreeResolver::createRenderer): Deleted.
255         (WebCore::Style::TreeResolver::createRenderTreeForChildren): Deleted.
256         (WebCore::Style::TreeResolver::createRenderTreeForShadowRoot): Deleted.
257         (WebCore::Style::beforeOrAfterPseudoElement): Deleted.
258         (WebCore::Style::setBeforeOrAfterPseudoElement): Deleted.
259         (WebCore::Style::clearBeforeOrAfterPseudoElement): Deleted.
260         (WebCore::Style::needsPseudoElement): Deleted.
261         (WebCore::Style::TreeResolver::createRenderTreeForBeforeOrAfterPseudoElement): Deleted.
262         (WebCore::Style::TreeResolver::createRenderTreeForSlotAssignees): Deleted.
263         (WebCore::Style::TreeResolver::createRenderTreeRecursively): Deleted.
264         (WebCore::Style::pseudoStyleCacheIsInvalid): Deleted.
265         (WebCore::Style::TreeResolver::resolveBeforeOrAfterPseudoElement): Deleted.
266
267             Remove the recursive render tree building code path.
268
269         * style/StyleTreeResolver.h:
270         (WebCore::Style::TreeResolver::scope):
271         * style/StyleUpdate.cpp: Added.
272         (WebCore::Style::Update::Update):
273         (WebCore::Style::Update::elementUpdate):
274         (WebCore::Style::Update::textUpdate):
275         (WebCore::Style::Update::elementStyle):
276         (WebCore::Style::Update::addElement):
277         (WebCore::Style::Update::addText):
278         (WebCore::Style::Update::addPossibleRoot):
279         * style/StyleUpdate.h: Added.
280         (WebCore::Style::Update::roots):
281         (WebCore::Style::Update::document):
282         * svg/SVGElement.h:
283         (WebCore::SVGElement::updateRelativeLengthsInformation):
284         * svg/SVGUseElement.cpp:
285         (WebCore::SVGUseElement::svgAttributeChanged):
286         (WebCore::SVGUseElement::willRecalcStyle):
287         (WebCore::SVGUseElement::willAttachRenderers): Deleted.
288
289             Switvh willAttachRenderers to willRecalcStyle as the former is now called too late.
290
291         * svg/SVGUseElement.h:
292
293 2016-03-31  Chris Fleizach  <cfleizach@apple.com>
294
295         AX: <attachment> element not accessible
296         https://bugs.webkit.org/show_bug.cgi?id=156045
297
298         Reviewed by Joanmarie Diggs.
299
300         Make this element accessible by exposing title, subtitle, action, progress to accessibility.
301
302         Test: accessibility/attachment-element.html
303
304         * accessibility/AXObjectCache.cpp:
305         (WebCore::createFromRenderer):
306         * accessibility/AccessibilityAttachment.cpp: Added.
307         (WebCore::AccessibilityAttachment::AccessibilityAttachment):
308         (WebCore::AccessibilityAttachment::create):
309         (WebCore::AccessibilityAttachment::hasProgress):
310         (WebCore::AccessibilityAttachment::valueForRange):
311         (WebCore::AccessibilityAttachment::attachmentElement):
312         (WebCore::AccessibilityAttachment::roleDescription):
313         (WebCore::AccessibilityAttachment::computeAccessibilityIsIgnored):
314         (WebCore::AccessibilityAttachment::accessibilityText):
315         (WebCore::AccessibilityAttachment::accessibilityDescription):
316         * accessibility/AccessibilityAttachment.h: Added.
317         * accessibility/AccessibilityObject.cpp:
318         (WebCore::AccessibilityObject::hasHighlighting):
319         (WebCore::AccessibilityObject::roleDescription):
320         (WebCore::AccessibilityObject::supportsRangeValue):
321         (WebCore::AccessibilityObject::supportsARIASetSize):
322         * accessibility/AccessibilityObject.h:
323         (WebCore::AccessibilityObject::isAttachmentElement):
324         (WebCore::AccessibilityObject::isHeading):
325         (WebCore::AccessibilityObject::isLink):
326         (WebCore::AccessibilityObject::isImage):
327         (WebCore::AccessibilityObject::isRadioButton):
328         (WebCore::AccessibilityObject::isListBox):
329         (WebCore::AccessibilityObject::isListBoxOption):
330         (WebCore::AccessibilityObject::isAttachment):
331         (WebCore::AccessibilityObject::isMediaTimeline):
332         (WebCore::AccessibilityObject::isMenuRelated):
333         (WebCore::AccessibilityObject::isMenu):
334         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
335         (-[WebAccessibilityObjectWrapper accessibilityValue]):
336
337 2016-03-31  Nan Wang  <n_wang@apple.com>
338
339         AX: AX hit-testing does not work on WebKit video playback buttons
340         https://bugs.webkit.org/show_bug.cgi?id=156084
341
342         Reviewed by Darin Adler.
343
344         Use the element at point instead of the shadow host for hit testing on video tags.
345
346         Test: accessibility/mac/video-tag-hit-test.html
347
348         * accessibility/AccessibilityRenderObject.cpp:
349         (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest):
350         (WebCore::shouldUseShadowHostForHitTesting):
351         (WebCore::AccessibilityRenderObject::accessibilityHitTest):
352
353 2016-03-31  Alexey Proskuryakov  <ap@apple.com>
354
355         Page overlay tests sometimes crash under MockPageOverlayClient::uninstallAllOverlays()
356         https://bugs.webkit.org/show_bug.cgi?id=156080
357         rdar://problem/24922183
358
359         Reviewed by Alex Christensen.
360
361         Make MockPageOverlayClient::m_overlays reference the overlays. There is no reference
362         cycle because they are all removed between test page loads.
363
364         * testing/MockPageOverlayClient.cpp:
365         (WebCore::MockPageOverlayClient::uninstallAllOverlays):
366         (WebCore::MockPageOverlayClient::pageOverlayDestroyed):
367         * testing/MockPageOverlayClient.h:
368
369 2016-03-31  Daniel Bates  <dabates@apple.com>
370
371         REGRESSION (r196012): <object>/<embed> with no URL does not match source *
372         https://bugs.webkit.org/show_bug.cgi?id=156079
373         <rdar://problem/25470805>
374
375         Reviewed by Brent Fulgham.
376
377         Fixes an issue where HTML object and embed elements that are not associated with a URL are
378         allowed to load when object-src/default-src contains source *. More generally, we allow
379         such elements to load so long as object-src/default-src is not 'none' per section object-src
380         of the Content Security Policy Level 3 spec., <http://w3c.github.io/webappsec-csp> (Editor's Draft, 29 February 2016).
381
382         Tests: http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html
383                http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html
384                http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html
385                http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html
386
387         * page/csp/ContentSecurityPolicy.cpp:
388         (WebCore::ContentSecurityPolicy::allowObjectFromSource): Modified to call violatedDirectiveInAnyPolicy() passing
389         ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes.
390         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
391         (WebCore::checkSource): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone (defaults to false)
392         and pass it through to ContentSecurityPolicySourceListDirective.
393         (WebCore::checkFrameAncestors): Explicitly pass ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No
394         to avoid URL from having the compiler implicitly convert it to a String and selecting override ContentSecurityPolicySourceListDirective::allows(const String&),
395         which will lead to incorrect results. We will look to make this code less error prone in <https://bugs.webkit.org/show_bug.cgi?id=156086>.
396         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Modified to take argument of type
397         ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone and pass it through.
398         * page/csp/ContentSecurityPolicyDirectiveList.h:
399         * page/csp/ContentSecurityPolicySourceList.cpp:
400         (WebCore::ContentSecurityPolicySourceList::parse): Set instance variable m_isNone to true so that we can differentiate
401         a source list with value 'none' from a source list that lists one or more sources or non-none keywords.
402         * page/csp/ContentSecurityPolicySourceList.h:
403         (WebCore::ContentSecurityPolicySourceList::isNone): Added.
404         * page/csp/ContentSecurityPolicySourceListDirective.cpp:
405         (WebCore::ContentSecurityPolicySourceListDirective::allows): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone
406         and updated code to return true for an empty URL only if this argument is ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes and
407         the source list does not have value 'none'.
408         * page/csp/ContentSecurityPolicySourceListDirective.h:
409
410 2016-03-31  Saam barati  <sbarati@apple.com>
411
412         Revert rewrite const as var workaround
413         https://bugs.webkit.org/show_bug.cgi?id=155393
414
415         Reviewed by Mark Lam.
416
417         * bindings/js/JSDOMWindowBase.cpp:
418         (WebCore::JSDOMWindowBase::commonVM):
419         * page/Settings.cpp:
420         * page/Settings.h:
421         (WebCore::Settings::shouldUseHighResolutionTimers):
422         (WebCore::Settings::backgroundShouldExtendBeyondPage):
423         (WebCore::Settings::shouldRewriteConstAsVar): Deleted.
424         (WebCore::Settings::setShouldRewriteConstAsVar): Deleted.
425
426 2016-03-31  Chris Dumez  <cdumez@apple.com>
427
428         Unreviewed, rolling out r196854.
429
430         We do not need those assertions anymore as it seems
431         <rdar://problem/24457478> is fixed
432
433         Reverted changeset:
434
435         "Land release assertions to help track down a possible
436         HTMLCollection lifetime bug"
437         https://bugs.webkit.org/show_bug.cgi?id=154490
438         http://trac.webkit.org/changeset/196854
439
440 2016-03-31  Chris Dumez  <cdumez@apple.com>
441
442         [iOS] Both WebPage's volatility timer and WebProcess's processSuspensionCleanupTimer are trying to make surfaces volatile with very short interval
443         https://bugs.webkit.org/show_bug.cgi?id=156065
444         <rdar://problem/25452004>
445
446         Reviewed by Simon Fraser.
447
448         Export a symbol so it can be used from WebKit2.
449
450         * page/Page.h:
451
452 2016-03-31  Daniel Bates  <dabates@apple.com>
453
454         REGRESSION (r195605): ASSERTION FAILED: !NoEventDispatchAssertion::isEventDispatchForbidden()
455         when pressing the back button on a page with a focused subframe
456         https://bugs.webkit.org/show_bug.cgi?id=156033
457         <rdar://problem/25446561>
458
459         Reviewed by Chris Dumez.
460
461         Fixes an assertion failure when navigating back, by pressing the browser back button, to
462         the previous page from a page with a focused subframe.
463
464         Following r195605 (https://bugs.webkit.org/show_bug.cgi?id=153449), the responsibility for
465         dispatching a DOM pagehide event moved from CachedFrame to PageCache and we now instantiate
466         a NoEventDispatchAssertion object to enforce the invariant that no additional DOM events are
467         dispatched as part of adding a page to the page cache. When adding a page with a focused
468         subframe to the page cache we focus its main frame, which implicitly defocuses the subframe
469         and dispatches a DOM blur event at it. Therefore an assertion failure occurs when dispatching
470         this DOM blur event (because a NoEventDispatchAssertion object was allocated on the stack).
471
472         Test: fast/history/back-from-page-with-focused-iframe.html
473
474         * history/CachedFrame.cpp:
475         (WebCore::CachedFrame::CachedFrame): Move logic to focus the main frame from here...
476         * history/PageCache.cpp:
477         (WebCore::PageCache::addIfCacheable): to here such that any DOM blur and focus events
478         are dispatched before instantiate the NoEventDispatchAssertion object and enter the page
479         cache.
480
481 2016-03-31  Chris Dumez  <cdumez@apple.com>
482
483         REGRESSION (r191180): Safari does not send Referer Header to iframe src in certain situations
484         https://bugs.webkit.org/show_bug.cgi?id=155754
485         <rdar://problem/25296445>
486
487         Unreviewed, roll out r191180 as it breaks sites and needs to be reworked.
488
489         * html/parser/HTMLPreloadScanner.cpp:
490         (WebCore::TokenPreloadScanner::tagIdFor): Deleted.
491         (WebCore::TokenPreloadScanner::initiatorFor): Deleted.
492         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Deleted.
493         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType): Deleted.
494         * html/parser/HTMLPreloadScanner.h:
495
496 2016-03-31  Jiewen Tan  <jiewen_tan@apple.com>
497
498         WebKit should set Original URL of a download request correctly
499         https://bugs.webkit.org/show_bug.cgi?id=155914
500         <rdar://problem/10473811>
501
502         Reviewed by Anders Carlsson.
503
504         Added API tests.
505
506         Replace the old logic for identifying the Original URL of a download request
507         with a new method based on the logic from Document::firstPartyForCookies, which
508         does a much better job determining the URL a user actually visited.
509
510         * loader/FrameLoader.cpp:
511         (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
512         (WebCore::originatingURLFromBackForwardList): Deleted.
513
514 2016-03-31  Antonio Gomes  <tonikitoo@webkit.org>
515
516         eventMayStartDrag() does not check for shiftKey or isOverLink
517         https://bugs.webkit.org/show_bug.cgi?id=155746
518
519         Reviewed by Darin Adler.
520
521         There is currently a mismatch between the logic that checks whether
522         an event can start a dragging action in EventHandler::handleMousePressEvent
523         and in EventHandler::eventMayStartDrag
524         Basically the former checks for event's count, type, button, target and modifier.
525         The later, on the other hand, only checks for event's button and count.
526
527         In order to sync them up again, as per the comment in the code,
528         patch factors out the logic in ::handleMousePressEvent into a helper function,
529         and ultimately reuses it in ::eventMayStartDrag.
530
531         No new tests for two reasons:
532
533         1) ::handleMousePressEvent will not have any behavior change. Code is factored out
534         into a helper.
535
536         2) The callees of ::eventMayStartDrag are currently WebPage::shouldDelayWindowOrderingEvent
537         and ::acceptsFirstMouse. Based on my understanding of [1], these methods
538         are called when there is a (say) browser window in background with some text selected,
539         and user starts to drag the selected content. Dragging happens without bringing the window
540         foreground. This is called "non-activating click".
541         Such behavior will not change with the patch.
542
543         [1] https://bugs.webkit.org/show_bug.cgi?id=55053 - "Implement non-activating clicks to allow dragging out of a background window"
544
545         * page/EventHandler.cpp:
546         (WebCore::isSingleMouseDownOnLinkOrImage):
547         (WebCore::canMouseEventStartDragInternal):
548         (WebCore::EventHandler::handleMousePressEvent):
549         (WebCore::documentPointForWindowPoint): Moved up in the file to be used elsewhere.
550         (WebCore::EventHandler::eventMayStartDrag):
551
552 2016-03-31  Antonio Gomes  <tonikitoo@webkit.org>
553
554         SelectionController::positionForPlatform should ask EditingBehavior for platform specific behavior
555         https://bugs.webkit.org/show_bug.cgi?id=41976
556
557         Reviewed by Darin Adler.
558
559         SSIA.
560
561         No new tests needed.
562
563         * editing/EditingBehavior.h:
564         (WebCore::EditingBehavior::shouldAlwaysExtendSelectionFromExtentEndpoint):
565         * editing/FrameSelection.cpp:
566         (WebCore::FrameSelection::positionForPlatform):
567
568 2016-03-31  Jeremy Jones  <jeremyj@apple.com>
569
570         mediaShouldUsePersistentCache() is redundant. Use Page::usesEphemeralSession() instead.
571         https://bugs.webkit.org/show_bug.cgi?id=155924
572
573         Reviewed by Simon Fraser.
574
575         No new tests because there is no behavior change.
576
577         Remove machinery for mediaShouldUsePersistentCache() adopt usesEphemeralSession().
578
579         * html/HTMLMediaElement.cpp:
580         (WebCore::HTMLMediaElement::mediaPlayerShouldUsePersistentCache):
581         * page/ChromeClient.h: remove mediaShouldUsePersistentCache()
582
583 2016-03-30  Ada Chan  <adachan@apple.com>
584
585         Add the new "toggle enhanced fullscreen" context menu item to the video context menu on supporting platforms.
586         https://bugs.webkit.org/show_bug.cgi?id=156031
587
588         Reviewed by Eric Carlson.
589
590         * page/ContextMenuController.cpp:
591         (WebCore::ContextMenuController::contextMenuItemSelected):
592         Handle the selection of the context menu item.
593         (WebCore::ContextMenuController::populate):
594         Add this menu item on Mac.
595         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
596         Set the menu item's title depending on the current enhanced fullscreen state
597         and enable this menu item if supported.
598
599         * platform/ContextMenuItem.h:
600         Define the new tag for this menu item.
601
602         * platform/LocalizedStrings.cpp:
603         (WebCore::contextMenuItemTagEnterVideoEnhancedFullscreen):
604         (WebCore::contextMenuItemTagExitVideoEnhancedFullscreen):
605         * platform/LocalizedStrings.h:
606
607         * rendering/HitTestResult.cpp:
608         (WebCore::HitTestResult::mediaSupportsEnhancedFullscreen):
609         (WebCore::HitTestResult::mediaIsInEnhancedFullscreen):
610         (WebCore::HitTestResult::toggleEnhancedFullscreenForVideo):
611         * rendering/HitTestResult.h:
612
613 2016-03-31  Nan Wang  <n_wang@apple.com>
614
615         AX: aria-hidden=false causes video fallback content to be exposed to AX API
616         https://bugs.webkit.org/show_bug.cgi?id=149278
617
618         Reviewed by Chris Fleizach.
619
620         The comment says when aria-hidden="false" and object is not rendered, we should
621         check each parent's aria-hidden status until we encounter a rendered object. So 
622         added a check for the rendered parent in order to break out of the loop earlier.
623
624         Test case covered in modified accessibility/aria-hidden-negates-no-visibility.html
625
626         * accessibility/AXObjectCache.cpp:
627         (WebCore::isNodeAriaVisible):
628
629 2016-03-31  Brent Fulgham  <bfulgham@apple.com>
630
631         [WK2] Support download attribute feature
632         https://bugs.webkit.org/show_bug.cgi?id=102914
633         <rdar://problem/13177492>
634
635         Reviewed by Darin Adler.
636
637         Tested by imported/w3c/web-platform-tests/html/dom/interfaces.html
638                   imported/w3c/web-platform-tests/html/dom/reflection-text.html
639
640         A first draft implementation of this feature.
641
642         * html/HTMLAnchorElement.cpp:
643         (WebCore::HTMLAnchorElement::handleClick): If the anchor has the 'download'
644         attribute, pass along the information to the rest of the load system.
645         * loader/FrameLoadRequest.h:
646         (WebCore::FrameLoadRequest::FrameLoadRequest): Create new overload that
647         accepts a download attribute flag and a suggested filename.
648         (WebCore::FrameLoadRequest::hasDownloadAttribute): Added.
649         (WebCore::FrameLoadRequest::suggestedFilename): Added.
650         * loader/FrameLoader.cpp:
651         (WebCore::FrameLoader::urlSelected): Expand to accept the download attribute
652         flag and suggested filename.
653         (WebCore::FrameLoader::loadURL): Populate the NavigationAction with the new
654         download attribute flag and suggested filename.
655         (WebCore::FrameLoader::loadPostRequest): Ditto.
656         * loader/FrameLoader.h:
657         * loader/FrameLoaderTypes.h: Add new 'HasDownloadAttribute' enum.
658         * loader/NavigationAction.cpp:
659         (WebCore::navigationType):
660         (WebCore::NavigationAction::NavigationAction): Update to accept new download
661         attribute flag and suggested filename.
662         * loader/NavigationAction.h:
663         (WebCore::NavigationAction::hasDownloadAttribute): Added.
664         (WebCore::NavigationAction::suggestedFilename): Added.
665         * loader/PolicyChecker.cpp:
666         (WebCore::PolicyChecker::checkNavigationPolicy): Pass more information to
667         'continueAfterNavigationPolicy'
668         (WebCore::PolicyChecker::continueAfterNavigationPolicy): Accept suggested
669         filename
670         * loader/PolicyChecker.h:
671
672 2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
673
674         [Fetch API] Add basic loading of resources for Workers
675         https://bugs.webkit.org/show_bug.cgi?id=155886
676
677         Reviewed by Alex Christensen.
678
679         Adding impplementation to WorkerGlobalScopeFetch::fetch similarly to DOMWindowFetch::fetch.
680         Refactored code in FetchResponse to share code between the two.
681
682         Updated WorkerThreadableLoader to cope with an ASSERT.
683         The ASSERT ensures that a DocumentThreadableLoader::create returns non null. 
684         In our case, it might happen as all cross origin fetch requests are denied at the moment.
685         This leads to calling didFail in DocumentThreadableLoader::create call and DocumentThreadableLoader::create to return null.
686         Updated the ASSERT to ensures that either the load is finished or DocumentThreadableLoader::create does not return null.
687
688         Covered by rebased tests.
689
690         * Modules/fetch/DOMWindowFetch.cpp:
691         (WebCore::DOMWindowFetch::fetch):
692         * Modules/fetch/FetchResponse.cpp:
693         (WebCore::FetchResponse::startFetching):
694         (WebCore::FetchResponse::fetch):
695         * Modules/fetch/FetchResponse.h:
696         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
697         (WebCore::WorkerGlobalScopeFetch::fetch):
698         * Modules/fetch/WorkerGlobalScopeFetch.h:
699         * loader/WorkerThreadableLoader.cpp:
700         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
701         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
702         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
703         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
704         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck):
705         * loader/WorkerThreadableLoader.h:
706
707 2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
708
709         [Fetch API] Move isDisturbed handling to FetchBodyOwner
710         https://bugs.webkit.org/show_bug.cgi?id=155968
711
712         Reviewed by Darin Adler.
713
714         Moved isDisturbed handling in FetchBodyOwner.
715         This includes promise rejection in case of disturbed bodies.
716
717         No behavior change observable from user scripts.
718
719         * Modules/fetch/FetchBody.cpp:
720         (WebCore::FetchBody::arrayBuffer):
721         (WebCore::FetchBody::blob):
722         (WebCore::FetchBody::json):
723         (WebCore::FetchBody::text):
724         (WebCore::FetchBody::extractFromBody):
725         (WebCore::FetchBody::consume):
726         (WebCore::FetchBody::consumeArrayBuffer):
727         (WebCore::FetchBody::processIfEmptyOrDisturbed): Deleted.
728         * Modules/fetch/FetchBody.h:
729         (WebCore::FetchBody::isEmpty): Deleted.
730         * Modules/fetch/FetchBodyOwner.cpp:
731         (WebCore::FetchBodyOwner::arrayBuffer):
732         (WebCore::FetchBodyOwner::blob):
733         (WebCore::FetchBodyOwner::formData):
734         (WebCore::FetchBodyOwner::json):
735         (WebCore::FetchBodyOwner::text):
736         * Modules/fetch/FetchBodyOwner.h:
737         (WebCore::FetchBodyOwner::isDisturbed):
738         (WebCore::FetchBodyOwner::setDisturbed):
739         * Modules/fetch/FetchRequest.cpp:
740         (WebCore::FetchRequest::create):
741         * Modules/fetch/FetchResponse.cpp:
742         (WebCore::FetchResponse::clone):
743
744 2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
745
746         Remove forEach use from Fetch Headers builtin constructor
747         https://bugs.webkit.org/show_bug.cgi?id=155967
748
749         Reviewed by Joseph Pecoraro.
750
751         Tests: fetch/shadowing-forEach.html
752                streams/shadowing-Promise.html
753                streams/shadowing-defineProperty.html
754
755         * Modules/fetch/FetchHeaders.idl: Adding fillFromJS private method.
756         * Modules/fetch/FetchHeaders.js:
757         (initializeFetchHeaders): Using fillFromJS private method. Using
758         instanceof test to check whether parameter is Headers or subclass of it.
759         * bindings/js/WebCoreBuiltinNames.h: Adding fillFromJS private symbol.
760
761 2016-03-30  Alex Christensen  <achristensen@webkit.org>
762
763         Fix Windows build.
764
765         * platform/text/LineEnding.cpp:
766         make the char's and uint8_t's compile.
767
768 2016-03-30  Alex Christensen  <achristensen@webkit.org>
769
770         Build fix.
771
772         * platform/text/LineEnding.cpp:
773
774 2016-03-30  Alex Christensen  <achristensen@webkit.org>
775
776         Fix GTK and Windows builds after r198869.
777
778         * platform/network/soup/ResourceHandleSoup.cpp:
779         (WebCore::blobIsOutOfDate):
780         (WebCore::addEncodedBlobItemToSoupMessageBody):
781         * platform/text/LineEnding.cpp:
782
783 2016-03-30  Simon Fraser  <simon.fraser@apple.com>
784
785         [iOS WK2] Avoid creating tiles that are too large for rendering
786         https://bugs.webkit.org/show_bug.cgi?id=156050
787         rdar://problem/25424541
788
789         Reviewed by Darin Adler.
790
791         In the case of a WKWebView which is sized large enough to show an entire document
792         (for example, when enclosed inside a UIScrollView), we would create tiles that were
793         larger than CoreAnimation was willing to deal with.
794         
795         * platform/graphics/ca/TileController.cpp:
796         (WebCore::TileController::tileSize): Take the device scale, and the max IOSurface size
797         into account when computing the max tile size.
798         * platform/graphics/cocoa/IOSurface.mm:
799         (IOSurface::maximumSize): CoreAnimation imposes limits in addition to the size reported
800         by IOSurfaceGetPropertyMaximum(), namely an 8k cap, so mimic that here.
801         (IOSurface::ensurePlatformContext): Typo.
802
803 2016-03-30  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
804
805         [EFL][CMake] WebKit include path has been added to system include path
806         https://bugs.webkit.org/show_bug.cgi?id=156019
807
808         Reviewed by Darin Adler.
809
810         Fix wrong include path addition.
811
812         * PlatformEfl.cmake:
813
814             Add ${WEBCORE_DIR}/platform/graphics/surfaces/egl to WebCore include directory path.
815
816 2016-03-30  Joanmarie Diggs  <jdiggs@igalia.com>
817
818         AX: Update handling of SVG elements with presentational role
819         https://bugs.webkit.org/show_bug.cgi?id=156042
820
821         Reviewed by Chris Fleizach.
822
823         Because the new expected behavior is to treat SVG elements with a
824         presentational role just like we treat other host language elements
825         with a presentational role, delete AccessibilitySVGElement's
826         determineAriaRoleAttribute().
827
828         No new test files. The expectations for w3c-svg-presentational-role.html
829         were updated because the presentational elements which have global ARIA
830         attributes are now being included in the accessibility tree. In addition,
831         several new test cases were added to this layout test so that we have
832         coverage for more presentational elements which lack global ARIA attributes.
833
834         * accessibility/AccessibilitySVGElement.cpp:
835         (WebCore::AccessibilitySVGElement::determineAriaRoleAttribute): Deleted.
836         * accessibility/AccessibilitySVGElement.h:
837
838 2016-03-30  Brady Eidson  <beidson@apple.com>
839
840         Make BlobData use ThreadSafeSharedBuffer instead of RawData.
841         https://bugs.webkit.org/show_bug.cgi?id=156041
842
843         Reviewed by Alex Christensen.
844
845         No new tests (No change in behavior).
846
847         * Modules/fetch/FetchBody.cpp:
848         (WebCore::FetchBody::consumeText):
849         (WebCore::FetchBody::extractFromText):
850         (WebCore::blobFromArrayBuffer):
851         * Modules/fetch/FetchBody.h:
852         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
853         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData):
854         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
855         * Modules/websockets/WebSocket.cpp:
856         (WebCore::WebSocket::didReceiveBinaryData):
857         * Modules/websockets/WebSocket.h:
858         * Modules/websockets/WebSocketChannel.cpp:
859         (WebCore::WebSocketChannel::processFrame):
860         * Modules/websockets/WebSocketChannel.h:
861         * Modules/websockets/WebSocketChannelClient.h:
862         (WebCore::WebSocketChannelClient::didReceiveBinaryData):
863         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
864         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData):
865         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
866         * fileapi/Blob.cpp:
867         (WebCore::Blob::Blob):
868         * fileapi/Blob.h:
869         (WebCore::Blob::create):
870         * fileapi/WebKitBlobBuilder.h:
871         * platform/network/BlobData.cpp:
872         (WebCore::BlobData::BlobData):
873         (WebCore::BlobDataItem::length):
874         (WebCore::BlobData::appendData):
875         (WebCore::BlobData::setContentType): Deleted.
876         * platform/network/BlobData.h:
877         (WebCore::BlobDataItem::type):
878         (WebCore::BlobDataItem::data):
879         (WebCore::BlobDataItem::file):
880         (WebCore::BlobDataItem::BlobDataItem):
881         (WebCore::BlobData::create):
882         (WebCore::RawData::create): Deleted.
883         (WebCore::RawData::data): Deleted.
884         (WebCore::RawData::length): Deleted.
885         (WebCore::RawData::RawData): Deleted.
886         * platform/network/BlobPart.h:
887         (WebCore::BlobPart::BlobPart):
888         (WebCore::BlobPart::data):
889         (WebCore::BlobPart::moveData):
890         * platform/network/BlobRegistryImpl.cpp:
891         (WebCore::BlobRegistryImpl::appendStorageItems):
892         (WebCore::BlobRegistryImpl::registerFileBlobURL):
893         (WebCore::BlobRegistryImpl::registerBlobURL):
894         (WebCore::BlobRegistryImpl::registerBlobURLForSlice):
895         * platform/network/BlobResourceHandle.cpp:
896         (WebCore::BlobResourceHandle::getSizeForNext):
897         (WebCore::BlobResourceHandle::readSync):
898         (WebCore::BlobResourceHandle::readDataSync):
899         (WebCore::BlobResourceHandle::readFileSync):
900         (WebCore::BlobResourceHandle::readAsync):
901         (WebCore::BlobResourceHandle::readDataAsync):
902         (WebCore::BlobResourceHandle::readFileAsync):
903         * platform/network/BlobResourceHandle.h:
904         * platform/network/FormData.cpp:
905         (WebCore::appendBlobResolved):
906         * platform/network/soup/ResourceHandleSoup.cpp:
907         (WebCore::blobIsOutOfDate):
908         (WebCore::addEncodedBlobItemToSoupMessageBody):
909         * platform/text/LineEnding.cpp:
910         (WebCore::normalizeToCROrLF):
911         (WebCore::normalizeLineEndingsToNative):
912         (WebCore::normalizeLineEndingsToCR): Deleted.
913         (WebCore::normalizeLineEndingsToLF): Deleted.
914         * platform/text/LineEnding.h:
915         * xml/XMLHttpRequest.cpp:
916         (WebCore::XMLHttpRequest::responseBlob):
917
918 2016-03-30  Enrica Casucci  <enrica@apple.com>
919
920         Add a style for Data Detectors links.
921         https://bugs.webkit.org/show_bug.cgi?id=155996
922         rdar://problem/25343514
923
924         Reviewed by Sam Weinig.
925
926         Based on indication from the data detection engine,
927         we style some of the links differently.
928
929         * editing/cocoa/DataDetection.mm:
930         (WebCore::DataDetection::detectContentInRange):
931         * platform/cocoa/DataDetectorsCoreSoftLink.h:
932         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
933
934 2016-03-30  Myles C. Maxfield  <mmaxfield@apple.com>
935
936         [OS X] [RTL Scrollbars] Overlay RTL scrollbars animate in from the wrong side
937         https://bugs.webkit.org/show_bug.cgi?id=155962
938
939         Reviewed by Darin Adler.
940
941         We can control the animation direction with the NSScrollerImp property
942         userInterfaceLayoutDirection.
943
944         This patch also adds an Internals function to set whether or not we
945         should mock the scrollbars. Not mocking the scrollbars is required
946         to use NSScrollerImps.
947
948         Test: fast/scrolling/rtl-scrollbars-animation-property.html
949
950         * platform/ScrollableArea.h: Use nullptr instead of 0.
951         (WebCore::ScrollableArea::horizontalScrollbar):
952         (WebCore::ScrollableArea::verticalScrollbar):
953         (WebCore::ScrollableArea::tiledBacking):
954         (WebCore::ScrollableArea::layerForHorizontalScrollbar):
955         (WebCore::ScrollableArea::layerForVerticalScrollbar):
956         (WebCore::ScrollableArea::layerForScrolling):
957         (WebCore::ScrollableArea::layerForScrollCorner):
958         (WebCore::ScrollableArea::layerForOverhangAreas):
959         * platform/mac/ScrollAnimatorMac.mm:
960         (WebCore::ScrollAnimatorMac::updateScrollerStyle): Set the direction
961         of the new NSScrollerImps.
962         * platform/mac/ScrollbarThemeMac.h:
963         * platform/mac/ScrollbarThemeMac.mm:
964         (WebCore::ScrollbarThemeMac::didCreateScrollerImp): Set the direction
965         of an NSScrollerImp.
966         (WebCore::ScrollbarThemeMac::registerScrollbar): Call
967         didCreateScrollerImp().
968         (WebCore::ScrollbarThemeMac::isLayoutDirectionRTL): Used for testing,
969         to tell if the scroller's direction is RTL.
970         * platform/spi/mac/NSScrollerImpSPI.h:
971         * rendering/RenderTreeAsText.cpp:
972         (WebCore::write):
973         * testing/Internals.cpp:
974         (WebCore::Internals::setMockScrollbarsEnabled): Used for testing.
975         * testing/Internals.h:
976         * testing/Internals.idl:
977
978 2016-03-30  Sam Weinig  <sam@webkit.org>
979
980         -webkit-text-underline-position: under; does not work in ToT
981         https://bugs.webkit.org/show_bug.cgi?id=156038
982
983         Reviewed by David Hyatt.
984
985         Test: fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-vs-alphabetic.html
986
987         * style/InlineTextBoxStyle.cpp:
988         (WebCore::computeUnderlineOffset):
989         Only resolve the underline position when based on the InlineTextBox when it is specified as auto.
990
991 2016-03-30  Alex Christensen  <achristensen@webkit.org>
992
993         Fix Windows EWS after r198766
994         https://bugs.webkit.org/show_bug.cgi?id=156029
995
996         Reviewed by Brent Fulgham.
997
998         * CMakeLists.txt:
999         * PlatformWin.cmake:
1000         Copy headers before compiling WebCoreDerivedSources, not just before compiling WebCore.
1001
1002 2016-03-30  Brady Eidson  <beidson@apple.com>
1003
1004         Random SerializedScriptValue cleanup.
1005         https://bugs.webkit.org/show_bug.cgi?id=156032
1006
1007         Rubberstamped by Tim Hatcher.
1008
1009         - Remove two unused functions.
1010         - Make the class always be ThreadSafeRefCounted.
1011
1012         * bindings/js/SerializedScriptValue.cpp:
1013         (WebCore::SerializedScriptValue::numberValue): Deleted.
1014         (WebCore::SerializedScriptValue::undefinedValue): Deleted.
1015         * bindings/js/SerializedScriptValue.h:
1016
1017 2016-03-30  Brent Fulgham  <bfulgham@apple.com>
1018
1019         Avoid WebCore-prefixed paths when building WebCore
1020         https://bugs.webkit.org/show_bug.cgi?id=156027
1021
1022         Reviewed by David Kilzer.
1023
1024         Replace instances of '#include <WebCore/XXXYYY.h>"' with the normal
1025         '#include "XXXYYY.h"' for files inside WebCore.
1026
1027         * config.h:
1028         * inspector/InspectorTimelineAgent.cpp:
1029         * page/ViewportConfiguration.cpp:
1030         * platform/audio/ios/AudioDestinationIOS.cpp:
1031         * platform/cocoa/WebVideoFullscreenModel.h:
1032         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
1033         * platform/graphics/Font.h:
1034         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
1035         * platform/graphics/cg/ColorCG.cpp:
1036         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1037         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1038         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
1039
1040 2016-03-30  Said Abou-Hallawa  <sabouhallawa@apple,com>
1041
1042         Move the CG ImageDecoder class from ImageSourceCG.cpp to ImageDecoderCG.h and .cpp
1043         https://bugs.webkit.org/show_bug.cgi?id=155980
1044
1045         Reviewed by Simon Fraser.
1046
1047         After this step, ImageSource.cpp and ImageSourceCG.cpp look very similar
1048         so they can be merged in one file. All the redundant code in these two files
1049         can be removed.
1050
1051         * PlatformAppleWin.cmake:
1052         * PlatformMac.cmake:
1053         * WebCore.xcodeproj/project.pbxproj:
1054         * platform/graphics/cg/ImageDecoderCG.cpp: Copied from Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp.
1055         (WebCore::createImageSourceOptions):
1056         (WebCore::imageSourceOptions):
1057         (WebCore::orientationFromProperties):
1058         (WebCore::sharedBufferGetBytesAtPosition):
1059         (WebCore::sharedBufferRelease):
1060         (WebCore::ImageDecoder::ImageDecoder):
1061         (WebCore::ImageDecoder::subsamplingLevelForScale):
1062         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties):
1063         (WebCore::ImageDecoder::filenameExtension):
1064         (WebCore::ImageDecoder::isSizeAvailable):
1065         (WebCore::ImageDecoder::size):
1066         (WebCore::ImageDecoder::frameCount):
1067         (WebCore::ImageDecoder::repetitionCount):
1068         (WebCore::ImageDecoder::hotSpot):
1069         (WebCore::ImageDecoder::frameSizeAtIndex):
1070         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
1071         (WebCore::ImageDecoder::orientationAtIndex):
1072         (WebCore::ImageDecoder::frameDurationAtIndex):
1073         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex):
1074         (WebCore::ImageDecoder::frameHasAlphaAtIndex):
1075         (WebCore::ImageDecoder::frameBytesAtIndex):
1076         (WebCore::ImageDecoder::createFrameImageAtIndex):
1077         (WebCore::ImageDecoder::setData):
1078         * platform/graphics/cg/ImageDecoderCG.h: Added.
1079         (WebCore::ImageDecoder::create):
1080         * platform/graphics/cg/ImageSourceCG.cpp:
1081         (WebCore::ImageDecoder::create): Deleted.
1082         (WebCore::createImageSourceOptions): Deleted.
1083         (WebCore::imageSourceOptions): Deleted.
1084         (WebCore::orientationFromProperties): Deleted.
1085         (WebCore::sharedBufferGetBytesAtPosition): Deleted.
1086         (WebCore::sharedBufferRelease): Deleted.
1087         (WebCore::ImageDecoder::ImageDecoder): Deleted.
1088         (WebCore::ImageDecoder::subsamplingLevelForScale): Deleted.
1089         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties): Deleted.
1090         (WebCore::ImageDecoder::filenameExtension): Deleted.
1091         (WebCore::ImageDecoder::isSizeAvailable): Deleted.
1092         (WebCore::ImageDecoder::size): Deleted.
1093         (WebCore::ImageDecoder::frameCount): Deleted.
1094         (WebCore::ImageDecoder::repetitionCount): Deleted.
1095         (WebCore::ImageDecoder::hotSpot): Deleted.
1096         (WebCore::ImageDecoder::frameSizeAtIndex): Deleted.
1097         (WebCore::ImageDecoder::frameIsCompleteAtIndex): Deleted.
1098         (WebCore::ImageDecoder::orientationAtIndex): Deleted.
1099         (WebCore::ImageDecoder::frameDurationAtIndex): Deleted.
1100         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex): Deleted.
1101         (WebCore::ImageDecoder::frameHasAlphaAtIndex): Deleted.
1102         (WebCore::ImageDecoder::frameBytesAtIndex): Deleted.
1103         (WebCore::ImageDecoder::createFrameImageAtIndex): Deleted.
1104         (WebCore::ImageDecoder::setData): Deleted.
1105
1106 2016-03-30  Per Arne Vollan  <peavo@outlook.com>
1107
1108         [WinCairo][MediaFoundation] Video size is not always set.
1109         https://bugs.webkit.org/show_bug.cgi?id=156020
1110
1111         Reviewed by Darin Adler.
1112
1113         Getting the video display control object from the media session might fail the first time.
1114         In case it fails, we should try again when setting the video size.
1115
1116         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1117         (WebCore::MediaPlayerPrivateMediaFoundation::setSize):
1118         (WebCore::MediaPlayerPrivateMediaFoundation::getVideoDisplay):
1119         (WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet):
1120         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1121
1122 2016-03-30  Commit Queue  <commit-queue@webkit.org>
1123
1124         Unreviewed, rolling out r198828.
1125         https://bugs.webkit.org/show_bug.cgi?id=156030
1126
1127         Confirming PLT regression (Requested by anttik on #webkit).
1128
1129         Reverted changeset:
1130
1131         "Separate render tree updating from style resolve"
1132         https://bugs.webkit.org/show_bug.cgi?id=155298
1133         http://trac.webkit.org/changeset/198828
1134
1135 2016-03-30  Keith Miller <keith_miller@apple.com>
1136
1137         Unreviewed, rollout r198808. The patch causes crashes on 32-bit and appears to be a JSBench regression.
1138
1139 2016-03-30  Myles C. Maxfield  <mmaxfield@apple.com>
1140
1141         [OS X] [RTL Scrollbars] List boxes should obey RTL scrollbars
1142         https://bugs.webkit.org/show_bug.cgi?id=155991
1143
1144         Reviewed by Darin Adler.
1145
1146         List boxes were created before RenderLayers, and therefore don't share
1147         the scollbar logic with them. Instead, they manage their own Scrollbars.
1148         The placement logic needs to be updated to take RTL scrollbars into
1149         account.
1150
1151         Tests: fast/scrolling/rtl-scrollbars-listbox-scroll.html
1152                fast/scrolling/rtl-scrollbars-listbox-select-left.html
1153                fast/scrolling/rtl-scrollbars-listbox-select-right.html
1154                fast/scrolling/rtl-scrollbars-listbox-simple.html
1155                fast/scrolling/rtl-scrollbars-listbox.html
1156
1157         * rendering/RenderBox.cpp:
1158         (WebCore::RenderBox::contentBoxRect):
1159         * rendering/RenderBox.h:
1160         (WebCore::RenderBox::contentBoxRect): Deleted.
1161         * rendering/RenderListBox.cpp:
1162         (WebCore::RenderListBox::itemBoundingBoxRect):
1163         (WebCore::RenderListBox::paintScrollbar):
1164         (WebCore::RenderListBox::paintItemBackground):
1165         (WebCore::RenderListBox::isPointInOverflowControl):
1166         (WebCore::RenderListBox::listIndexAtOffset):
1167         (WebCore::RenderListBox::nodeAtPoint):
1168         (WebCore::RenderListBox::controlClipRect):
1169         (WebCore::RenderListBox::invalidateScrollbarRect):
1170         (WebCore::RenderListBox::convertFromScrollbarToContainingView):
1171         (WebCore::RenderListBox::convertFromContainingViewToScrollbar):
1172         (WebCore::RenderListBox::scrolledToTop):
1173         (WebCore::RenderListBox::scrolledToBottom):
1174
1175 2016-03-30  Myles C. Maxfield  <mmaxfield@apple.com>
1176
1177         Use references instead of pointers in scrollbar-related code
1178         https://bugs.webkit.org/show_bug.cgi?id=155998
1179
1180         Reviewed by Dean Jackson.
1181
1182         Migrate pointers to references.
1183
1184         No new tests because there is no behavior change.
1185
1186         * page/FrameView.cpp:
1187         (WebCore::FrameView::invalidateScrollbarRect):
1188         (WebCore::FrameView::setVisibleScrollerThumbRect):
1189         * page/FrameView.h:
1190         * platform/ScrollView.cpp:
1191         (WebCore::ScrollView::convertFromScrollbarToContainingView):
1192         (WebCore::ScrollView::convertFromContainingViewToScrollbar):
1193         * platform/ScrollView.h:
1194         * platform/ScrollableArea.cpp:
1195         (WebCore::ScrollableArea::invalidateScrollbar):
1196         * platform/ScrollableArea.h:
1197         (WebCore::ScrollableArea::convertFromScrollbarToContainingView):
1198         (WebCore::ScrollableArea::convertFromContainingViewToScrollbar):
1199         * platform/Scrollbar.cpp:
1200         (WebCore::Scrollbar::invalidateRect):
1201         (WebCore::Scrollbar::convertToContainingView):
1202         (WebCore::Scrollbar::convertFromContainingView):
1203         * rendering/RenderLayer.cpp:
1204         (WebCore::RenderLayer::convertFromScrollbarToContainingView):
1205         (WebCore::RenderLayer::convertFromContainingViewToScrollbar):
1206         (WebCore::RenderLayer::scrollbarOffset):
1207         (WebCore::RenderLayer::invalidateScrollbarRect):
1208         * rendering/RenderLayer.h:
1209         * rendering/RenderLayerCompositor.cpp:
1210         (WebCore::RenderLayerCompositor::destroyRootLayer):
1211         * rendering/RenderListBox.cpp:
1212         (WebCore::RenderListBox::invalidateScrollbarRect):
1213         (WebCore::RenderListBox::convertFromScrollbarToContainingView):
1214         (WebCore::RenderListBox::convertFromContainingViewToScrollbar):
1215         * rendering/RenderListBox.h:
1216         * platform/win/PopupMenuWin.cpp:
1217         (WebCore::RenderListBox::invalidateScrollbarRect):
1218         * platform/win/PopupMenuWin.h:
1219
1220 2016-03-24  Simon Fraser  <simon.fraser@apple.com>
1221
1222         Make animation events non-cancelable
1223         https://bugs.webkit.org/show_bug.cgi?id=78110
1224
1225         Reviewed by Dan Bates.
1226
1227         Make the animation events non-cancelable.
1228
1229         Test: animations/animation-events-not-cancelable.html
1230
1231         * dom/AnimationEvent.cpp:
1232         (WebCore::AnimationEvent::AnimationEvent):
1233
1234 2016-03-30  Manuel Rego Casasnovas  <rego@igalia.com>
1235
1236         [css-grid] Refactor positioned children code
1237         https://bugs.webkit.org/show_bug.cgi?id=155972
1238
1239         Reviewed by Sergio Villar Senin.
1240
1241         This is a refactoring of RenderGrid::offsetAndBreadthForPositionedChild()
1242         in order to calculate offset and breadth in a more clean way.
1243         Hopefully making the code easier to follow.
1244
1245         Thanks to the refactoring, now positioned children in RTL
1246         are working fine if they use the static inline position
1247         (when "left" and "right" properties are both "auto").
1248
1249         The other case (not having a static inline position)
1250         will be fixed in a separated patch.
1251
1252         * rendering/RenderGrid.cpp:
1253         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1254
1255 2016-03-30  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1256
1257         Binding generator should allow passing DOM objects parameters as references
1258         https://bugs.webkit.org/show_bug.cgi?id=155953
1259
1260         Reviewed by Alex Christensen.
1261
1262         Updating binding generator to pass DOM object parameters as references.
1263         Introducing UsePointersEvenForNonNullableObjectArguments to disable that change.
1264
1265         Updating FetchRequest.idl and DOMWindowFetch.idl to pass parameters as references.
1266
1267         Updated other IDL interfaces to keep passing DOM object parameters as pointers.
1268         This should not change the behavior for these interfaces.
1269         UsePointersEvenForNonNullableObjectArguments should be progressively removed on those interfaces.
1270
1271         Binding generator tests covered by rebased binding tests.
1272
1273         * Modules/encryptedmedia/MediaKeySession.idl:
1274         * Modules/encryptedmedia/MediaKeys.idl:
1275         * Modules/fetch/DOMWindowFetch.cpp:
1276         (WebCore::DOMWindowFetch::fetch):
1277         * Modules/fetch/DOMWindowFetch.h:
1278         * Modules/fetch/DOMWindowFetch.idl:
1279         * Modules/fetch/FetchRequest.cpp:
1280         (WebCore::FetchRequest::create):
1281         * Modules/fetch/FetchRequest.h:
1282         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
1283         (WebCore::WorkerGlobalScopeFetch::fetch):
1284         * Modules/fetch/WorkerGlobalScopeFetch.h:
1285         * Modules/mediacontrols/MediaControlsHost.idl:
1286         * Modules/mediasource/MediaSource.idl:
1287         * Modules/mediasource/SourceBuffer.idl:
1288         * Modules/mediastream/MediaStream.idl:
1289         * Modules/speech/SpeechSynthesis.idl:
1290         * Modules/webaudio/AudioContext.idl:
1291         * Modules/webaudio/OscillatorNode.idl:
1292         * Modules/websockets/WebSocket.idl:
1293         * bindings/scripts/CodeGeneratorJS.pm:
1294         (GenerateParametersCheck):
1295         (IsParameterPassedByReference):
1296         (GenerateConstructorDefinition):
1297         * bindings/scripts/IDLAttributes.txt:
1298         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1299         (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
1300         * bindings/scripts/test/JS/JSTestInterface.cpp:
1301         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
1302         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
1303         * bindings/scripts/test/JS/JSTestObj.cpp:
1304         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
1305         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
1306         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
1307         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
1308         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
1309         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
1310         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
1311         (WebCore::jsTestObjPrototypeFunctionConvert1):
1312         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
1313         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
1314         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1315         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
1316         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue):
1317         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
1318         (WebCore::jsTestObjPrototypeFunctionGetSVGDocument):
1319         (WebCore::jsTestObjPrototypeFunctionStrictFunction):
1320         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
1321         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1322         (WebCore::constructJSTestOverloadedConstructors1):
1323         (WebCore::constructJSTestOverloadedConstructors3):
1324         * css/FontFaceSet.idl:
1325         * css/WebKitCSSMatrix.idl:
1326         * dom/CompositionEvent.idl:
1327         * dom/DataTransfer.idl:
1328         * dom/Document.idl:
1329         * dom/Element.idl:
1330         * dom/EventTarget.idl:
1331         * dom/KeyboardEvent.idl:
1332         * dom/MouseEvent.idl:
1333         * dom/MutationEvent.idl:
1334         * dom/MutationObserver.idl:
1335         * dom/NamedNodeMap.idl:
1336         * dom/Node.idl:
1337         * dom/Range.idl:
1338         * dom/TextEvent.idl:
1339         * dom/TouchEvent.idl:
1340         * dom/UIEvent.idl:
1341         * dom/WebKitNamedFlow.idl:
1342         * dom/WheelEvent.idl:
1343         * fileapi/FileReader.idl:
1344         * fileapi/FileReaderSync.idl:
1345         * html/DOMURL.idl:
1346         * html/HTMLElement.idl:
1347         * html/HTMLMediaElement.idl:
1348         * html/HTMLOptionsCollection.idl:
1349         * html/HTMLSelectElement.idl:
1350         * html/canvas/CanvasRenderingContext2D.idl:
1351         * html/canvas/DOMPath.idl:
1352         * html/canvas/OESVertexArrayObject.idl:
1353         * html/canvas/WebGLDebugShaders.idl:
1354         * html/canvas/WebGLRenderingContext.idl:
1355         * html/canvas/WebGLRenderingContextBase.idl:
1356         * html/track/TextTrack.idl:
1357         * inspector/InspectorFrontendHost.idl:
1358         * page/DOMSelection.idl:
1359         * storage/StorageEvent.idl:
1360         * svg/SVGGraphicsElement.idl:
1361         * svg/SVGLengthList.idl:
1362         * svg/SVGNumberList.idl:
1363         * svg/SVGPathSegList.idl:
1364         * svg/SVGPointList.idl:
1365         * svg/SVGSVGElement.idl:
1366         * svg/SVGTransformList.idl:
1367         * testing/Internals.idl:
1368         * xml/XMLSerializer.idl:
1369         * xml/XPathEvaluator.idl:
1370         * xml/XPathExpression.idl:
1371         * xml/XSLTProcessor.idl:
1372
1373 2016-03-29  Joonghun Park  <jh718.park@samsung.com>
1374
1375         [EFL] Fix build break since r198800. Unreviewed.
1376         https://bugs.webkit.org/show_bug.cgi?id=156011
1377
1378         Currently libWebCoreDerivedSources.a cannot see the symbol located in WebCore Source files.
1379         This patch let the library can see the symbols of WebCore Sources.
1380
1381         * PlatformEfl.cmake:
1382
1383 2016-03-26  Antti Koivisto  <antti@apple.com>
1384
1385         Separate render tree updating from style resolve
1386         https://bugs.webkit.org/show_bug.cgi?id=155298
1387
1388         Reviewed by Andreas Kling.
1389
1390         This patch splits computing document style and applying the results into two distinct steps:
1391
1392         Style::TreeResolver::resolve()
1393                 |
1394                 | Style::Update
1395                 V
1396         RenderTreeUpdater::commit()
1397
1398         Style::TreeResolver::resolve() returns a Style::Update object that contains all the changes to be made
1399         for the whole composed tree. RenderTreeUpdater then applies the changes updating, building or tearing
1400         down portions of the render tree as needed.
1401
1402         Style::Update consists of a map that contains new style for each newly resolved element along with some
1403         metadata. A separate map contains text nodes that require reconstruction. It also tracks change roots so
1404         RenderTreeUpdater needs to traverse the changed subtrees only.
1405
1406         The patch eliminates the recursive render tree build code path replacing it with iterative functions.
1407
1408         This will enable future optimizations. For example we won't need to commit to immediate rendering
1409         changes simply because some script or internal function requires up-to-date style.
1410
1411         * CMakeLists.txt:
1412         * WebCore.xcodeproj/project.pbxproj:
1413         * css/StyleResolver.cpp:
1414         (WebCore::StyleResolver::State::State):
1415         (WebCore::StyleResolver::styleForElement):
1416         * css/StyleResolver.h:
1417         (WebCore::StyleResolver::setOverrideDocumentElementStyle):
1418         (WebCore::StyleResolver::State::State):
1419
1420             Root element style is needed for resolving other elements. Add a way to provide it without looking
1421             into active document style.
1422
1423         * dom/Document.cpp:
1424         (WebCore::Document::recalcStyle):
1425
1426             Resolve the document style and commit it immediately (for now).
1427
1428         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
1429         * dom/Document.h:
1430         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
1431         (WebCore::Document::inStyleRecalc):
1432         (WebCore::Document::inRenderTreeUpdate):
1433         * dom/Element.cpp:
1434         (WebCore::Element::setChildIndex):
1435
1436             Setting the unique bit is now done by style relations update code.
1437
1438         * dom/Node.cpp:
1439         (WebCore::Node::setNeedsStyleRecalc):
1440
1441             Prevent spurious style invalidation during render tree updating.
1442
1443         * rendering/RenderBox.cpp:
1444         (WebCore::RenderBox::styleDidChange):
1445
1446             Capturing body element color for color:-webkit-text is now done by TreeResolver.
1447
1448         * rendering/RenderElement.h:
1449         (WebCore::RenderElement::setAnimatableStyle): Deleted.
1450
1451             No longer used.
1452
1453         * style/RenderTreePosition.cpp:
1454         (WebCore::RenderTreePosition::nextSiblingRenderer):
1455
1456             Skip over non-rendered slot elements.
1457
1458         * style/RenderTreeUpdater.cpp: Added.
1459         (WebCore::RenderTreeUpdater::Parent::Parent):
1460         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
1461         (WebCore::hasDisplayContents):
1462         (WebCore::findRenderingRoot):
1463         (WebCore::RenderTreeUpdater::commit):
1464
1465             Call updateRenderTree for each change root.
1466
1467         (WebCore::shouldCreateRenderer):
1468         (WebCore::RenderTreeUpdater::updateRenderTree):
1469
1470             Iteratively traverse the composed tree starting for a change root.
1471             Apply the changes calling updateElementRenderer and updateTextRenderer as needed.
1472             Enter subtrees that haves changes to apply.
1473
1474         (WebCore::RenderTreeUpdater::renderTreePosition):
1475
1476             We may not create renderers for all elements (<slot> or more generally display:contents) that
1477             have rendered descendants. Search the parent stack to find the valid position.
1478
1479         (WebCore::RenderTreeUpdater::pushParent):
1480         (WebCore::RenderTreeUpdater::popParent):
1481         (WebCore::RenderTreeUpdater::popParentsToDepth):
1482
1483             Maintain parent stack.
1484
1485         (WebCore::pseudoStyleCacheIsInvalid):
1486         (WebCore::RenderTreeUpdater::updateElementRenderer):
1487
1488             Create, delete or update the renderer.
1489
1490         (WebCore::moveToFlowThreadIfNeeded):
1491         (WebCore::RenderTreeUpdater::createRenderer):
1492         (WebCore::textRendererIsNeeded):
1493         (WebCore::createTextRenderer):
1494         (WebCore::RenderTreeUpdater::updateTextRenderer):
1495         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
1496
1497             This is moved from TreeResolver.
1498
1499         (WebCore::needsPseudoElement):
1500         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
1501
1502             Pseudo elements are handled entirely during render tree construction. Compute their style and
1503             create or delete them as needed.
1504
1505         * style/RenderTreeUpdater.h: Added.
1506         (WebCore::RenderTreeUpdater::parent):
1507         * style/StyleRelations.cpp:
1508         (WebCore::Style::commitRelationsToRenderStyle):
1509         (WebCore::Style::commitRelations):
1510
1511             Commit to Style::Update instead of the document if needed.
1512
1513         (WebCore::Style::commitRelationsToDocument): Deleted.
1514         * style/StyleRelations.h:
1515         * style/StyleSharingResolver.cpp:
1516         (WebCore::Style::elementHasDirectionAuto):
1517         (WebCore::Style::SharingResolver::resolve):
1518
1519             Fetch the shareable style from Style::Update instead of the active document style.
1520
1521         (WebCore::Style::SharingResolver::findSibling):
1522         (WebCore::Style::SharingResolver::canShareStyleWithElement):
1523         * style/StyleSharingResolver.h:
1524         * style/StyleTreeResolver.cpp:
1525         (WebCore::Style::TreeResolver::Parent::Parent):
1526
1527             No need for render tree position anymore.
1528
1529         (WebCore::Style::TreeResolver::popScope):
1530         (WebCore::Style::TreeResolver::styleForElement):
1531         (WebCore::Style::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
1532         (WebCore::Style::createTextRendererIfNeeded):
1533         (WebCore::Style::updateTextRendererAfterContentChange):
1534         (WebCore::Style::resetStyleForNonRenderedDescendants):
1535         (WebCore::Style::detachChildren):
1536         (WebCore::Style::detachSlotAssignees):
1537         (WebCore::Style::detachRenderTree):
1538         (WebCore::Style::TreeResolver::resolveElement):
1539
1540             Just resolve the style and return it, no more applying or entering render tree construction code paths.
1541
1542         (WebCore::Style::resolveTextNode):
1543         (WebCore::Style::elementImplicitVisibility):
1544         (WebCore::Style::TreeResolver::pushParent):
1545         (WebCore::Style::TreeResolver::popParent):
1546         (WebCore::Style::TreeResolver::popParentsToDepth):
1547         (WebCore::Style::shouldResolvePseudoElement):
1548         (WebCore::Style::TreeResolver::resolveComposedTree):
1549
1550             Add style changes to Style::Update.
1551
1552         (WebCore::Style::TreeResolver::resolve):
1553
1554             Return Style::Update object if non-empty.
1555
1556         (WebCore::Style::postResolutionCallbackQueue):
1557         (WebCore::Style::shouldCreateRenderer): Deleted.
1558         (WebCore::Style::moveToFlowThreadIfNeeded): Deleted.
1559         (WebCore::Style::TreeResolver::createRenderer): Deleted.
1560         (WebCore::Style::TreeResolver::createRenderTreeForChildren): Deleted.
1561         (WebCore::Style::TreeResolver::createRenderTreeForShadowRoot): Deleted.
1562         (WebCore::Style::beforeOrAfterPseudoElement): Deleted.
1563         (WebCore::Style::setBeforeOrAfterPseudoElement): Deleted.
1564         (WebCore::Style::clearBeforeOrAfterPseudoElement): Deleted.
1565         (WebCore::Style::needsPseudoElement): Deleted.
1566         (WebCore::Style::TreeResolver::createRenderTreeForBeforeOrAfterPseudoElement): Deleted.
1567         (WebCore::Style::TreeResolver::createRenderTreeForSlotAssignees): Deleted.
1568         (WebCore::Style::TreeResolver::createRenderTreeRecursively): Deleted.
1569         (WebCore::Style::pseudoStyleCacheIsInvalid): Deleted.
1570         (WebCore::Style::TreeResolver::resolveBeforeOrAfterPseudoElement): Deleted.
1571
1572             Remove the recursive render tree building code path.
1573
1574         * style/StyleTreeResolver.h:
1575         (WebCore::Style::TreeResolver::scope):
1576         * style/StyleUpdate.cpp: Added.
1577         (WebCore::Style::Update::Update):
1578         (WebCore::Style::Update::elementUpdate):
1579         (WebCore::Style::Update::textUpdate):
1580         (WebCore::Style::Update::elementStyle):
1581         (WebCore::Style::Update::addElement):
1582         (WebCore::Style::Update::addText):
1583         (WebCore::Style::Update::addPossibleRoot):
1584         * style/StyleUpdate.h: Added.
1585         (WebCore::Style::Update::roots):
1586         (WebCore::Style::Update::document):
1587         * svg/SVGElement.h:
1588         (WebCore::SVGElement::updateRelativeLengthsInformation):
1589         * svg/SVGUseElement.cpp:
1590         (WebCore::SVGUseElement::svgAttributeChanged):
1591         (WebCore::SVGUseElement::willRecalcStyle):
1592         (WebCore::SVGUseElement::willAttachRenderers): Deleted.
1593
1594             Switch willAttachRenderers to willRecalcStyle as the former is now called too late.
1595
1596         * svg/SVGUseElement.h:
1597
1598 2016-03-29  Nan Wang  <n_wang@apple.com>
1599
1600         AX: VoiceOver not announcing the right header information for table on iOS
1601         https://bugs.webkit.org/show_bug.cgi?id=155907
1602
1603         Reviewed by Chris Fleizach.
1604
1605         Make sure we consider the case where header elements size does not equal to
1606         row size.
1607
1608         Test: accessibility/ios-simulator/table-row-column-headers.html
1609
1610         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1611         (-[WebAccessibilityObjectWrapper accessibilityHeaderElements]):
1612
1613 2016-03-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
1614
1615         REGRESSION (r198782): CGImageSourceUpdateData() is called twice with the same data every time ImageSource::setData() is called
1616         https://bugs.webkit.org/show_bug.cgi?id=155997
1617
1618         Reviewed by Simon Fraser.
1619
1620         Remove a call to CGImageSourceUpdateData() which was mistakenly left in
1621         ImageDecoder::setData() after ImageSource refactoring.
1622
1623         * platform/graphics/cg/ImageSourceCG.cpp:
1624         (WebCore::ImageDecoder::setData):
1625
1626 2016-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1627
1628         REGRESSION(r198784) Shouldn't add platform-dependent code to ScrollableArea.h
1629         https://bugs.webkit.org/show_bug.cgi?id=155999
1630
1631         Rolling out the patch.
1632
1633         * platform/ScrollableArea.h:
1634         (WebCore::ScrollableArea::horizontalScrollbar):
1635         (WebCore::ScrollableArea::verticalScrollbar):
1636         (WebCore::ScrollableArea::tiledBacking):
1637         (WebCore::ScrollableArea::layerForHorizontalScrollbar):
1638         (WebCore::ScrollableArea::layerForVerticalScrollbar):
1639         (WebCore::ScrollableArea::layerForScrolling):
1640         (WebCore::ScrollableArea::layerForScrollCorner):
1641         (WebCore::ScrollableArea::layerForOverhangAreas):
1642         * platform/mac/ScrollAnimatorMac.mm:
1643         (WebCore::ScrollAnimatorMac::updateScrollerStyle): Deleted.
1644         * platform/mac/ScrollableAreaMac.mm:
1645         (WebCore::ScrollableArea::setScrollbarLayoutDirection): Deleted.
1646         * platform/mac/ScrollbarThemeMac.mm:
1647         (WebCore::ScrollbarThemeMac::registerScrollbar): Deleted.
1648         * platform/spi/mac/NSScrollerImpSPI.h:
1649
1650 2016-03-29  Alex Christensen  <achristensen@webkit.org>
1651
1652         Fix Windows clean build.
1653
1654         * CMakeLists.txt:
1655         Make sure WebCoreDerivedSources is done building before building WebCore.
1656
1657 2016-03-29  Keith Miller  <keith_miller@apple.com>
1658
1659         [ES6] Add support for Symbol.isConcatSpreadable.
1660         https://bugs.webkit.org/show_bug.cgi?id=155351
1661
1662         Reviewed by Saam Barati.
1663
1664         Makes runtime arrays have the new ArrayType
1665
1666         * bridge/runtime_array.h:
1667         (JSC::RuntimeArray::createStructure):
1668
1669 2016-03-29  Nan Wang  <n_wang@apple.com>
1670
1671         AX: VoiceOver: Navigating Numbered Lists Causes Number to be announced On Each Line of List
1672         https://bugs.webkit.org/show_bug.cgi?id=155984
1673
1674         Reviewed by Chris Fleizach.
1675
1676         We should limit the list marker text only to the first line of that list item.
1677
1678         Test: accessibility/mac/attributed-string-with-listitem-multiple-lines.html
1679
1680         * accessibility/AccessibilityObject.cpp:
1681         (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
1682         (WebCore::AccessibilityObject::stringForRange):
1683
1684 2016-03-29  Antonio Gomes  <tonikitoo@webkit.org>
1685
1686         Wheel events' latching state is not reset when appropriate
1687         https://bugs.webkit.org/show_bug.cgi?id=155746
1688
1689         Reviewed by Simon Fraser.
1690
1691         When one performs a two fingers scroll (with trackpad),
1692         it might either trigger a kinetic scroll movement (by
1693         flickering with both fingers in a given direction) or perform
1694         a static scroll movement (without the flicker animation).
1695
1696         In case of the first scenario (kinetic), the container being
1697         scrolled is "latched" during the scroll animation and properly unlatched
1698         once the scroll ends. See the call to 'shouldResetLatching' in EventHandlerMac.mm.
1699         When transitioning from non-momentum to momentum scroll, the following events are seen:
1700         - 'phase PlatformWheelEventPhaseEnded' 'momentumPhase PlatformWheelEventPhaseNone' -> end of static scroll
1701         - 'phase PlatformWheelEventPhaseNone' 'momentumPhase PlatformWheelEventPhaseBegan' -> start of momentum scroll
1702
1703         On the second scenario (static scroll), when the scroll movement ends,
1704         the latched state is not reset. This might actually cause scrolling elsewhere on the page to scroll
1705         the previously latched container.
1706         Note that, only specific wheel event below is fired when static scroll ends:
1707         - 'phase PlatformWheelEventPhaseEnded' 'momentumPhase PlatformWheelEventPhaseNone'
1708
1709         In order to fix this, patch installs a timer as soon as a non-momentum
1710         wheel scroll event end fires. It works as follows:
1711
1712         - If the timer fires, the latched state is reset, preventing scrolling getting stuck to
1713         a previously latched scrollable.
1714         - If platform code starts sending momentum wheel scroll events before it times out, the timer is
1715         stopped and the latched state remains untouched (this is a flick scroll case).
1716         - If a new wheel scroll gesture starts, the latched state is manually reset
1717         and the timer stopped.
1718
1719         Note that given that latched state logic applies primarily to main frames,
1720         the timer only gets manipulated for main frame objects.
1721
1722         Test: tiled-drawing/scrolling/scroll-iframe-latched-selects.html
1723
1724         * page/EventHandler.cpp:
1725         (WebCore::EventHandler::doOrScheduleClearLatchedStateIfNeeded):
1726         * page/EventHandler.h:
1727         * page/MainFrame.cpp:
1728         (WebCore::MainFrame::MainFrame):
1729         (WebCore::MainFrame::~MainFrame):
1730         * page/MainFrame.h:
1731         * page/mac/EventHandlerMac.mm:
1732         (WebCore::scrollableAreaForContainerNode):
1733         (WebCore::latchedToFrameOrBody):
1734         (WebCore::areWheelEventsTransitioningToMomentumScrolling):
1735         (WebCore::areWheelEventsEndingNonMomentumScrolling):
1736         (WebCore::EventHandler::doOrScheduleClearLatchedStateIfNeeded):
1737
1738 2016-03-29  Alex Christensen  <achristensen@webkit.org>
1739
1740         Fix Windows build.
1741
1742         * CMakeLists.txt:
1743
1744 2016-03-29  Alex Christensen  <achristensen@webkit.org>
1745
1746         Windows build fix.
1747
1748         * CMakeLists.txt:
1749         DerivedSources.cpp should be in WebCore_DERIVED_SOURCES because it depends on the derived sources.
1750
1751 2016-03-29  Alex Christensen  <achristensen@webkit.org>
1752
1753         Fix Windows build after r198777
1754
1755         * CMakeLists.txt:
1756         * PlatformEfl.cmake:
1757         WebCore_DERIVED_SOURCES should not be in WebCore_SOURCES.  If it's needed for EFL,
1758         then keep it in the EFL-specific platform.
1759         * PlatformWin.cmake:
1760         Make more derived sources in WebCore_DERIVED_SOURCES.
1761
1762 2016-03-29  Saam barati  <sbarati@apple.com>
1763
1764         Allow builtin JS functions to be intrinsics
1765         https://bugs.webkit.org/show_bug.cgi?id=155960
1766
1767         Reviewed by Mark Lam.
1768
1769         * ForwardingHeaders/runtime/Intrinsic.h: Added.
1770
1771 2016-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1772
1773         [Cocoa] Rename ScrollbarPainter variables to ScrollerImp
1774         https://bugs.webkit.org/show_bug.cgi?id=155976
1775
1776         Reviewed by Simon Fraser.
1777
1778         This patch continues where r198078 left off. That patch renamed all the types,
1779         however, there are some variables which were left as "scrollbarPainter". This
1780         patch completes the transition to ScrollerImp.
1781
1782         No new tests because there is no behavior change.
1783
1784         * platform/mac/ScrollAnimatorMac.h:
1785         * platform/mac/ScrollAnimatorMac.mm:
1786         (scrollerImpForScrollbar):
1787         (-[WebScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
1788         (-[WebScrollbarPartAnimation startAnimation]):
1789         (-[WebScrollbarPartAnimation setCurrentProgress:]):
1790         (-[WebScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
1791         (-[WebScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
1792         (-[WebScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
1793         (-[WebScrollerImpDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
1794         (-[WebScrollerImpDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
1795         (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
1796         (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
1797         (WebCore::ScrollAnimatorMac::contentAreaWillPaint):
1798         (WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
1799         (WebCore::ScrollAnimatorMac::mouseExitedContentArea):
1800         (WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
1801         (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
1802         (WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
1803         (WebCore::ScrollAnimatorMac::mouseIsDownInScrollbar):
1804         (WebCore::ScrollAnimatorMac::willStartLiveResize):
1805         (WebCore::ScrollAnimatorMac::contentsResized):
1806         (WebCore::ScrollAnimatorMac::willEndLiveResize):
1807         (WebCore::ScrollAnimatorMac::contentAreaDidShow):
1808         (WebCore::ScrollAnimatorMac::contentAreaDidHide):
1809         (WebCore::ScrollAnimatorMac::didBeginScrollGesture):
1810         (WebCore::ScrollAnimatorMac::didEndScrollGesture):
1811         (WebCore::ScrollAnimatorMac::mayBeginScrollGesture):
1812         (WebCore::ScrollAnimatorMac::lockOverlayScrollbarStateToHidden):
1813         (WebCore::ScrollAnimatorMac::scrollbarsCanBeActive):
1814         (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
1815         (WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar):
1816         (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
1817         (WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar):
1818         (WebCore::ScrollAnimatorMac::invalidateScrollbarPartLayers):
1819         (WebCore::ScrollAnimatorMac::verticalScrollbarLayerDidChange):
1820         (WebCore::ScrollAnimatorMac::horizontalScrollbarLayerDidChange):
1821         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
1822         (WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
1823         (WebCore::ScrollAnimatorMac::updateScrollerStyle):
1824         (WebCore::ScrollAnimatorMac::initialScrollbarPaintTimerFired):
1825         (WebCore::ScrollAnimatorMac::sendContentAreaScrolled):
1826         (scrollbarPainterForScrollbar): Deleted.
1827         * platform/mac/ScrollbarThemeMac.mm:
1828         (WebCore::ScrollbarThemeMac::registerScrollbar):
1829         (WebCore::ScrollbarThemeMac::scrollbarThickness):
1830         (WebCore::scrollerImpPaint):
1831         (WebCore::ScrollbarThemeMac::paint):
1832         (WebCore::scrollbarPainterPaint): Deleted.
1833
1834 2016-03-29  Joseph Pecoraro  <pecoraro@apple.com>
1835
1836         Web Inspector: We should have a way to capture heap snapshots programatically.
1837         https://bugs.webkit.org/show_bug.cgi?id=154407
1838         <rdar://problem/24726292>
1839
1840         Reviewed by Timothy Hatcher.
1841
1842         Test: inspector/console/heapSnapshot.html
1843
1844         * page/PageConsoleClient.cpp:
1845         (WebCore::PageConsoleClient::takeHeapSnapshot):
1846         * page/PageConsoleClient.h:
1847         Pass through to Inspector Instrumentation.
1848
1849         * inspector/InspectorConsoleInstrumentation.h:
1850         (WebCore::InspectorInstrumentation::takeHeapSnapshot):
1851         * inspector/InspectorInstrumentation.cpp:
1852         (WebCore::InspectorInstrumentation::takeHeapSnapshotImpl):
1853         * inspector/InspectorInstrumentation.h:
1854         Pass through to InspectorConsoleAgent.
1855
1856         * inspector/InspectorController.cpp:
1857         (WebCore::InspectorController::InspectorController):
1858         * inspector/PageConsoleAgent.cpp:
1859         (WebCore::PageConsoleAgent::PageConsoleAgent):
1860         * inspector/PageConsoleAgent.h:
1861         * inspector/WebConsoleAgent.cpp:
1862         (WebCore::WebConsoleAgent::WebConsoleAgent):
1863         * inspector/WebConsoleAgent.h:
1864         * workers/WorkerConsoleClient.cpp:
1865         (WebCore::WorkerConsoleClient::takeHeapSnapshot):
1866         * workers/WorkerConsoleClient.h:
1867         Provide a HeapAgent to the ConsoleAgent.
1868
1869 2016-03-29  Zalan Bujtas  <zalan@apple.com>
1870
1871         REGRESSION (r196813): Missing plug-in placeholder is missing
1872         https://bugs.webkit.org/show_bug.cgi?id=155973
1873         <rdar://problem/25068392>
1874
1875         Reviewed by Andy Estes.
1876
1877         Show unavailable plugin indicator when UnavailablePluginIndicatorState (uninitialized, hidden, visible) is not set to hidden explicitly.
1878         It matches pre-196813 behaviour.
1879
1880         Unable to test.
1881
1882         * rendering/RenderEmbeddedObject.h:
1883         (WebCore::RenderEmbeddedObject::showsUnavailablePluginIndicator):
1884
1885 2016-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1886
1887         [OS X] [RTL Scrollbars] Overlay RTL scrollbars animate in from the wrong side
1888         https://bugs.webkit.org/show_bug.cgi?id=155962
1889
1890         Reviewed by Simon Fraser.
1891
1892         We can control the animation direction with the NSScrollerImp property
1893         userInterfaceLayoutDirection.
1894
1895         Not testable.
1896
1897         * platform/ScrollableArea.cpp:
1898         (WebCore::ScrollableArea::setScrollbarLayoutDirection):
1899         * platform/ScrollableArea.h:
1900         (WebCore::ScrollableArea::horizontalScrollbar):
1901         (WebCore::ScrollableArea::verticalScrollbar):
1902         (WebCore::ScrollableArea::tiledBacking):
1903         (WebCore::ScrollableArea::layerForHorizontalScrollbar):
1904         (WebCore::ScrollableArea::layerForVerticalScrollbar):
1905         (WebCore::ScrollableArea::layerForScrolling):
1906         (WebCore::ScrollableArea::layerForScrollCorner):
1907         (WebCore::ScrollableArea::layerForOverhangAreas):
1908         * platform/mac/ScrollAnimatorMac.mm:
1909         (WebCore::ScrollAnimatorMac::updateScrollerStyle):
1910         * platform/mac/ScrollableAreaMac.mm:
1911         (WebCore::ScrollableArea::setScrollbarDirection):
1912         * platform/mac/ScrollbarThemeMac.mm:
1913         (WebCore::ScrollbarThemeMac::registerScrollbar):
1914         * platform/spi/mac/NSScrollerImpSPI.h:
1915
1916 2016-03-29  Dan Bernstein  <mitz@apple.com>
1917
1918         Inline WebFullScreenVideoRootViewController.m
1919         https://bugs.webkit.org/show_bug.cgi?id=155971
1920
1921         Reviewed by Anders Carlsson.
1922
1923         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1924         (createFullScreenVideoRootViewControllerClass): Replaced with the code from
1925           WebFullScreenVideoRootViewController.m.
1926
1927 2016-03-29  Said Abou-Hallawa  <sabouhallawa@apple,com>
1928
1929         Create a CG ImageDecoder class instead of defining it as CGImageSourceRef
1930         https://bugs.webkit.org/show_bug.cgi?id=155422
1931
1932         Reviewed by Simon Fraser.
1933
1934         Move the image CG decoding code from the class ImageSource out to a new
1935         class named ImageDecoder. The purpose of this split is to unify the code
1936         of the ImageSource for all platforms. This class should be a container
1937         for the ImageDecoder. All the direct frame manipulation like querying the
1938         frame metadata or creating a frame image should be the responsibility of
1939         the ImageDecoder. The ImageSource will be responsible of the image frame
1940         caching. When responding to a frame metadata query, for example. the
1941         ImageSource checks its cache first. If an entry does not exist for the
1942         requested frame, the ImageSource will cache the image and the metadata
1943         of this frame. The ImageSource will respond at the end from the image
1944         frame cache.
1945  
1946         The plan after this patch is is the following:
1947             -- Move the new class to separate files
1948             -- Merge the ImageSource.cpp and ImageSourceCG.cpp. in one file
1949             -- Move caching the FrameData from BitmapImage to ImageSource.
1950  
1951         * loader/cache/CachedImage.cpp:
1952         (WebCore::CachedImage::imageSizeForRenderer):
1953         BitmapImage::sizeRespectingOrientation() does not take any argument now.
1954         Fix the call to this function and delete the conditionally compiled code 
1955         since the code is the same for the two cases.
1956  
1957         * platform/graphics/BitmapImage.cpp:
1958         (WebCore::BitmapImage::updateSize):
1959         (WebCore::BitmapImage::sizeRespectingOrientation):
1960         (WebCore::BitmapImage::frameImageAtIndex):
1961         (WebCore::BitmapImage::BitmapImage):
1962         An image can have two sizes: size() and sizeRespectingOrientation(). The
1963         sizeRespectingOrientation() is the transpose of size() iff the image
1964         orientation has usesWidthAsHeight() is true. So there is no need for the
1965         ImageOrientationDescription argument. So there is no need for the members
1966         m_imageOrientation or m_shouldRespectImageOrientation. Also move
1967         m_allowSubsampling and m_minimumSubsamplingLevel (which should be named
1968         m_maximumSubsamplingLevel) to ImageSource instead.
1969
1970         (WebCore::BitmapImage::frameOrientationAtIndex): Replace DefaultImageOrientation
1971         by ImageOrientation().
1972         
1973         (WebCore::BitmapImage::dump): Move dumping the image metadata to the
1974         ImageSource.
1975         
1976         * platform/graphics/BitmapImage.h:
1977         
1978         * platform/graphics/GraphicsContext.h:
1979         * platform/graphics/ImageOrientation.h:
1980         (WebCore::ImageOrientation::ImageOrientation):
1981         (WebCore::ImageOrientation::fromEXIFValue):
1982         (WebCore::ImageOrientation::operator ImageOrientationEnum):
1983         Add a casting operator to ImageOrientation so it can be dumped as enum
1984         value. Also add a default constructor and make the other constructor be
1985         explicit. All the rvalues DefaultImageOrientation should be replaced by
1986         ImageOrientation().
1987
1988         * platform/graphics/ImageSource.cpp:
1989         (WebCore::ImageSource::ImageSource):
1990         (WebCore::ImageSource::clear):
1991         m_decoder is now a unique_ptr. To release it, assign it to nullptr.
1992
1993         (WebCore::ImageSource::ensureDecoderIsCreated): Ensure m_decoder is created.
1994         
1995         (WebCore::ImageSource::setData): Call ensureDecoderIsCreated() before
1996         actually setting the data.
1997         
1998         (WebCore::ImageSource::isSizeAvailable): Use initialized();
1999         
2000         (WebCore::ImageSource::size):
2001         (WebCore::ImageSource::sizeRespectingOrientation):
2002         (WebCore::ImageSource::frameSizeAtIndex):
2003         These functions return the size of the image.
2004     
2005         (WebCore::ImageSource::getHotSpot):
2006         (WebCore::ImageSource::repetitionCount):
2007         (WebCore::ImageSource::frameCount):
2008         (WebCore::ImageSource::createFrameImageAtIndex):
2009         (WebCore::ImageSource::frameDurationAtIndex):
2010         (WebCore::ImageSource::orientationAtIndex):
2011         (WebCore::ImageSource::frameHasAlphaAtIndex):
2012         (WebCore::ImageSource::frameIsCompleteAtIndex):
2013         (WebCore::ImageSource::frameBytesAtIndex):
2014         Check for initialized() instead of checking m_decoder.
2015         
2016         (WebCore::ImageSource::dump): Dump the image metadata.
2017         
2018         (WebCore::ImageSource::initialized): Deleted.
2019         
2020         * platform/graphics/ImageSource.h: The image decoder is now named
2021         ImageDecoder for all platforms.
2022         
2023         (WebCore::ImageSource::initialized): Moved to the header file.
2024
2025         (WebCore::ImageSource::setAllowSubsampling): Moved from BitmapImage.
2026         
2027         * platform/graphics/cairo/BitmapImageCairo.cpp:
2028         (WebCore::BitmapImage::BitmapImage):
2029         (WebCore::BitmapImage::determineMinimumSubsamplingLevel): Deleted.
2030         Delete initializing m_minimumSubsamplingLevel and determineMinimumSubsamplingLevel()
2031         since they are moved to ImageSource.
2032         
2033         * platform/graphics/cg/BitmapImageCG.cpp:
2034         (WebCore::BitmapImage::BitmapImage):
2035         (WebCore::BitmapImage::determineMinimumSubsamplingLevel): Deleted.
2036         Delete members and methods which are now owned and calculated by ImageSource.
2037         
2038         * platform/graphics/cg/ImageSourceCG.cpp:
2039         (WebCore::ImageDecoder::create): Returns a CG ImageDecoder object.
2040         
2041         (WebCore::orientationFromProperties):  Replace DefaultImageOrientation
2042         by ImageOrientation().
2043         
2044         (WebCore::ImageDecoder::ImageDecoder): Creates a native CG image decoder.
2045         
2046         (WebCore::ImageDecoder::~ImageDecoder): Releases the native CG image decoder.
2047         
2048         (WebCore::ImageDecoder::subsamplingLevelForScale): Moved from ImageSource.
2049         A new argument named 'maximumSubsamplingLevel' is added to low filter the
2050         return value.
2051         
2052         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties):
2053         (WebCore::ImageDecoder::filenameExtension):
2054         (WebCore::ImageDecoder::isSizeAvailable):
2055         (WebCore::ImageDecoder::size):
2056         (WebCore::ImageDecoder::frameCount):
2057         (WebCore::ImageDecoder::repetitionCount):
2058         (WebCore::ImageDecoder::hotSpot):
2059         (WebCore::ImageDecoder::frameSizeAtIndex):
2060         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
2061         (WebCore::ImageDecoder::orientationAtIndex):
2062         (WebCore::ImageDecoder::frameDurationAtIndex):
2063         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex):
2064         (WebCore::ImageDecoder::frameHasAlphaAtIndex):
2065         (WebCore::ImageDecoder::frameBytesAtIndex):
2066         (WebCore::ImageDecoder::createFrameImageAtIndex):
2067         (WebCore::ImageDecoder::setData):
2068         The code of these function was moved from the functions of ImageSource.
2069         
2070         (WebCore::ImageSource::ImageSource):
2071         (WebCore::ImageSource::~ImageSource):
2072         (WebCore::ImageSource::clear):
2073         (WebCore::ImageSource::ensureDecoderIsCreated):
2074         (WebCore::ImageSource::setData):
2075         (WebCore::ImageSource::filenameExtension):
2076         (WebCore::ImageSource::calculateMaximumSubsamplingLevel):
2077         (WebCore::ImageSource::maximumSubsamplingLevel):
2078         (WebCore::ImageSource::subsamplingLevelForScale):
2079         (WebCore::ImageSource::isSizeAvailable):
2080         (WebCore::ImageSource::allowSubsamplingOfFrameAtIndex):
2081         (WebCore::ImageSource::frameSizeAtIndex):
2082         (WebCore::ImageSource::orientationAtIndex):
2083         (WebCore::ImageSource::size):
2084         (WebCore::ImageSource::sizeRespectingOrientation):
2085         (WebCore::ImageSource::getHotSpot):
2086         (WebCore::ImageSource::bytesDecodedToDetermineProperties):
2087         (WebCore::ImageSource::repetitionCount):
2088         (WebCore::ImageSource::frameCount):
2089         (WebCore::ImageSource::createFrameImageAtIndex):
2090         (WebCore::ImageSource::frameIsCompleteAtIndex):
2091         (WebCore::ImageSource::frameDurationAtIndex):
2092         (WebCore::ImageSource::frameHasAlphaAtIndex):
2093         (WebCore::ImageSource::frameBytesAtIndex):
2094         Call m_decoder's function to do the real work.
2095         
2096         (WebCore::ImageSource::dump): Dump the image metadata.
2097         
2098         (WebCore::ImageSource::initialized): Deleted.
2099         
2100         * platform/image-decoders/ImageDecoder.cpp:
2101         (WebCore::ImageDecoder::create):
2102         * platform/image-decoders/ImageDecoder.h:
2103         Change the return of ImageDecoder::create() to be unique_ptr.
2104         
2105         * platform/mac/DragImageMac.mm:
2106         (WebCore::createDragImageFromImage): Delete unneeded argument.
2107
2108 2016-03-29  Eric Carlson  <eric.carlson@apple.com>
2109
2110         media/track/track-remove-track.html is flaky, crashing and failing
2111         https://bugs.webkit.org/show_bug.cgi?id=130971
2112
2113         Reviewed by Alexey Proskuryakov.
2114         
2115         Prevent HTMLMediaElement from being collected while it is creating media controls.
2116         These changes prevent the test from crashing but they do not fix the flakiness,
2117         which is caused by another bug. Fixing that is tracked by 
2118         https://bugs.webkit.org/show_bug.cgi?id=155956.
2119
2120         * html/HTMLMediaElement.cpp:
2121         (WebCore::actionName): New, debugging-only helper function.
2122         (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize new variables.
2123         (WebCore::HTMLMediaElement::scheduleDelayedAction): Log the flag names to make debugging easier.
2124         (WebCore::HTMLMediaElement::scheduleNextSourceChild): Add logging.
2125         (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Update logging.
2126         (WebCore::HTMLMediaElement::configureTextTrackGroup): Drive-by optimization: don't call 
2127           updateCaptionContainer here, call it before exiting configureTextTracks so we only call
2128           it once instead of once per track group.
2129         (WebCore::controllerJSValue):
2130         (WebCore::HTMLMediaElement::ensureMediaControlsShadowRoot): New, wrapper around calling
2131           ensureUserAgentShadowRoot so m_creatingControls can be set and cleared appropriately.
2132         (WebCore::HTMLMediaElement::updateCaptionContainer): ensureUserAgentShadowRoot -> 
2133           ensureMediaControlsShadowRoot. Drive by optimization: set/test m_haveSetupCaptionContainer
2134           so we only do this setup once.
2135         (WebCore::HTMLMediaElement::configureTextTracks): Call updateCaptionContainer.
2136         (WebCore::HTMLMediaElement::clearMediaPlayer): Log flag names.
2137         (WebCore::HTMLMediaElement::hasPendingActivity): Return true when creating controls so GC
2138           won't happen during controls setup.
2139         (WebCore::HTMLMediaElement::updateTextTrackDisplay): ensureUserAgentShadowRoot -> 
2140           ensureMediaControlsShadowRoot.
2141         (WebCore::HTMLMediaElement::createMediaControls): Ditto.
2142         (WebCore::HTMLMediaElement::configureMediaControls): Ditto.
2143         (WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto.
2144         * html/HTMLMediaElement.h:
2145
2146 2016-03-29  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2147
2148         Unreviewed EFL build fix caused by r198773
2149
2150         * CMakeLists.txt: Append WebCore_DERIVED_SOURCES to WebCore source list.
2151
2152 2016-03-29  Joseph Pecoraro  <pecoraro@apple.com>
2153
2154         Audit WebCore builtins for user overridable code
2155         https://bugs.webkit.org/show_bug.cgi?id=155923
2156
2157         Reviewed by Youenn Fablet.
2158
2159         Tests: fetch/builtin-overrides.html
2160                streams/builtin-overrides.html
2161
2162         * Modules/fetch/FetchHeaders.js:
2163         (initializeFetchHeaders):
2164         Avoid using an Array.prototype.forEach that could be overriden.
2165
2166         * Modules/streams/ByteLengthQueuingStrategy.js:
2167         (initializeByteLengthQueuingStrategy):
2168         * Modules/streams/CountQueuingStrategy.js:
2169         (initializeCountQueuingStrategy):
2170         Use the private Object.defineProperty not one that could be overriden.
2171
2172         * Modules/streams/ReadableStreamInternals.js:
2173         (finishClosingReadableStream):
2174         Fix style.
2175
2176         * Modules/streams/WritableStream.js:
2177         (write):
2178         Fix error message to use the correct function name.
2179
2180 2016-03-28  Zalan Bujtas  <zalan@apple.com>
2181
2182         Pixel turds when bordered div is resized on SMF forum software.
2183         https://bugs.webkit.org/show_bug.cgi?id=155957
2184         <rdar://problem/25010646>
2185
2186         Reviewed by Simon Fraser.
2187
2188         Use unmodified, non-snapped bounding box rect when computing dirty rects.
2189
2190         Test: fast/repaint/hidpi-box-with-subpixel-height-inflates.html
2191
2192         * rendering/RenderBox.h:
2193         * rendering/RenderBoxModelObject.h:
2194         * rendering/RenderElement.cpp:
2195         (WebCore::RenderElement::getTrailingCorner):
2196         * rendering/RenderInline.h:
2197         * rendering/RenderLineBreak.cpp:
2198         (WebCore::RenderLineBreak::borderBoundingBox): Deleted.
2199         * rendering/RenderLineBreak.h:
2200         * rendering/RenderView.cpp:
2201         (WebCore::RenderView::setBestTruncatedAt):
2202
2203 2016-03-28  Chris Fleizach  <cfleizach@apple.com>
2204
2205         AX: Crash when AX trying to create element for an old auto fill element
2206         https://bugs.webkit.org/show_bug.cgi?id=155943
2207
2208         Reviewed by Joanmarie Diggs.
2209
2210         When an auto-fill element is removed, the Node hangs around but the renderer is gone.
2211         In those cases, we can't blindly add the result of getOrCreate to the children array.
2212
2213         Test: accessibility/auto-fill-crash.html
2214
2215         * accessibility/AccessibilityRenderObject.cpp:
2216         (WebCore::AccessibilityRenderObject::addTextFieldChildren):
2217
2218 2016-03-28  Chris Fleizach  <cfleizach@apple.com>
2219
2220         AX: iOS: Can't navigate inside ContentEditable fields with voiceover enabled
2221         https://bugs.webkit.org/show_bug.cgi?id=155942
2222
2223         Reviewed by Joanmarie Diggs.
2224
2225         The code to set the selected text range on a non-native text control (like a contenteditable) was either
2226         wrong or broke at some point. It assumed that creating a Position with the contenteditable node with the right
2227         offset would make a valid Position, but it almost never did.
2228
2229         Instead we can use this helper method to create a valid Position.
2230
2231         Test: accessibility/set-selected-text-range-contenteditable.html
2232
2233         * accessibility/AccessibilityRenderObject.cpp:
2234         (WebCore::AccessibilityRenderObject::setSelectedTextRange):
2235
2236 2016-03-28  Alex Christensen  <achristensen@webkit.org>
2237
2238         Fix Ninja build on Mac
2239         https://bugs.webkit.org/show_bug.cgi?id=151399
2240
2241         Reviewed by Darin Adler.
2242
2243         * CMakeLists.txt:
2244         * PlatformEfl.cmake:
2245         * PlatformGTK.cmake:
2246         * PlatformMac.cmake:
2247         This moves WebCoreDerivedSources to a separate static library to reduce linker command 
2248         line lengths when using ninja on mac. This also helps Windows builds, which sometimes 
2249         regenerate everything every time you build; now you'll be able to just build WebCore
2250         and WebKit without all the WebCoreDerivedSources stuff.
2251
2252 2016-03-28  Brady Eidson  <beidson@apple.com>
2253
2254         Fix build on some stricter compilers by removing unnecessary WTFMove.
2255         Opportunistically remove some unnecessary "WebCore::"s
2256         Followup to r198762
2257
2258         * Modules/indexeddb/IDBObjectStore.cpp:
2259         (WebCore::IDBObjectStore::keyPathAny):
2260         (WebCore::IDBObjectStore::transaction):
2261         (WebCore::IDBObjectStore::openCursor):
2262         (WebCore::IDBObjectStore::get):
2263         (WebCore::IDBObjectStore::add):
2264         (WebCore::IDBObjectStore::put):
2265         (WebCore::IDBObjectStore::deleteFunction):
2266         (WebCore::IDBObjectStore::clear):
2267         (WebCore::IDBObjectStore::createIndex):
2268         (WebCore::IDBObjectStore::index):
2269         (WebCore::IDBObjectStore::count):
2270         (WebCore::IDBObjectStore::doCount):
2271
2272 2016-03-28  Brady Eidson  <beidson@apple.com>
2273
2274         Modern IDB: Remove abstract base classes for all IDB DOM classes.
2275         https://bugs.webkit.org/show_bug.cgi?id=155951
2276
2277         Reviewed by Alex Christensen.
2278
2279         Refactor - No behavior change.
2280
2281         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
2282         (WebCore::DOMWindowIndexedDatabase::indexedDB):
2283         * Modules/indexeddb/IDBAny.cpp:
2284         (WebCore::IDBAny::IDBAny):
2285         (WebCore::IDBAny::~IDBAny):
2286         (WebCore::IDBAny::idbDatabase):
2287         (WebCore::IDBAny::domStringList):
2288         (WebCore::IDBAny::idbCursor):
2289         (WebCore::IDBAny::idbCursorWithValue):
2290         (WebCore::IDBAny::idbFactory):
2291         (WebCore::IDBAny::idbIndex):
2292         (WebCore::IDBAny::idbObjectStore):
2293         (WebCore::IDBAny::idbTransaction):
2294         (WebCore::IDBAny::scriptValue):
2295         (WebCore::IDBAny::integer):
2296         (WebCore::IDBAny::string):
2297         (WebCore::IDBAny::keyPath):
2298         * Modules/indexeddb/IDBAny.h:
2299         (WebCore::IDBAny::create):
2300         (WebCore::IDBAny::createUndefined):
2301         (WebCore::IDBAny::type):
2302         (WebCore::IDBAny::~IDBAny): Deleted.
2303         (WebCore::IDBAny::isLegacy): Deleted.
2304         * Modules/indexeddb/IDBCursor.cpp:
2305         (WebCore::IDBCursor::create):
2306         (WebCore::IDBCursor::IDBCursor):
2307         (WebCore::IDBCursor::~IDBCursor):
2308         (WebCore::IDBCursor::sourcesDeleted):
2309         (WebCore::IDBCursor::effectiveObjectStore):
2310         (WebCore::IDBCursor::transaction):
2311         (WebCore::IDBCursor::direction):
2312         (WebCore::IDBCursor::key):
2313         (WebCore::IDBCursor::primaryKey):
2314         (WebCore::IDBCursor::value):
2315         (WebCore::IDBCursor::source):
2316         (WebCore::IDBCursor::update):
2317         (WebCore::IDBCursor::advance):
2318         (WebCore::IDBCursor::continueFunction):
2319         (WebCore::IDBCursor::uncheckedIterateCursor):
2320         (WebCore::IDBCursor::deleteFunction):
2321         (WebCore::IDBCursor::setGetResult):
2322         (WebCore::IDBCursor::activeDOMObjectName):
2323         (WebCore::IDBCursor::canSuspendForDocumentSuspension):
2324         (WebCore::IDBCursor::hasPendingActivity):
2325         (WebCore::IDBCursor::decrementOutstandingRequestCount):
2326         * Modules/indexeddb/IDBCursor.h:
2327         (WebCore::IDBCursor::info):
2328         (WebCore::IDBCursor::setRequest):
2329         (WebCore::IDBCursor::clearRequest):
2330         (WebCore::IDBCursor::request):
2331         (WebCore::IDBCursor::isKeyCursor):
2332         (WebCore::IDBCursor::~IDBCursor): Deleted.
2333         (WebCore::IDBCursor::continueFunction): Deleted.
2334         (WebCore::IDBCursor::isModernCursor): Deleted.
2335         (WebCore::IDBCursor::hasPendingActivity): Deleted.
2336         * Modules/indexeddb/IDBCursorWithValue.cpp:
2337         (WebCore::IDBCursorWithValue::create):
2338         (WebCore::IDBCursorWithValue::IDBCursorWithValue):
2339         (WebCore::IDBCursorWithValue::~IDBCursorWithValue):
2340         * Modules/indexeddb/IDBCursorWithValue.h:
2341         (WebCore::IDBCursorWithValue::~IDBCursorWithValue): Deleted.
2342         * Modules/indexeddb/IDBDatabase.cpp:
2343         (WebCore::IDBDatabase::create):
2344         (WebCore::IDBDatabase::IDBDatabase):
2345         (WebCore::IDBDatabase::~IDBDatabase):
2346         (WebCore::IDBDatabase::hasPendingActivity):
2347         (WebCore::IDBDatabase::name):
2348         (WebCore::IDBDatabase::version):
2349         (WebCore::IDBDatabase::objectStoreNames):
2350         (WebCore::IDBDatabase::createObjectStore):
2351         (WebCore::IDBDatabase::transaction):
2352         (WebCore::IDBDatabase::deleteObjectStore):
2353         (WebCore::IDBDatabase::close):
2354         (WebCore::IDBDatabase::maybeCloseInServer):
2355         (WebCore::IDBDatabase::activeDOMObjectName):
2356         (WebCore::IDBDatabase::canSuspendForDocumentSuspension):
2357         (WebCore::IDBDatabase::stop):
2358         (WebCore::IDBDatabase::startVersionChangeTransaction):
2359         (WebCore::IDBDatabase::didStartTransaction):
2360         (WebCore::IDBDatabase::willCommitTransaction):
2361         (WebCore::IDBDatabase::didCommitTransaction):
2362         (WebCore::IDBDatabase::willAbortTransaction):
2363         (WebCore::IDBDatabase::didAbortTransaction):
2364         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
2365         (WebCore::IDBDatabase::fireVersionChangeEvent):
2366         (WebCore::IDBDatabase::dispatchEvent):
2367         (WebCore::IDBDatabase::didCreateIndexInfo):
2368         (WebCore::IDBDatabase::didDeleteIndexInfo):
2369         * Modules/indexeddb/IDBDatabase.h:
2370         (WebCore::IDBDatabase::info):
2371         (WebCore::IDBDatabase::databaseConnectionIdentifier):
2372         (WebCore::IDBDatabase::serverConnection):
2373         (WebCore::IDBDatabase::isClosingOrClosed):
2374         (WebCore::IDBDatabase::~IDBDatabase): Deleted.
2375         * Modules/indexeddb/IDBFactory.cpp:
2376         (WebCore::shouldThrowSecurityException):
2377         (WebCore::IDBFactory::create):
2378         (WebCore::IDBFactory::IDBFactory):
2379         (WebCore::IDBFactory::getDatabaseNames):
2380         (WebCore::IDBFactory::open):
2381         (WebCore::IDBFactory::openInternal):
2382         (WebCore::IDBFactory::deleteDatabase):
2383         (WebCore::IDBFactory::cmp):
2384         * Modules/indexeddb/IDBFactory.h:
2385         (WebCore::IDBFactory::~IDBFactory): Deleted.
2386         * Modules/indexeddb/IDBIndex.cpp:
2387         (WebCore::IDBIndex::IDBIndex):
2388         (WebCore::IDBIndex::~IDBIndex):
2389         (WebCore::IDBIndex::activeDOMObjectName):
2390         (WebCore::IDBIndex::canSuspendForDocumentSuspension):
2391         (WebCore::IDBIndex::hasPendingActivity):
2392         (WebCore::IDBIndex::name):
2393         (WebCore::IDBIndex::objectStore):
2394         (WebCore::IDBIndex::keyPathAny):
2395         (WebCore::IDBIndex::keyPath):
2396         (WebCore::IDBIndex::unique):
2397         (WebCore::IDBIndex::multiEntry):
2398         (WebCore::IDBIndex::openCursor):
2399         (WebCore::IDBIndex::count):
2400         (WebCore::IDBIndex::doCount):
2401         (WebCore::IDBIndex::openKeyCursor):
2402         (WebCore::IDBIndex::get):
2403         (WebCore::IDBIndex::doGet):
2404         (WebCore::IDBIndex::getKey):
2405         (WebCore::IDBIndex::doGetKey):
2406         (WebCore::IDBIndex::markAsDeleted):
2407         (WebCore::IDBIndex::ref):
2408         (WebCore::IDBIndex::deref):
2409         * Modules/indexeddb/IDBIndex.h:
2410         (WebCore::IDBIndex::openCursor):
2411         (WebCore::IDBIndex::openKeyCursor):
2412         (WebCore::IDBIndex::info):
2413         (WebCore::IDBIndex::modernObjectStore):
2414         (WebCore::IDBIndex::isDeleted):
2415         (WebCore::IDBIndex::~IDBIndex): Deleted.
2416         (WebCore::IDBIndex::isModern): Deleted.
2417         * Modules/indexeddb/IDBObjectStore.cpp:
2418         (WebCore::IDBObjectStore::create):
2419         (WebCore::IDBObjectStore::IDBObjectStore):
2420         (WebCore::IDBObjectStore::~IDBObjectStore):
2421         (WebCore::IDBObjectStore::activeDOMObjectName):
2422         (WebCore::IDBObjectStore::canSuspendForDocumentSuspension):
2423         (WebCore::IDBObjectStore::hasPendingActivity):
2424         (WebCore::IDBObjectStore::name):
2425         (WebCore::IDBObjectStore::keyPathAny):
2426         (WebCore::IDBObjectStore::keyPath):
2427         (WebCore::IDBObjectStore::indexNames):
2428         (WebCore::IDBObjectStore::transaction):
2429         (WebCore::IDBObjectStore::autoIncrement):
2430         (WebCore::IDBObjectStore::openCursor):
2431         (WebCore::IDBObjectStore::get):
2432         (WebCore::IDBObjectStore::add):
2433         (WebCore::IDBObjectStore::put):
2434         (WebCore::IDBObjectStore::putForCursorUpdate):
2435         (WebCore::IDBObjectStore::putOrAdd):
2436         (WebCore::IDBObjectStore::deleteFunction):
2437         (WebCore::IDBObjectStore::doDelete):
2438         (WebCore::IDBObjectStore::modernDelete):
2439         (WebCore::IDBObjectStore::clear):
2440         (WebCore::IDBObjectStore::createIndex):
2441         (WebCore::IDBObjectStore::index):
2442         (WebCore::IDBObjectStore::deleteIndex):
2443         (WebCore::IDBObjectStore::count):
2444         (WebCore::IDBObjectStore::doCount):
2445         (WebCore::IDBObjectStore::markAsDeleted):
2446         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
2447         (WebCore::IDBObjectStore::visitReferencedIndexes):
2448         * Modules/indexeddb/IDBObjectStore.h:
2449         (WebCore::IDBObjectStore::isDeleted):
2450         (WebCore::IDBObjectStore::info):
2451         (WebCore::IDBObjectStore::modernTransaction):
2452         (WebCore::IDBObjectStore::~IDBObjectStore): Deleted.
2453         (WebCore::IDBObjectStore::isModern): Deleted.
2454         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2455         (WebCore::IDBOpenDBRequest::createDeleteRequest):
2456         (WebCore::IDBOpenDBRequest::createOpenRequest):
2457         (WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
2458         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
2459         (WebCore::IDBOpenDBRequest::onError):
2460         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
2461         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
2462         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
2463         (WebCore::IDBOpenDBRequest::dispatchEvent):
2464         (WebCore::IDBOpenDBRequest::onSuccess):
2465         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
2466         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
2467         (WebCore::IDBOpenDBRequest::requestCompleted):
2468         (WebCore::IDBOpenDBRequest::requestBlocked):
2469         * Modules/indexeddb/IDBOpenDBRequest.h:
2470         (WebCore::IDBOpenDBRequest::databaseIdentifier):
2471         (WebCore::IDBOpenDBRequest::version):
2472         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest): Deleted.
2473         * Modules/indexeddb/IDBRequest.cpp:
2474         (WebCore::IDBRequest::create):
2475         (WebCore::IDBRequest::createCount):
2476         (WebCore::IDBRequest::createGet):
2477         (WebCore::IDBRequest::IDBRequest):
2478         (WebCore::IDBRequest::~IDBRequest):
2479         (WebCore::IDBRequest::result):
2480         (WebCore::IDBRequest::errorCode):
2481         (WebCore::IDBRequest::error):
2482         (WebCore::IDBRequest::source):
2483         (WebCore::IDBRequest::setSource):
2484         (WebCore::IDBRequest::setVersionChangeTransaction):
2485         (WebCore::IDBRequest::transaction):
2486         (WebCore::IDBRequest::readyState):
2487         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
2488         (WebCore::IDBRequest::sourceIndexIdentifier):
2489         (WebCore::IDBRequest::requestedIndexRecordType):
2490         (WebCore::IDBRequest::eventTargetInterface):
2491         (WebCore::IDBRequest::activeDOMObjectName):
2492         (WebCore::IDBRequest::canSuspendForDocumentSuspension):
2493         (WebCore::IDBRequest::hasPendingActivity):
2494         (WebCore::IDBRequest::stop):
2495         (WebCore::IDBRequest::enqueueEvent):
2496         (WebCore::IDBRequest::dispatchEvent):
2497         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
2498         (WebCore::IDBRequest::setResult):
2499         (WebCore::IDBRequest::setResultToStructuredClone):
2500         (WebCore::IDBRequest::setResultToUndefined):
2501         (WebCore::IDBRequest::resultCursor):
2502         (WebCore::IDBRequest::willIterateCursor):
2503         (WebCore::IDBRequest::didOpenOrIterateCursor):
2504         (WebCore::IDBRequest::requestCompleted):
2505         (WebCore::IDBRequest::onError):
2506         (WebCore::IDBRequest::onSuccess):
2507         * Modules/indexeddb/IDBRequest.h:
2508         (WebCore::IDBRequest::resourceIdentifier):
2509         (WebCore::IDBRequest::connection):
2510         (WebCore::IDBRequest::modernResult):
2511         (WebCore::IDBRequest::pendingCursor):
2512         (WebCore::IDBRequest::requestType):
2513         (WebCore::IDBRequest::isOpenDBRequest):
2514         (WebCore::IDBRequest::~IDBRequest): Deleted.
2515         * Modules/indexeddb/IDBRequestCompletionEvent.cpp:
2516         (WebCore::IDBRequestCompletionEvent::IDBRequestCompletionEvent):
2517         * Modules/indexeddb/IDBRequestCompletionEvent.h:
2518         (WebCore::IDBRequestCompletionEvent::create):
2519         * Modules/indexeddb/IDBTransaction.cpp:
2520         (WebCore::IDBTransaction::create):
2521         (WebCore::IDBTransaction::IDBTransaction):
2522         (WebCore::IDBTransaction::~IDBTransaction):
2523         (WebCore::IDBTransaction::mode):
2524         (WebCore::IDBTransaction::db):
2525         (WebCore::IDBTransaction::serverConnection):
2526         (WebCore::IDBTransaction::error):
2527         (WebCore::IDBTransaction::objectStore):
2528         (WebCore::IDBTransaction::abortDueToFailedRequest):
2529         (WebCore::IDBTransaction::transitionedToFinishing):
2530         (WebCore::IDBTransaction::abort):
2531         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2532         (WebCore::IDBTransaction::activeDOMObjectName):
2533         (WebCore::IDBTransaction::canSuspendForDocumentSuspension):
2534         (WebCore::IDBTransaction::hasPendingActivity):
2535         (WebCore::IDBTransaction::stop):
2536         (WebCore::IDBTransaction::isActive):
2537         (WebCore::IDBTransaction::isFinishedOrFinishing):
2538         (WebCore::IDBTransaction::addRequest):
2539         (WebCore::IDBTransaction::removeRequest):
2540         (WebCore::IDBTransaction::scheduleOperation):
2541         (WebCore::IDBTransaction::scheduleOperationTimer):
2542         (WebCore::IDBTransaction::operationTimerFired):
2543         (WebCore::IDBTransaction::commit):
2544         (WebCore::IDBTransaction::commitOnServer):
2545         (WebCore::IDBTransaction::finishAbortOrCommit):
2546         (WebCore::IDBTransaction::didStart):
2547         (WebCore::IDBTransaction::notifyDidAbort):
2548         (WebCore::IDBTransaction::didAbort):
2549         (WebCore::IDBTransaction::didCommit):
2550         (WebCore::IDBTransaction::fireOnComplete):
2551         (WebCore::IDBTransaction::fireOnAbort):
2552         (WebCore::IDBTransaction::enqueueEvent):
2553         (WebCore::IDBTransaction::dispatchEvent):
2554         (WebCore::IDBTransaction::createObjectStore):
2555         (WebCore::IDBTransaction::createObjectStoreOnServer):
2556         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
2557         (WebCore::IDBTransaction::createIndex):
2558         (WebCore::IDBTransaction::createIndexOnServer):
2559         (WebCore::IDBTransaction::didCreateIndexOnServer):
2560         (WebCore::IDBTransaction::requestOpenCursor):
2561         (WebCore::IDBTransaction::doRequestOpenCursor):
2562         (WebCore::IDBTransaction::openCursorOnServer):
2563         (WebCore::IDBTransaction::didOpenCursorOnServer):
2564         (WebCore::IDBTransaction::iterateCursor):
2565         (WebCore::IDBTransaction::iterateCursorOnServer):
2566         (WebCore::IDBTransaction::didIterateCursorOnServer):
2567         (WebCore::IDBTransaction::requestGetRecord):
2568         (WebCore::IDBTransaction::requestGetValue):
2569         (WebCore::IDBTransaction::requestGetKey):
2570         (WebCore::IDBTransaction::requestIndexRecord):
2571         (WebCore::IDBTransaction::getRecordOnServer):
2572         (WebCore::IDBTransaction::didGetRecordOnServer):
2573         (WebCore::IDBTransaction::requestCount):
2574         (WebCore::IDBTransaction::getCountOnServer):
2575         (WebCore::IDBTransaction::didGetCountOnServer):
2576         (WebCore::IDBTransaction::requestDeleteRecord):
2577         (WebCore::IDBTransaction::deleteRecordOnServer):
2578         (WebCore::IDBTransaction::didDeleteRecordOnServer):
2579         (WebCore::IDBTransaction::requestClearObjectStore):
2580         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2581         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
2582         (WebCore::IDBTransaction::requestPutOrAdd):
2583         (WebCore::IDBTransaction::putOrAddOnServer):
2584         (WebCore::IDBTransaction::didPutOrAddOnServer):
2585         (WebCore::IDBTransaction::deleteObjectStore):
2586         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2587         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
2588         (WebCore::IDBTransaction::deleteIndex):
2589         (WebCore::IDBTransaction::deleteIndexOnServer):
2590         (WebCore::IDBTransaction::didDeleteIndexOnServer):
2591         (WebCore::IDBTransaction::operationDidComplete):
2592         (WebCore::IDBTransaction::establishOnServer):
2593         (WebCore::IDBTransaction::activate):
2594         (WebCore::IDBTransaction::deactivate):
2595         * Modules/indexeddb/IDBTransaction.h:
2596         (WebCore::IDBTransaction::info):
2597         (WebCore::IDBTransaction::database):
2598         (WebCore::IDBTransaction::originalDatabaseInfo):
2599         (WebCore::IDBTransaction::isVersionChange):
2600         (WebCore::IDBTransaction::isReadOnly):
2601         (WebCore::IDBTransaction::isFinished):
2602         (WebCore::TransactionActivator::TransactionActivator):
2603         (WebCore::TransactionActivator::~TransactionActivator):
2604         (WebCore::IDBTransaction::~IDBTransaction): Deleted.
2605         * Modules/indexeddb/IDBVersionChangeEvent.cpp:
2606         (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
2607         (WebCore::IDBVersionChangeEvent::newVersion):
2608         (WebCore::IDBVersionChangeEvent::eventInterface):
2609         (WebCore::IDBVersionChangeEvent::create): Deleted.
2610         * Modules/indexeddb/IDBVersionChangeEvent.h:
2611         (isType):
2612         * Modules/indexeddb/client/IDBAnyImpl.cpp: Removed.
2613         * Modules/indexeddb/client/IDBAnyImpl.h: Removed.
2614         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2615         * Modules/indexeddb/client/IDBConnectionToServer.h:
2616         * Modules/indexeddb/client/IDBCursorImpl.cpp: Removed.
2617         * Modules/indexeddb/client/IDBCursorImpl.h: Removed.
2618         * Modules/indexeddb/client/IDBCursorWithValueImpl.cpp: Removed.
2619         * Modules/indexeddb/client/IDBCursorWithValueImpl.h: Removed.
2620         * Modules/indexeddb/client/IDBDatabaseImpl.cpp: Removed.
2621         * Modules/indexeddb/client/IDBDatabaseImpl.h: Removed.
2622         * Modules/indexeddb/client/IDBFactoryImpl.cpp: Removed.
2623         * Modules/indexeddb/client/IDBFactoryImpl.h: Removed.
2624         * Modules/indexeddb/client/IDBIndexImpl.cpp: Removed.
2625         * Modules/indexeddb/client/IDBIndexImpl.h: Removed.
2626         * Modules/indexeddb/client/IDBObjectStoreImpl.cpp: Removed.
2627         * Modules/indexeddb/client/IDBObjectStoreImpl.h: Removed.
2628         * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: Removed.
2629         * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: Removed.
2630         * Modules/indexeddb/client/IDBRequestImpl.cpp: Removed.
2631         * Modules/indexeddb/client/IDBRequestImpl.h: Removed.
2632         * Modules/indexeddb/client/IDBTransactionImpl.cpp: Removed.
2633         * Modules/indexeddb/client/IDBTransactionImpl.h: Removed.
2634         * Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp: Removed.
2635         * Modules/indexeddb/client/IDBVersionChangeEventImpl.h: Removed.
2636         * Modules/indexeddb/client/TransactionOperation.cpp:
2637         * Modules/indexeddb/client/TransactionOperation.h:
2638         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2639         (WebCore::IDBCursorInfo::objectStoreCursor):
2640         (WebCore::IDBCursorInfo::indexCursor):
2641         (WebCore::IDBCursorInfo::IDBCursorInfo):
2642         * Modules/indexeddb/shared/IDBCursorInfo.h:
2643         * Modules/indexeddb/shared/IDBRequestData.cpp:
2644         (WebCore::IDBRequestData::IDBRequestData):
2645         * Modules/indexeddb/shared/IDBRequestData.h:
2646         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2647         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2648         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2649         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
2650         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2651         * Modules/indexeddb/shared/InProcessIDBServer.h:
2652         * WebCore.xcodeproj/project.pbxproj:
2653         * bindings/js/JSIDBCursorCustom.cpp:
2654         (WebCore::JSIDBCursor::visitAdditionalChildren):
2655         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2656         * bindings/js/JSIDBIndexCustom.cpp:
2657         (WebCore::JSIDBIndex::visitAdditionalChildren):
2658         * bindings/js/JSIDBObjectStoreCustom.cpp:
2659         (WebCore::JSIDBObjectStore::visitAdditionalChildren):
2660         * inspector/InspectorIndexedDBAgent.cpp:
2661
2662 2016-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
2663
2664         [RTL Scrollbars] Position:sticky can be positioned under vertical RTL scrollbar
2665         https://bugs.webkit.org/show_bug.cgi?id=155949
2666
2667         Reviewed by Simon Fraser.
2668
2669         When performing sticky positioning logic, we were setting the clip rect's position
2670         equal to the scrollPosition of the layer. This computation assumes that the top
2671         left of the scroll position is the same as the top left of the clip rect. When
2672         using RTL scrollbars, this is not true, so this code simply needs to be made aware
2673         of the presence of an RTL scrollbar.
2674
2675         Tests: fast/scrolling/rtl-scrollbars-sticky-document-2.html
2676                fast/scrolling/rtl-scrollbars-sticky-document.html
2677                fast/scrolling/rtl-scrollbars-sticky-iframe-2.html
2678                fast/scrolling/rtl-scrollbars-sticky-iframe.html
2679                fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html
2680                fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html
2681
2682         * rendering/RenderBoxModelObject.cpp:
2683         (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition):
2684
2685 2016-03-28  Antonio Gomes  <tonikitoo@webkit.org>
2686
2687         Rename PlatformWheelEvent::isEndGesture to isEndOfMomentumScroll.
2688         https://bugs.webkit.org/show_bug.cgi?id=155940
2689
2690         Reviewed by Simon Fraser.
2691
2692         No new tests needed.
2693
2694         The new name better reflects its purpose. Also it is a preparation to fix bug 155746.
2695
2696         * platform/PlatformWheelEvent.h:
2697         (WebCore::PlatformWheelEvent::shouldResetLatching):
2698         (WebCore::PlatformWheelEvent::isEndOfMomentumScroll: Renamed; Formally isEndGesture.
2699         * platform/mac/ScrollAnimatorMac.mm:
2700         (WebCore::gestureShouldBeginSnap):
2701
2702 2016-03-28  Zalan Bujtas  <zalan@apple.com>
2703
2704         Setup cloned continuation renderer properly.
2705         https://bugs.webkit.org/show_bug.cgi?id=155640
2706
2707         Reviewed by Simon Fraser.
2708
2709         Set the "renderer has outline ancestor" flag on the cloned inline renderer when
2710         we split the original renderer for continuation.
2711         It ensures that when the cloned part of the continuation requests repaint, we properly
2712         invalidate the ancestor outline (if needed).
2713
2714         Test: fast/inline/outline-with-continuation-assert.html
2715
2716         * rendering/RenderInline.cpp:
2717         (WebCore::RenderInline::clone):
2718
2719 2016-03-25  Simon Fraser  <simon.fraser@apple.com>
2720
2721         Inspector Memory Timeline sometimes encounters unstoppable rAF drawing
2722         https://bugs.webkit.org/show_bug.cgi?id=155906
2723
2724         Reviewed by Anders Carlsson.
2725
2726         It was possible to get Web Inspector into a state where repeated, expensive
2727         requestAnimationFrame calls prevented user events from being handled, making it
2728         unresponsive.
2729         
2730         requestAnimationFrame uses callOnMainThread() to get a notification from the 
2731         CVDispayLink thread to the main thread, which is a -performSelectorOnMainThread...
2732         Under the hood, this ends up as a CFRunLoopPerformBlock().
2733         
2734         User events come in via Connection::enqueueIncomingMessage(), which uses RunLoop::main()::dispatch(),
2735         which uses a CFRunLoopSource. Evidently, repeated calls to CFRunLoopPerformBlock() can prevent the
2736         CFRunLoopSource from being handled.
2737         
2738         Fix by moving requestAnimationFrame from callOnMainThread() to RunLoop::main()::dispatch().
2739
2740         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
2741         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
2742
2743 2016-03-28  Chris Dumez  <cdumez@apple.com>
2744
2745         Disk cache speculative validation requests do not have the 'Referer' HTTP header set
2746         https://bugs.webkit.org/show_bug.cgi?id=155890
2747         <rdar://problem/25279962>
2748
2749         Reviewed by Antti Koivisto.
2750
2751         Export a couple more symbols so we can use them from WebKit2.
2752
2753         * platform/network/HTTPHeaderMap.h:
2754         * platform/network/ResourceRequestBase.h:
2755
2756 2016-03-24  Timothy Hatcher  <timothy@apple.com>
2757
2758         Web Automation: Add commands to compute layout of an element
2759
2760         https://bugs.webkit.org/show_bug.cgi?id=155841
2761         rdar://problem/25340075
2762
2763         Reviewed by Brian Burg.
2764
2765         * dom/Element.h: Mark scrollIntoViewIfNeeded() method as exported so WK2 can use it.
2766         * platform/ScrollView.h: Mark rootViewToContents(IntRect) method as exported so WK2 can use it.
2767
2768 2016-03-18  Timothy Hatcher  <timothy@apple.com>
2769
2770         Web Automation: Add Automation protocol commands to resolve frames as handles
2771
2772         https://bugs.webkit.org/show_bug.cgi?id=155650
2773         rdar://problem/25242422
2774
2775         Reviewed by Brian Burg.
2776
2777         * page/DOMWindow.h: Marked focus() method as exported so WK2 can use them.
2778         * page/FrameTree.h: Marked scopedChild() methods as exported so WK2 can use them.
2779
2780 2016-03-28  Konstantin Tokarev  <annulen@yandex.ru>
2781
2782         Remove USE(TEXTURE_MAPPER) guards inside TextureMapper sources.
2783         https://bugs.webkit.org/show_bug.cgi?id=155944
2784
2785         Reviewed by Michael Catanzaro.
2786
2787         After r196429 TextureMapper sources are built only in ports which actually
2788         use TextureMapper, so USE(TEXTURE_MAPPER) guards in them are redundant now.
2789
2790         No new tests needed.
2791
2792         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2793         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2794         * platform/graphics/texmap/TextureMapper.cpp:
2795         * platform/graphics/texmap/TextureMapper.h:
2796         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
2797         * platform/graphics/texmap/TextureMapperBackingStore.h:
2798         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
2799         * platform/graphics/texmap/TextureMapperFPSCounter.h:
2800         * platform/graphics/texmap/TextureMapperLayer.cpp:
2801         * platform/graphics/texmap/TextureMapperLayer.h:
2802         * platform/graphics/texmap/TextureMapperTile.cpp:
2803         * platform/graphics/texmap/TextureMapperTile.h:
2804         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
2805         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
2806
2807 2016-03-28  Manuel Rego Casasnovas  <rego@igalia.com>
2808
2809         [css-grid] Remove unneeded lines in offsetAndBreadthForPositionedChild()
2810         https://bugs.webkit.org/show_bug.cgi?id=155788
2811
2812         Reviewed by Sergio Villar Senin.
2813
2814         Just remove 2 lines/variables that were not needed at all in
2815         RenderGrid::offsetAndBreadthForPositionedChild().
2816
2817         No new tests, no change of behavior.
2818
2819         * rendering/RenderGrid.cpp:
2820         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2821
2822 2016-03-27  Konstantin Tokarev  <annulen@yandex.ru>
2823
2824         Removed redundant #if conditions in ANGLEWebKitBridge.h
2825         https://bugs.webkit.org/show_bug.cgi?id=155880
2826
2827         Reviewed by Csaba Osztrogon√°c.
2828
2829         GTK, Efl, AppleWin, and WinCairo ports can be built only with cmake,
2830         so condition !defined(BUILDING_WITH_CMAKE) implies
2831         !PLATFORM(GTK) && !PLATFORM(EFL) && !PLATOFRM(WIN).
2832
2833         No new tests needed.
2834
2835         * platform/graphics/ANGLEWebKitBridge.h:
2836
2837 2016-03-26  Alex Christensen  <achristensen@webkit.org>
2838
2839         Mac CMake build fix.
2840
2841         * PlatformMac.cmake:
2842         Link with AVFoundation libraries.
2843
2844 2016-03-25  Dean Jackson  <dino@apple.com>
2845
2846         Move extended color detection into Open Source
2847         https://bugs.webkit.org/show_bug.cgi?id=155909
2848         <rdar://problem/25369754>
2849
2850         Reviewed by Anders Carlsson.
2851
2852         The code for detecting extended color displays
2853         was hidden while the iPad Pro 9.7" was in development.
2854         Now it is public, move the detection to Open Source.
2855
2856         While doing this, add a new method to PlatformScreen
2857         so that we have a more obvious way to detect such
2858         displays.
2859
2860         * platform/PlatformScreen.h: Add screenSupportsExtendedColor.
2861
2862         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2863         (PlatformCALayerCocoa::commonInit): Set the backing
2864         store format to the RGBA10XR if we're on an extended
2865         display.
2866         * platform/ios/LegacyTileGridTile.mm:
2867         (WebCore::LegacyTileGridTile::LegacyTileGridTile): Ditto.
2868         (WebCore::setBackingStoreFormat): Deleted. Now set directly
2869         in the constructor.
2870
2871         * platform/ios/PlatformScreenIOS.mm:
2872         (WebCore::screenDepthPerComponent): Cleanup.
2873         (WebCore::screenSupportsExtendedColor): Implement the
2874         iOS version of this using MobileGestalt.
2875
2876         * platform/mac/PlatformScreenMac.mm:
2877         (WebCore::displayFromWidget): Whitespace cleanup.
2878         (WebCore::screenForWidget):
2879         (WebCore::screenForWindow):
2880         (WebCore::screenSupportsExtendedColor): Default implementation
2881         returns false for all screens at the moment.
2882
2883         * platform/spi/cocoa/QuartzCoreSPI.h: New constant.
2884         * platform/spi/ios/MobileGestaltSPI.h: Ditto.
2885
2886 2016-03-26  Myles C. Maxfield  <mmaxfield@apple.com>
2887
2888         [OS X] Layout  sometimes flakily assumes overlay scrollbars when clicky-scroll-wheel-mouse is attached and system preference detects scrollbar mode
2889         https://bugs.webkit.org/show_bug.cgi?id=155912
2890
2891         Reviewed by Simon Fraser.
2892
2893         When the system preference is set to detect the scrollbar type (overlay or
2894         always-on, and a clicky scroll wheel mouse is connected, AppKit
2895         asynchronously tells all the NSScrollerImpPairs about the kind of scrollbar
2896         it should be using. However, when this notification is delivered, it may
2897         be in between FrameViews, which means we may not have any
2898         NSScrollerImpPairs created to listen to the notification.
2899
2900         r198444 solved this by asking if we missed any update whenever we create
2901         an NSScrollerImpPair. This works partially; however, there is a significant
2902         amount of layout which occurs before we create the first ScrollAnimatorMac.
2903         This layout will ask the ScrollbarThemeMac if overlay scrollbars are
2904         enabled, and the results will be stale (because we haven't created any the
2905         NSScrollerImpPairs yet).
2906
2907         Luckly, AppKit fires a notification when it discovers what kind of
2908         scrollbars should be used. We can rely on this notification in the event
2909         that we don't have any NSScrollerImpPairs created.
2910
2911         Covered (as best as possible) by existing RTL scrollbar tests. However,
2912         the system preference that governs this is not currently testable.
2913
2914         * platform/mac/ScrollbarThemeMac.mm:
2915         (+[WebScrollbarPrefsObserver registerAsObserver]):
2916         * platform/mac/ScrollAnimatorMac.mm:
2917         (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):  Remove the old code.
2918
2919 2016-03-25  Jer Noble  <jer.noble@apple.com>
2920
2921         [Mac] Audio tracks in alternate groups are not represented correctly as AudioTracks
2922         https://bugs.webkit.org/show_bug.cgi?id=155891
2923         <rdar://problem/24841372>
2924
2925         Reviewed by Eric Carlson.
2926
2927         Test: media/track/video-track-alternate-groups.html
2928
2929         Previously, we created an AudioTrack for every AVPlayerItemTrack, and additionally, a
2930         AudioTrack for every AVMediaSelectionOption that did not have an associated AVAssetTrack.
2931         This caused a number of issues with various types of media, including media with fallback
2932         tracks.
2933
2934         Now, we will create an AudioTrack for every AVMediaSelectionOption, and only create an
2935         AudioTrack for every AVPlayerItem track if no AVMediaSelectionGroups (and thus no
2936         AVMediaSeletionOptions) exist.
2937
2938         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2939         (WebCore::determineChangedTracksFromNewTracksAndOldItems):
2940         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
2941
2942 2016-03-25  Zalan Bujtas  <zalan@apple.com>
2943
2944         RenderImage::repaintOrMarkForLayout fails when the renderer is detached.
2945         https://bugs.webkit.org/show_bug.cgi?id=155885
2946         <rdar://problem/25359164>
2947
2948         Reviewed by Simon Fraser.
2949
2950         Making containingBlockFor* functions standalone ensures that we don't
2951         call them on an invalid object. 
2952
2953         Covered by existing tests.
2954
2955         * dom/Element.cpp:
2956         (WebCore::layoutOverflowRectContainsAllDescendants):
2957         * rendering/LogicalSelectionOffsetCaches.h:
2958         (WebCore::LogicalSelectionOffsetCaches::LogicalSelectionOffsetCaches):
2959         * rendering/RenderElement.cpp:
2960         (WebCore::containingBlockForFixedPosition):
2961         (WebCore::containingBlockForAbsolutePosition):
2962         (WebCore::containingBlockForObjectInFlow):
2963         (WebCore::RenderElement::containingBlockForFixedPosition): Deleted.
2964         (WebCore::RenderElement::containingBlockForAbsolutePosition): Deleted.
2965         (WebCore::isNonRenderBlockInline): Deleted.
2966         (WebCore::RenderElement::containingBlockForObjectInFlow): Deleted.
2967         * rendering/RenderElement.h:
2968         * rendering/RenderInline.cpp:
2969         (WebCore::RenderInline::styleWillChange):
2970         * rendering/RenderObject.cpp:
2971         (WebCore::RenderObject::containingBlock):
2972
2973 2016-03-25  Dean Jackson  <dino@apple.com>
2974
2975         Remove use of extern "C" to include QuartzCore files
2976         https://bugs.webkit.org/show_bug.cgi?id=155905
2977         <rdar://problem/25364798>
2978
2979         Reviewed by Anders Carlson.
2980
2981         We can avoid having to wrap constants in extern "C", since they
2982         are mangled the same in both C and C++.
2983
2984         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: Now that
2985         QuartzCoreSPI.h has CABackdropLayer, remove the duplicate entry.
2986         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Ditto.
2987         * platform/spi/cocoa/QuartzCoreSPI.h: Include the framework private
2988         file. Repace EXTERN_C with "extern".
2989
2990 2016-03-25  Alex Christensen  <achristensen@webkit.org>
2991
2992         Add a compile time flag for using QTKit
2993         https://bugs.webkit.org/show_bug.cgi?id=155868
2994
2995         Reviewed by Daniel Bates.
2996
2997         * platform/graphics/MediaPlayer.cpp:
2998         (WebCore::buildMediaEnginesVector):
2999         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3000         * platform/graphics/mac/MediaTimeQTKit.h:
3001         * platform/graphics/mac/MediaTimeQTKit.mm:
3002         * platform/mac/WebVideoFullscreenController.mm:
3003         (SOFT_LINK_CLASS):
3004         (-[WebVideoFullscreenController setVideoElement:]):
3005         (-[WebVideoFullscreenController updatePowerAssertions]):
3006
3007 2016-03-25  Beth Dakin  <bdakin@apple.com>
3008
3009         Autoscrolling from a drag selection does not work in full screen, or when the 
3010         window is against the screen edge
3011         https://bugs.webkit.org/show_bug.cgi?id=155858
3012         -and corresponding-
3013         rdar://problem/9338465
3014
3015         Reviewed by Simon Fraser.
3016
3017         WebKit2 has always had this bug. Since WebKit1 scrolling in handled largely 
3018         by AppKit, we did not have this bug because AppKit adjusts the autoscroll 
3019         amount whenever the window is at the edge of the screen and the user is 
3020         trying to autoscroll in that direction. This patch employs the same technique 
3021         in WebCore.
3022
3023         Instead of using EventHandler::lastKnownMousePosition() as the autoscroll 
3024         amount, use EventHandler::effectiveMousePositionForSelectionAutoscroll() 
3025         which will adjust the lastKnownMousePosition if the window is at the edge of 
3026         the screen.
3027         * page/AutoscrollController.cpp:
3028         (WebCore::AutoscrollController::autoscrollTimerFired):
3029
3030         For most ports, effectiveMousePositionForSelectionAutoscroll() will just 
3031         return m_lastKnownMousePosition. We override it in EventHandlerMac to return 
3032         an adjusted amount.
3033         * page/EventHandler.cpp:
3034         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll):
3035         * page/EventHandler.h:
3036         * page/mac/EventHandlerMac.mm:
3037         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
3038         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll):
3039
3040         Make screenForDisplayID available as on PlatformScreen.h instead of just 
3041         being a static function in the implementation file.
3042         * platform/PlatformScreen.h:
3043         * platform/mac/PlatformScreenMac.mm:
3044         (WebCore::screenForDisplayID):
3045
3046 2016-03-25  Brady Eidson  <beidson@apple.com>
3047
3048         Soften push/replaceState frequency restrictions.
3049         <rdar://problem/25228439> and https://bugs.webkit.org/show_bug.cgi?id=155901
3050
3051         Rubber-stamped by Timothy Hatcher.
3052
3053         Covered by existing LayoutTests and a new Manual Test.
3054
3055         * page/History.cpp:
3056         (WebCore::History::stateObjectAdded): Allow 100 state object operations every 30 seconds.
3057         * page/History.h:
3058
3059 2016-03-24  Enrica Casucci  <enrica@apple.com>
3060
3061         Data Detection creates multiple links even when the detected content is within the same node.
3062         https://bugs.webkit.org/show_bug.cgi?id=155860
3063         rdar://problem/25319579
3064
3065         Reviewed by Tim Horton.
3066
3067         If the detected content spans over multiple query fragments,
3068         we need to check if consecutive fragments are all within the
3069         same node. This way we can avoid creating multiple ranges and
3070         consequntly more links.
3071
3072         * editing/cocoa/DataDetection.mm:
3073         (WebCore::DataDetection::detectContentInRange):
3074
3075 2016-03-23  Dave Hyatt  <hyatt@apple.com>
3076
3077         Implement the allow-end value of the hanging-punctuation CSS property.
3078         https://bugs.webkit.org/show_bug.cgi?id=104996
3079
3080         Reviewed by Simon Fraser.
3081
3082         Added new tests in fast/text.
3083
3084         * rendering/RenderBlockLineLayout.cpp:
3085         (WebCore::RenderBlockFlow::constructLine):
3086         Fix a bug where empty RenderInlines were incorrectly excluding their end borders if
3087         they occurred at the end of a line. Needed to adequately test allow-end and empty
3088         inline borders.
3089
3090         * rendering/RenderText.cpp:
3091         (WebCore::RenderText::isHangableStopOrComma):
3092         Helper function that identifies the hangable stops and commas.
3093
3094         * rendering/RenderText.h:
3095         Add new isHangableStopOrComma function to RenderText.
3096
3097         * rendering/line/BreakingContext.h:
3098         (WebCore::BreakingContext::lineBreak):
3099         (WebCore::BreakingContext::lineWidth):
3100         (WebCore::BreakingContext::atEnd):
3101         (WebCore::BreakingContext::fitsOnLineOrHangsAtEnd):
3102         (WebCore::BreakingContext::clearLineBreakIfFitsOnLine):
3103         (WebCore::BreakingContext::commitLineBreakAtCurrentWidth):
3104         (WebCore::BreakingContext::handleBR):
3105         (WebCore::BreakingContext::handleEmptyInline):
3106         (WebCore::BreakingContext::handleReplaced):
3107         (WebCore::tryHyphenating):
3108         (WebCore::BreakingContext::computeAdditionalBetweenWordsWidth):
3109         (WebCore::BreakingContext::handleText):
3110         (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
3111         Modified breaking rules to handle allow-end. The basic idea is to see if you can
3112         fit without the comma and only hang if you do, and if nothing else gets added to the
3113         line after the comma. This involves tracking a new state, m_hangsAtEnd, that can
3114         be set/cleared while iterating over the objects that will end up on the line.
3115
3116 2016-03-25  Alex Christensen  <achristensen@webkit.org>
3117
3118         Revert most of r198673.
3119
3120         * platform/graphics/MediaPlayer.cpp:
3121         (WebCore::buildMediaEnginesVector):
3122         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3123         * platform/graphics/mac/MediaTimeQTKit.h:
3124         * platform/graphics/mac/MediaTimeQTKit.mm:
3125         * platform/mac/WebVideoFullscreenController.mm:
3126
3127 2016-03-25  Alex Christensen  <achristensen@webkit.org>
3128
3129         Add a compile time flag for using QTKit
3130         https://bugs.webkit.org/show_bug.cgi?id=155868
3131
3132         Reviewed by Dan Bates.
3133
3134         * platform/graphics/MediaPlayer.cpp:
3135         (WebCore::buildMediaEnginesVector):
3136         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3137         * platform/graphics/mac/MediaTimeQTKit.h:
3138         * platform/graphics/mac/MediaTimeQTKit.mm:
3139         * platform/mac/WebVideoFullscreenController.mm:
3140
3141 2016-03-25  Brent Fulgham  <bfulgham@apple.com>
3142
3143         [Win] Improve CMake build performance 
3144         https://bugs.webkit.org/show_bug.cgi?id=155871
3145         <rdar://problem/24747822>
3146
3147         Reviewed by Alex Christensen.
3148
3149         Treat DerivedSources.cpp as an 'All-in-one' file. Pass a flag to the
3150         PROCESS_ALLINONE_FILE macro so that it does not remove the contents of
3151         the file, since this breaks dependency checking and generation of the
3152         sources from the IDL files. Instead, include the header files in the
3153         project so that all files get generated.        
3154         
3155         * CMakeLists.txt: Updated for 'DerivedSources.cpp'
3156         * DerivedSources.cpp: Add some generated files that were missing.
3157
3158 2016-03-25  Youenn Fablet  <youenn.fablet@crf.canon.fr>
3159
3160         [Fetch API] Add basic loading of resources
3161         https://bugs.webkit.org/show_bug.cgi?id=155637
3162
3163         Reviewed by Darin Adler.
3164
3165         Adding support for basic fetch for Window (no support for Worker yet).
3166         A FetchResponse object is created for every fetch task.
3167         But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved.
3168
3169         Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method.
3170
3171         Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise.
3172
3173         Tests: http/tests/fetch/closing-while-fetching.html
3174                http/tests/fetch/get-response-body-while-loading.html
3175         Also covered by rebased tests.
3176
3177         * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching.
3178         (WebCore::DOMWindowFetch::fetch):
3179         * Modules/fetch/DOMWindowFetch.h:
3180         * Modules/fetch/FetchBody.cpp:
3181         (WebCore::FetchBody::consume):
3182         (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer.
3183         (WebCore::FetchBody::consumeText): Passing the promise as a reference.
3184         (WebCore::blobFromArrayBuffer): Helper routine.
3185         (WebCore::FetchBody::fulfillTextPromise): Helper routine.
3186         (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer.
3187         (WebCore::FetchBody::loadedAsText):
3188         (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request.
3189         (WebCore::FetchBody::extractFromText):
3190         * Modules/fetch/FetchBody.h:
3191         (WebCore::FetchBody::loadingBody):
3192         (WebCore::FetchBody::FetchBody):
3193         * Modules/fetch/FetchBodyOwner.cpp:
3194         (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore
3195         but will directly call failure callbacks.
3196         (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines.
3197         (WebCore::FetchBodyOwner::finishBlobLoading):
3198         * Modules/fetch/FetchBodyOwner.h:
3199         (WebCore::FetchBodyOwner::body):
3200         (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer):
3201         * Modules/fetch/FetchHeaders.cpp:
3202         (WebCore::FetchHeaders::fill):
3203         (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered.
3204         * Modules/fetch/FetchHeaders.h:
3205         (WebCore::FetchHeaders::internalHeaders):
3206         * Modules/fetch/FetchLoader.cpp:
3207         (WebCore::FetchLoader::start):
3208         (WebCore::FetchLoader::didFailRedirectCheck):
3209         * Modules/fetch/FetchLoader.h:
3210         * Modules/fetch/FetchRequest.cpp:
3211         (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader.
3212        * Modules/fetch/FetchRequest.h:
3213         * Modules/fetch/FetchResponse.cpp:
3214         (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request.
3215         (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback.
3216         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
3217         (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
3218         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto.
3219         (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto.
3220         (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader.
3221         (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader.
3222         (WebCore::FetchResponse::stop): Stop loader if any.
3223         * Modules/fetch/FetchResponse.h:
3224         * platform/network/BlobResourceHandle.cpp:
3225         (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET.
3226         (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers.
3227         (WebCore::BlobResourceHandle::createAsync): Removing GET verb check.
3228
3229 2016-03-25  Konstantin Tokarev  <annulen@yandex.ru>
3230
3231         Removed leftovers of WCHAR_UNICODE code path after r162782.
3232         https://bugs.webkit.org/show_bug.cgi?id=155881
3233
3234         Reviewed by Csaba Osztrogon√°c.
3235
3236         No new tests needed.
3237
3238         * platform/text/TextEncodingDetectorNone.cpp: Removed.
3239         * platform/text/wchar/TextBreakIteratorWchar.cpp: Removed.
3240
3241 2016-03-24  Alex Christensen  <achristensen@webkit.org>
3242
3243         Fix Mac CMake build.
3244
3245         * PlatformMac.cmake:
3246         Add new file and directory.
3247
3248 2016-03-24  Chris Dumez  <cdumez@apple.com>
3249
3250         Unreviewed, rolling out r198500.
3251
3252         Roll back in r197552 as it did not seem to cause a PLT
3253         regression after all
3254
3255         Reverted changeset:
3256
3257         "Unreviewed, rolling out r197552."
3258         https://bugs.webkit.org/show_bug.cgi?id=154986
3259         http://trac.webkit.org/changeset/198500
3260
3261 2016-03-24  Daniel Bates  <dabates@apple.com>
3262
3263         CSP: Move logic for reporting a violation from ContentSecurityPolicyDirectiveList to ContentSecurityPolicy
3264         https://bugs.webkit.org/show_bug.cgi?id=155842
3265         <rdar://problem/25340377>
3266         And
3267         https://bugs.webkit.org/show_bug.cgi?id=155133
3268
3269         Reviewed by Brent Fulgham.
3270
3271         Towards associating source file, line-, and column- numbers (https://bugs.webkit.org/show_bug.cgi?id=114317)
3272         with a CSP console message we should move the logic for logging the console message/reporting the violation
3273         from class ContentSecurityPolicyDirectiveList to class ContentSecurityPolicy so that it is closer to the
3274         script execution context that can access such information.
3275
3276         The responsibilities of the class ContentSecurityPolicyDirectiveList have been reduced. It is responsible
3277         for parsing a string representation of the Content Security Policy and providing functions to determine
3278         the violated directive (if any) for a given source (e.g. URL). ContentSecurityPolicyDirectiveList no longer
3279         takes responsibility logging a console message or sending a violation report (if applicable). Falling out
3280         from this decrease in responsibility is the removal of enum ContentSecurityPolicyDirectiveList::ReportingStatus
3281         and the need to pass a enumerator of this enum to each ContentSecurityPolicyDirectiveList to suppress
3282         the sending of a violation report. The caller of ContentSecurityPolicyDirectiveList is responsible for
3283         making this determination.
3284
3285         With the exception of a change to the error message for an inline event handler violation, there are no
3286         other functional changes. When an inline event handler violation occurs we will emit either:
3287
3288             Refused to execute a script for an inline event handler because 'unsafe-inline' does not appear in the
3289             script-src directive of the Content Security Policy.
3290
3291         Or:
3292
3293             Refused to execute a script for an inline event handler because 'unsafe-inline' appears in neither the
3294             script-src directive nor the default-src directive of the Content Security Policy.
3295
3296         depending on whether the Content Security Policy contains a script-src directive or not.
3297
3298         * CMakeLists.txt: Add files ContentSecurityPolicyDirective.cpp and ContentSecurityPolicyDirectiveNames.cpp.
3299         * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyDirective.cpp and ContentSecurityPolicyDirectiveNames.{cpp, h}.
3300         * page/csp/ContentSecurityPolicy.cpp:
3301         (WebCore::consoleMessageForViolation): Moved from file ContentSecurityPolicyDirectiveList.cpp and
3302         incorporates the functionality of ContentSecurityPolicyDirectiveList::reportViolation(). Modified
3303         to take a reference to the violated directive (ContentSecurityPolicyDirective object) and removed
3304         the boolean parameter violatesDefaultSrc as we can deduce this from the violated directive.
3305         (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to call ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeEval().
3306         (WebCore::ContentSecurityPolicy::foundHashOfContentInAllPolicies): Renamed; Formerly named allPoliciesAllowHashFromContent.
3307         Modified to early return if either no algorithms are given or the specified content to hash is
3308         the empty string.
3309         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Moved logic for reporting a violation from
3310         ContentSecurityPolicyDirectiveList member function of the same name to here.
3311         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Moved logic for reporting a violation from
3312         ContentSecurityPolicyDirectiveList member function of the same name to here. Additionally, changed the
3313         error message text to better describe the reason for the violation.
3314         (WebCore::ContentSecurityPolicy::allowScriptWithNonce): Ditto.
3315         (WebCore::ContentSecurityPolicy::allowStyleWithNonce): Ditto.
3316         (WebCore::ContentSecurityPolicy::allowInlineScript): Ditto.
3317         (WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
3318         (WebCore::ContentSecurityPolicy::allowEval): Ditto.
3319         (WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
3320         (WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
3321         (WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
3322         (WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
3323         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
3324         (WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
3325         (WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
3326         (WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
3327         (WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
3328         (WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
3329         (WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
3330         (WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
3331         (WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
3332         (WebCore::ContentSecurityPolicy::reportViolation): Simplified signature by having it take a reference to
3333         a ContentSecurityPolicyDirective object. Also split functionality into two variants: one variant takes a
3334         pointer to a JSC::ExecState, one variant takes a source file, and line and column positions.
3335         (WebCore::ContentSecurityPolicy::allPoliciesAllowHashFromContent): Deleted.
3336         (WebCore::ContentSecurityPolicy::gatherReportURIs): Deleted.
3337         * page/csp/ContentSecurityPolicy.h:
3338         (WebCore::ContentSecurityPolicy::violatedDirectiveInAnyPolicy): Formerly named allPoliciesAllow. Modified
3339         to return the violated directive.
3340         (WebCore::ContentSecurityPolicy::allPoliciesAllow): Deleted.
3341         * page/csp/ContentSecurityPolicyDirective.cpp: Added.
3342         * page/csp/ContentSecurityPolicyDirective.h: Added.
3343         (WebCore::ContentSecurityPolicyDirective::ContentSecurityPolicyDirective): Modified to take a reference to the
3344         directive list that contains this directive instead of pointer to a ContentSecurityPolicy object.
3345         (WebCore::ContentSecurityPolicyDirective::name): Added.
3346         (WebCore::ContentSecurityPolicyDirective::directiveList): Added.
3347         (WebCore::ContentSecurityPolicyDirective::isDefaultSrc): Added.
3348         (WebCore::ContentSecurityPolicyDirective::policy): Deleted.
3349         * page/csp/ContentSecurityPolicyDirectiveList.cpp: Remove unused header <wtf/Optional.h>. Also remove header wtf/text/StringBuilder.h
3350         as the function that made use of it, consoleMessageForViolation, was moved to file ContentSecurityPolicy.cpp.
3351         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeEval): Formerly named allowEval.
3352         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineScript): Formerly named allowInlineScript.
3353         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineStyle): Formerly named allowInlineStyle.
3354         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScriptHash): Formerly named allowInlineScriptWithHash.
3355         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleHash): Formerly named allowInlineStyleWithHash.
3356         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScriptNonce): Formerly named allowScriptWithNonce.
3357         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleNonce): Formerly named allowStyleWithNonce.
3358         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForBaseURI): Formerly named allowBaseURI.
3359         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForChildContext): Formerly named allowChildContextFromSource.
3360         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForConnectSource): Formerly named allowConnectToSource.
3361         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFont): Formerly named allowFontFromSource.
3362         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFormAction): Formerly named allowFormAction.
3363         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrame): Formerly named allowChildFrameFromSource.
3364         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestor): Formerly named allowFrameAncestors.
3365         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForImage): Formerly named allowImageFromSource.
3366         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForMedia): Formerly named allowMediaFromSource.
3367         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Formerly named allowObjectFromSource.
3368         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForPluginType): Formerly named allowPluginType.
3369         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript): Formerly named allowScriptFromSource.
3370         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyle): Formerly named allowStyleFromSource.
3371         (WebCore::ContentSecurityPolicyDirectiveList::parse): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
3372         (WebCore::ContentSecurityPolicyDirectiveList::setCSPDirective): Pass |this| instead of the ContentSecurityPolicy object.
3373         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
3374         (WebCore::isExperimentalDirectiveName): Deleted.
3375         (WebCore::isCSPDirectiveName): Deleted.
3376         (WebCore::ContentSecurityPolicyDirectiveList::reportViolation): Deleted.
3377         (WebCore::consoleMessageForViolation): Deleted.
3378         (WebCore::ContentSecurityPolicyDirectiveList::allowJavaScriptURLs): Deleted.
3379         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineEventHandlers): Deleted.
3380         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineScript): Deleted.
3381         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash): Deleted.
3382         (WebCore::ContentSecurityPolicyDirectiveList::allowScriptWithNonce): Deleted.
3383         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyle): Deleted.
3384         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash): Deleted.
3385         (WebCore::ContentSecurityPolicyDirectiveList::allowStyleWithNonce): Deleted.
3386         (WebCore::ContentSecurityPolicyDirectiveList::allowEval): Deleted.
3387         (WebCore::ContentSecurityPolicyDirectiveList::allowPluginType): Deleted.
3388         (WebCore::ContentSecurityPolicyDirectiveList::allowScriptFromSource): Deleted.
3389         (WebCore::ContentSecurityPolicyDirectiveList::allowObjectFromSource): Deleted.
3390         (WebCore::ContentSecurityPolicyDirectiveList::allowChildContextFromSource): Deleted.
3391         (WebCore::ContentSecurityPolicyDirectiveList::allowChildFrameFromSource): Deleted.
3392         (WebCore::ContentSecurityPolicyDirectiveList::allowImageFromSource): Deleted.
3393         (WebCore::ContentSecurityPolicyDirectiveList::allowStyleFromSource): Deleted.
3394         (WebCore::ContentSecurityPolicyDirectiveList::allowFontFromSource): Deleted.
3395         (WebCore::ContentSecurityPolicyDirectiveList::allowMediaFromSource): Deleted.
3396         (WebCore::ContentSecurityPolicyDirectiveList::allowConnectToSource): Deleted.
3397         (WebCore::ContentSecurityPolicyDirectiveList::allowFormAction): Deleted.
3398         (WebCore::ContentSecurityPolicyDirectiveList::allowBaseURI): Deleted.
3399         (WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Deleted.
3400         * page/csp/ContentSecurityPolicyDirectiveList.h:
3401         (WebCore::ContentSecurityPolicyDirectiveList::defaultSrc): Added.
3402         (WebCore::ContentSecurityPolicyDirectiveList::policy): Added. Also added FIXME comment to remove this function. This
3403         function is only used by ContentSecurityPolicyMediaListDirective so that it can log a console message on a parsing error.
3404         (WebCore::ContentSecurityPolicyDirectiveList::denyIfEnforcingPolicy): Deleted.
3405         * page/csp/ContentSecurityPolicyDirectiveNames.cpp: Added.
3406         * page/csp/ContentSecurityPolicyDirectiveNames.h: Added.
3407         * page/csp/ContentSecurityPolicyMediaListDirective.cpp:
3408         (WebCore::ContentSecurityPolicyMediaListDirective::ContentSecurityPolicyMediaListDirective): Modified to take a reference to the
3409         directive list that contains this directive instead of pointer to a ContentSecurityPolicy object.
3410         (WebCore::ContentSecurityPolicyMediaListDirective::parse): Updated code to use ContentSecurityPolicyDirectiveList::policy() instead
3411         of ContentSecurityPolicyDirective::policy() as the latter was removed. Ideally this class should not need to use the ContentSecurityPolicy
3412         object to log a console message.
3413         * page/csp/ContentSecurityPolicyMediaListDirective.h:
3414         * page/csp/ContentSecurityPolicySourceList.cpp:
3415         (WebCore::isExperimentalDirectiveName): Moved from file ContentSecurityPolicyDirectiveList.cpp because this function is only used
3416         in this file.
3417         (WebCore::isCSPDirectiveName): Ditto.
3418         (WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
3419         * page/csp/ContentSecurityPolicySourceListDirective.cpp:
3420         (WebCore::ContentSecurityPolicySourceListDirective::ContentSecurityPolicySourceListDirective): Modified to take a reference to
3421         the directive list that contains this directive instead of pointer to a ContentSecurityPolicy object. 
3422         * page/csp/ContentSecurityPolicySourceListDirective.h:
3423
3424 2016-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
3425
3426         [OS X] Overflow:scroll scrollbars do not obey overlay/always-on system preference changes
3427         https://bugs.webkit.org/show_bug.cgi?id=155830
3428
3429         Reviewed by Simon Fraser.
3430
3431         When the scrollbar style changes, the available width of all ScrollableAreas change,
3432         and therefore a relayout must occur.
3433
3434         Each ScrollableArea owns its own ScrollAnimator (if necessary). Upon creation, the
3435         ScrollAnimator will start listening for changes to the system preference for
3436         overlay / always-on scrollbars. When notified, the ScrollAnimator tells its owning
3437         ScrollableArea that scrollbarStyleChanged().
3438
3439         For main-frame scrolling, FrameView overrides scrollbarStyleChanged and causes a
3440         relayout. However, for overflow:scroll elements, no relayout is triggered. This
3441         patch overrides availableContentSizeChanged() for RenderLayer (which is used for
3442         overflow:scroll elements). This override triggers a relayout.
3443
3444         It also updates the mechanism in RenderBlock::recomputeLogicalWidth() to ensure that
3445         a change in scrollbar size causes RenderBlockFlow::layoutBlock() to relayout its
3446         children. This is appropriate because block child positioning is affected by
3447         scrollbar size.
3448
3449         No new tests (for now). Presumably we could mock the message we receive when the
3450         system preference is changed. However, I haven't implemented that yet.
3451
3452         * rendering/RenderBlock.cpp: Rename setHasBorderOrPaddingLogicalWidthChanged().
3453         (WebCore::RenderBlock::styleDidChange):
3454         (WebCore::RenderBlock::recomputeLogicalWidth):
3455         * rendering/RenderBlock.h: Ditto.
3456         (WebCore::RenderBlock::setShouldForceRelayoutChildren):
3457         (WebCore::RenderBlock::shouldForceRelayoutChildren):
3458         * rendering/RenderElement.cpp: Ditto.
3459         (WebCore::RenderElement::RenderElement):
3460         * rendering/RenderElement.h: Ditto.
3461         (WebCore::RenderElement::setRenderBlockShouldForceRelayoutChildren):
3462         (WebCore::RenderElement::renderBlockShouldForceRelayoutChildren):
3463         * rendering/RenderLayer.cpp:
3464         (WebCore::RenderLayer::availableContentSizeChanged): Cause a relayout to occur.
3465         * rendering/RenderLayer.h:
3466
3467 2016-03-24  Said Abou-Hallawa  <sabouhallawa@apple,com>
3468
3469         Change NativeImagePtr for CG to be RetainPtr<CGImageRef>
3470         https://bugs.webkit.org/show_bug.cgi?id=155412
3471
3472         Reviewed by Darin Adler.
3473
3474         Having NativeImagePtr as a raw pointer makes managing the life cycle of
3475         the returned CGImageRef hard. A lot of work was done to ensure the CG
3476         pointer is refcounted correctly. It was also not possible to move a
3477         FrameData since calling the destructor was releasing the CGImageRef.
3478
3479         With this change, PassNativeImagePtr is not needed anymore. So all the
3480         instance of PassNativeImagePtr can be replaced by NativeImagePtr.
3481
3482         * html/HTMLVideoElement.cpp:
3483         (WebCore::HTMLVideoElement::nativeImageForCurrentTime):
3484         * html/HTMLVideoElement.h: Replace PassNativeImagePtr with NativeImagePtr.
3485
3486         * html/canvas/CanvasRenderingContext2D.cpp:
3487         (WebCore::CanvasRenderingContext2D::drawImage): Replace PassNativeImagePtr
3488         with NativeImagePtr.
3489  
3490         * loader/cache/MemoryCache.cpp:
3491         (WebCore::MemoryCache::addImageToCache):
3492         * loader/cache/MemoryCache.h: Remove USE(CG) and CFRetain(image) since
3493         this code can compile on all platforms. The image refcount will be
3494         incremented when the image is assigned to FrameData.m_image in the
3495         BitmapImage constructor.
3496
3497         * loader/icon/IconDatabase.cpp:
3498         (WebCore::IconDatabase::synchronousNativeIconForPageURL):
3499         * loader/icon/IconDatabase.h:
3500         * loader/icon/IconDatabaseBase.h: Replace PassNativeImagePtr with NativeImagePtr.
3501
3502         * platform/graphics/BitmapImage.cpp:
3503         (WebCore::BitmapImage::haveFrameImageAtIndex):
3504         (WebCore::BitmapImage::cacheFrame):
3505         (WebCore::BitmapImage::ensureFrameIsCached):
3506         (WebCore::BitmapImage::frameImageAtIndex):
3507         (WebCore::BitmapImage::nativeImageForCurrentFrame):
3508         (WebCore::BitmapImage::haveFrameAtIndex): Deleted.
3509         (WebCore::BitmapImage::frameAtIndex): Deleted.
3510         Replace PassNativeImagePtr with NativeImagePtr, m_frame with m_image and
3511         *Frame* with *FrameImage*.
3512
3513         * platform/graphics/BitmapImage.h:
3514         (WebCore::FrameData::FrameData):
3515         A BitmapImage can have one or more FrameData. A FrameData member can be
3516         named for shortness as "frame", "m_frames", etc. A FrameData can have
3517         zero or one NativeImagePtr. A NativeImagePtr can be named as "image",
3518         "m_image", etc.
3519
3520         * platform/graphics/GraphicsContext.h: Replace PassNativeImagePtr with
3521         NativeImagePtr.
3522
3523         * platform/graphics/GraphicsContext3D.h:
3524         * platform/graphics/Icon.h:
3525         Change the members of type CGImageRef to be RetainPtr<CGImageRef>.
3526                 
3527         * platform/graphics/Image.h:
3528         (WebCore::Image::nativeImageForCurrentFrame):
3529         (WebCore::Image::getNSImage):
3530         (WebCore::Image::getTIFFRepresentation):
3531         (WebCore::Image::getCGImageRef):
3532         (WebCore::Image::getFirstCGImageRefOfSize):
3533         (WebCore::Image::getCGImageArray):
3534         (WebCore::Image::getGdkPixbuf):
3535         (WebCore::Image::getEvasObject):
3536         * platform/graphics/ImageBuffer.h:
3537         * platform/graphics/ImageSource.cpp:
3538         (WebCore::ImageSource::createFrameImageAtIndex):
3539         (WebCore::ImageSource::createFrameAtIndex): Deleted.
3540         * platform/graphics/ImageSource.h:
3541         Change 0 to nullptr, PassRefPtr to RefPtr and PassNativeImagePtr to
3542         NativeImagePtr.
3543
3544         * platform/graphics/MediaPlayer.cpp:
3545         (WebCore::MediaPlayer::nativeImageForCurrentTime):
3546         * platform/graphics/MediaPlayer.h:
3547         * platform/graphics/MediaPlayerPrivate.h:
3548         (WebCore::MediaPlayerPrivateInterface::nativeImageForCurrentTime):
3549         Replace PassNativeImagePtr with NativeImagePtr.
3550
3551         * platform/graphics/NativeImagePtr.h:
3552         Make NativeImagePtr a smart pointer for CG. Get rid of PassNativeImagePtr
3553         since NativeImagePtr is now a smart pointer on all platforms.
3554
3555         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3556         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3557         (WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
3558         Replace PassNativeImagePtr with NativeImagePtr.
3559
3560         * platform/graphics/ca/GraphicsLayerCA.cpp:
3561         (WebCore::GraphicsLayerCA::setContentsToImage):
3562         Since Image::nativeImageForCurrentFrame() returns a RetainPtr, move it
3563         to m_pendingContentsImage to remove the refcount churn.
3564
3565         * platform/graphics/cairo/BitmapImageCairo.cpp:
3566         (WebCore::BitmapImage::BitmapImage):
3567         (WebCore::BitmapImage::draw):
3568         (WebCore::BitmapImage::checkForSolidColor):
3569         (WebCore::FrameData::clear):
3570         Replace m_frame with m_image and frame* with frameImage*.
3571
3572         * platform/graphics/cairo/CairoUtilities.cpp:
3573         (WebCore::copyCairoImageSurface):
3574         * platform/graphics/cairo/CairoUtilities.h:
3575         Replace PassRefPtr with RefPtr.
3576
3577         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3578         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3579         Replace *Frame* with *FrameImage*.
3580
3581         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3582         (WebCore::GraphicsContext::drawNativeImage):
3583         Replace PassNativeImagePtr with NativeImagePtr.
3584
3585         * platform/graphics/cairo/ImageBufferCairo.cpp:
3586         (WebCore::ImageBuffer::copyImage): Create a new NativeImagePtr so it can
3587         be moved to the BitmapImage::create().
3588         (WebCore::copySurfaceToImageAndAdjustRect):
3589         (WebCore::getImageData):
3590         (WebCore::ImageBuffer::getUnmultipliedImageData):
3591         (WebCore::ImageBuffer::getPremultipliedImageData):
3592         Replace PassRefPtr with RefPtr.
3593
3594         * platform/graphics/cg/BitmapImageCG.cpp:
3595         (WebCore::FrameData::clear): No need to call CGImageRelease(). Just assign
3596         m_image to nullptr and CGImageRelease() will be called from the RetainPtr
3597         destructor.
3598
3599         (WebCore::BitmapImage::BitmapImage):
3600         (WebCore::BitmapImage::checkForSolidColor):
3601         (WebCore::BitmapImage::getCGImageRef):
3602         (WebCore::BitmapImage::getFirstCGImageRefOfSize):
3603         (WebCore::BitmapImage::getCGImageArray):
3604         (WebCore::BitmapImage::draw):
3605         (WebCore::BitmapImage::copyUnscaledFrameImageAtIndex):
3606         (WebCore::BitmapImage::copyUnscaledFrameAtIndex): Deleted.
3607         Replace CGImageRef with RetainPtr<CGImageRef>. Replace *Frame* with
3608         *FrameImage*.
3609
3610         * platform/graphics/cg/GraphicsContext3DCG.cpp:
3611         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3612         (WebCore::GraphicsContext3D::paintToCanvas):
3613         Use m_cgImage.get() instead of m_cgImage when calling CG functions.
3614
3615         * platform/graphics/cg/GraphicsContextCG.cpp:
3616         (WebCore::GraphicsContext::drawNativeImage):
3617         (WebCore::GraphicsContext::drawPattern):
3618         Replace PassNativeImagePtr with NativeImagePtr. Get the raw CGImageRef
3619         from the NativeImagePtr when calling the CG functions.
3620         
3621         * platform/graphics/cg/ImageBufferCG.cpp:
3622         (WebCore::createBitmapImageAfterScalingIfNeeded): Move the image argument
3623         when calling BitmapImage::create().
3624         
3625         (WebCore::ImageBuffer::getUnmultipliedImageData):
3626         (WebCore::ImageBuffer::getPremultipliedImageData):
3627         Replace PassRefPtr with RefPtr.
3628         
3629         * platform/graphics/cg/ImageSourceCG.cpp:
3630         (WebCore::ImageSource::createFrameImageAtIndex):
3631         (WebCore::ImageSource::createFrameAtIndex): Deleted.
3632         Rename the function and simplify the code since the local variable
3633         and the return value are both smart pointers.
3634         
3635         * platform/graphics/displaylists/DisplayListItems.cpp:
3636         (WebCore::DisplayList::DrawNativeImage::DrawNativeImage):
3637         (WebCore::DisplayList::DrawNativeImage::apply):
3638         * platform/graphics/displaylists/DisplayListItems.h:
3639         (WebCore::DisplayList::DrawNativeImage::create):
3640         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3641         (WebCore::DisplayList::Recorder::drawNativeImage):
3642         * platform/graphics/displaylists/DisplayListRecorder.h:
3643         Replace PassNativeImagePtr with NativeImagePtr and use constant reference. 
3644         
3645         * platform/graphics/efl/GraphicsContext3DEfl.cpp:
3646         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3647         Call a function with its new name.
3648         
3649         * platform/graphics/efl/IconEfl.cpp:
3650         (WebCore::Icon::createIconForFiles):
3651         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
3652         (ImageGStreamer::ImageGStreamer):
3653         * platform/graphics/gtk/IconGtk.cpp:
3654         (WebCore::Icon::createIconForFiles):
3655         * platform/graphics/ios/IconIOS.mm:
3656         (WebCore::Icon::Icon):
3657         (WebCore::Icon::createIconForFiles):
3658         (WebCore::Icon::createIconForImage):
3659         * platform/graphics/mac/IconMac.mm:
3660         (WebCore::Icon::createIconForFiles):
3661         Use smart pointers RetainPtr<CGImageRef> instead of raw pointers CGImageRef.
3662         And change PassRefPtr to RefPtr and 0 to nullptr.
3663         
3664         * platform/graphics/mac/ImageMac.mm:
3665         (WebCore::BitmapImage::getTIFFRepresentation): Get the raw pointer from the
3666         returned smart pointer.
3667         
3668         * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp:
3669         (WebCore::CoordinatedSurface::create):
3670         * platform/graphics/texmap/coordinated/CoordinatedSurface.h:
3671         Replace PassRefPtr with RefPtr.
3672
3673         * platform/graphics/win/IconWin.cpp:
3674         (WebCore::Icon::createIconForFiles): Change PassRefPtr to RefPtr.
3675         
3676         * platform/graphics/win/ImageCGWin.cpp:
3677         (WebCore::BitmapImage::create): Replace PassRefPtr with RefPtr.
3678         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Call the function
3679         with its new name and get the raw pointer from the returned smart pointer.
3680         
3681         * platform/graphics/win/ImageCairoWin.cpp:
3682         (WebCore::BitmapImage::create): Replace PassRefPtr with ReftPtr and use
3683         the move semantics for passing the argument to BitmapImage::create().
3684         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Call the function
3685         with its new name.
3686         
3687         * platform/image-decoders/ImageDecoder.h:
3688         * platform/image-decoders/cairo/ImageDecoderCairo.cpp:
3689         (WebCore::ImageFrame::asNewNativeImage):
3690         * platform/win/DragImageCGWin.cpp:
3691         (WebCore::createDragImageFromImage):
3692         * svg/graphics/SVGImage.cpp:
3693         (WebCore::SVGImage::nativeImageForCurrentFrame):
3694         * svg/graphics/SVGImage.h:
3695         * svg/graphics/SVGImageForContainer.cpp:
3696         (WebCore::SVGImageForContainer::nativeImageForCurrentFrame):
3697         * svg/graphics/SVGImageForContainer.h:
3698         Replace PassNativeImagePtr with NativeImagePtr.
3699         
3700 2016-03-24  Jer Noble  <jer.noble@apple.com>
3701
3702         Safari Crashes if audio.src is changed while connected to AudioAnalyserNode
3703         https://bugs.webkit.org/show_bug.cgi?id=153593
3704         <rdar://problem/23648082>
3705
3706         Reviewed by Eric Carlson.
3707
3708         m_ringBuffer is accessed on the high-priority WebAudio thread after it has been cleared (a
3709         null-deref). Protect against unsafe access on multiple threads of a non-refcounted object by
3710         a simple try_lock.
3711
3712         Additionally, limit the use of variables in use by both the separate WebAudio thread method
3713         (provideInput()) and AVAudioMix thread method (process()) where possible, and convert to
3714         std::atomic<> where ivars must be acessed by both threads. m_writeCount is entirely superfluous,
3715         as it is a synonym for the endTime returned by m_ringBuffer->getCurrentFrameBounds().
3716
3717         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
3718         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3719         (WebCore::AudioSourceProviderAVFObjC::provideInput):
3720         (WebCore::AudioSourceProviderAVFObjC::prepare):
3721         (WebCore::AudioSourceProviderAVFObjC::unprepare):
3722         (WebCore::AudioSourceProviderAVFObjC::process):
3723
3724 2016-03-24  Enrica Casucci  <enrica@apple.com>
3725
3726         Adopt new SPI from DataDetectorsCore to decide link behavior.
3727         https://bugs.webkit.org/show_bug.cgi?id=155780
3728         rdar://problem/25303631
3729
3730         Reviewed by Sam Weinig.
3731
3732         isDataDetectorLink and shouldCancelDefaultAction now
3733         use the SPI provided by DataDetectorsCore to decide
3734         what is the link behavior when the user taps on it.
3735
3736         * editing/cocoa/DataDetection.h:
3737         * editing/cocoa/DataDetection.mm:
3738         (WebCore::detectItemAtPositionWithRange):
3739         (WebCore::DataDetection::isDataDetectorLink):
3740         (WebCore::DataDetection::requiresExtendedContext):
3741         (WebCore::DataDetection::dataDetectorIdentifier):
3742         (WebCore::DataDetection::shouldCancelDefaultAction):
3743         * platform/cocoa/DataDetectorsCoreSoftLink.h:
3744         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
3745         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
3746
3747 2016-03-24  Enrica Casucci  <enrica@apple.com>
3748
3749         DataDetection creates links that are longer than the actual result.
3750         https://bugs.webkit.org/show_bug.cgi?id=155850
3751         rdar://problem/25280740
3752
3753         Reviewed by Anders Carlsson.
3754
3755         When a data detection result is composed of multiple fragments,
3756         the range for the last fragment should take into account the end
3757         offset of the query range structure, since there could be additional
3758         content in that range that is not part of the result.
3759
3760         * editing/cocoa/DataDetection.mm:
3761         (WebCore::DataDetection::detectContentInRange):
3762
3763 2016-03-24  Commit Queue  <commit-queue@webkit.org>
3764
3765         Unreviewed, rolling out r198627.
3766         https://bugs.webkit.org/show_bug.cgi?id=155856
3767
3768         Caused use-after-free (Requested by ap on #webkit).
3769
3770         Reverted changeset:
3771
3772         "[Fetch API] Add basic loading of resources"
3773         https://bugs.webkit.org/show_bug.cgi?id=155637
3774         http://trac.webkit.org/changeset/198627
3775
3776 2016-03-24  Saam barati  <sbarati@apple.com>
3777
3778         Web Inspector: Separate Debugger enable state from the debugger breakpoints enabled state
3779         https://bugs.webkit.org/show_bug.cgi?id=152193
3780         <rdar://problem/23867520>
3781
3782         Reviewed by Joseph Pecoraro.
3783
3784         No new tests because this is already tested by inspector tests.
3785
3786         * inspector/PageScriptDebugServer.cpp:
3787         (WebCore::PageScriptDebugServer::attachDebugger):
3788         (WebCore::PageScriptDebugServer::detachDebugger):
3789
3790 2016-03-24  Jer Noble  <jer.noble@apple.com>
3791
3792         [MSE] Make calling HTMLMediaElement.buffered less expensive
3793         https://bugs.webkit.org/show_bug.cgi?id=155846
3794
3795         Reviewed by Eric Carlson.
3796
3797         The MSE specification requires a new TimeRanges object be returned when calling
3798         HTMLMediaElement.buffered. Additionally, the requirements for generating the buffered time
3799         ranges for MediaSource and its constituent SourceBuffers are specific and expensive. Rather
3800         than perform all these steps each time HTMLMediaElement.buffered is queried, cache the final
3801         result and only regenerate the cached value if the buffered ranges of the consituent
3802         SourceBuffers has changed.
3803
3804         Also, make copying a PlatformTimeRanges more efficient by doing a straight vector-to-vector
3805         copy of the PlatformTimeRange's data.
3806
3807         * Modules/mediasource/MediaSource.cpp:
3808         (WebCore::MediaSource::buffered):
3809         (WebCore::MediaSource::regenerateActiveSourceBuffers):
3810         * Modules/mediasource/MediaSource.h:
3811         * Modules/mediasource/SourceBuffer.cpp:
3812         (WebCore::SourceBuffer::removeCodedFrames):
3813         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3814         * Modules/mediasource/SourceBuffer.h:
3815         * platform/graphics/PlatformTimeRanges.cpp:
3816         (WebCore::PlatformTimeRanges::PlatformTimeRanges): Deleted.
3817         (WebCore::PlatformTimeRanges::operator=): Deleted.
3818         (WebCore::PlatformTimeRanges::copy): Deleted.
3819         * platform/graphics/PlatformTimeRanges.h:
3820
3821 2016-03-24  Jer Noble  <jer.noble@apple.com>
3822
3823         REGRESSION(r189129): <audio> elements do not have playback controls on iOS.
3824         https://bugs.webkit.org/show_bug.cgi?id=155808
3825         <rdar://problem/23822457>
3826
3827         Reviewed by Eric Carlson.
3828
3829         Audio elements should never require fullscreen for playback.
3830
3831         * html/MediaElementSession.cpp:
3832         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
3833
3834 2016-03-24  Alex Christensen  <achristensen@webkit.org>
3835
3836         Clean up cookie jar after r198195
3837         https://bugs.webkit.org/show_bug.cgi?id=155484
3838
3839         Reviewed by Tim Horton.
3840
3841         Get rid of a now unneeded macro.
3842
3843         * loader/CookieJar.cpp:
3844         (WebCore::storageSession):
3845         (WebCore::cookies):
3846         (WebCore::setCookies):
3847         (WebCore::cookiesEnabled):
3848         (WebCore::cookieRequestHeaderFieldValue):
3849         (WebCore::getRawCookies):
3850         (WebCore::deleteCookie):
3851
3852 2016-03-24  Youenn Fablet  <youenn.fablet@crf.canon.fr>
3853
3854         [Fetch API] Add basic loading of resources
3855         https://bugs.webkit.org/show_bug.cgi?id=155637
3856
3857         Reviewed by Darin Adler.
3858
3859         Adding support for basic fetch for Window (no support for Worker yet).
3860         A FetchResponse object is created for every fetch task.
3861         But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved.
3862
3863         Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method.
3864
3865         Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise.
3866
3867         Tests: http/tests/fetch/closing-while-fetching.html
3868                http/tests/fetch/get-response-body-while-loading.html
3869         Also covered by rebased tests.
3870
3871         * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching.
3872         (WebCore::DOMWindowFetch::fetch):
3873         * Modules/fetch/DOMWindowFetch.h:
3874         * Modules/fetch/FetchBody.cpp:
3875         (WebCore::FetchBody::consume):
3876         (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer.
3877         (WebCore::FetchBody::consumeText): Passing the promise as a reference.
3878         (WebCore::blobFromArrayBuffer): Helper routine.
3879         (WebCore::FetchBody::fulfillTextPromise): Helper routine.
3880         (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer.
3881         (WebCore::FetchBody::loadedAsText):
3882         (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request.
3883         (WebCore::FetchBody::extractFromText):
3884         * Modules/fetch/FetchBody.h:
3885         (WebCore::FetchBody::loadingBody):
3886         (WebCore::FetchBody::FetchBody):
3887         * Modules/fetch/FetchBodyOwner.cpp:
3888         (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore
3889         but will directly call failure callbacks.
3890         (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines.
3891         (WebCore::FetchBodyOwner::finishBlobLoading):
3892         * Modules/fetch/FetchBodyOwner.h:
3893         (WebCore::FetchBodyOwner::body):
3894         (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer):
3895         * Modules/fetch/FetchHeaders.cpp:
3896         (WebCore::FetchHeaders::fill):
3897         (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered.
3898         * Modules/fetch/FetchHeaders.h:
3899         (WebCore::FetchHeaders::internalHeaders):
3900         * Modules/fetch/FetchLoader.cpp:
3901         (WebCore::FetchLoader::start):
3902         (WebCore::FetchLoader::didFailRedirectCheck):
3903         * Modules/fetch/FetchLoader.h:
3904         * Modules/fetch/FetchRequest.cpp:
3905         (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader.
3906        * Modules/fetch/FetchRequest.h:
3907         * Modules/fetch/FetchResponse.cpp:
3908         (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request.
3909         (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback.
3910         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
3911         (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
3912         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto.
3913         (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto.
3914         (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader.
3915         (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader.
3916         (WebCore::FetchResponse::stop): Stop loader if any.
3917         * Modules/fetch/FetchResponse.h:
3918         * platform/network/BlobResourceHandle.cpp:
3919         (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET.
3920         (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers.
3921         (WebCore::BlobResourceHandle::createAsync): Removing GET verb check.
3922
3923 2016-03-24  Andreas Kling  <akling@apple.com>
3924
3925         Remove virtual inheritance from SVGTransformable.
3926         <https://webkit.org/b/155837>
3927
3928         Reviewed by Anders Carlsson.
3929
3930         Nothing else inherits SVGLocatable, so make the inheritance non-virtual.
3931
3932         * svg/SVGTransformable.h:
3933
3934 2016-03-24  Youenn Fablet  <youenn.fablet@crf.canon.fr>
3935
3936         Remove DeferredWrapper::resolve<Vector<unsigned char>>
3937         https://bugs.webkit.org/show_bug.cgi?id=154849
3938
3939         Reviewed by Darin Adler.
3940
3941         Adding fulfillPromiseWithArrayBuffer to resolve a promise with an ArrayBuffer.
3942         If the ArrayBuffer is null, the promise is rejected with an OutOfMemory exception.
3943
3944         Not covered by tests since we would need to make tryCreate return null on failing allocation.
3945
3946         * Modules/fetch/FetchBody.cpp:
3947         (WebCore::FetchBody::processIfEmptyOrDisturbed):
3948         (WebCore::FetchBody::loadedAsArrayBuffer):
3949         * bindings/js/JSDOMPromise.cpp:
3950         (WebCore::fulfillPromiseWithArrayBuffer):
3951         * bindings/js/JSDOMPromise.h:
3952         (WebCore::DeferredWrapper::resolve<JSC::JSValue>): Deleted.
3953         (WebCore::DeferredWrapper::resolve): Deleted.
3954         * bindings/js/JSSubtleCryptoCustom.cpp:
3955         (WebCore::JSSubtleCrypto::encrypt):
3956         (WebCore::JSSubtleCrypto::decrypt):
3957         (WebCore::JSSubtleCrypto::sign):
3958         (WebCore::JSSubtleCrypto::digest):
3959         (WebCore::JSSubtleCrypto::exportKey):
3960         (WebCore::JSSubtleCrypto::wrapKey):
3961
3962 2016-03-23  Daniel Bates  <dabates@apple.com>
3963
3964         CSP: Simplify logic for checking policies
3965         https://bugs.webkit.org/show_bug.cgi?id=155817
3966         <rdar://problem/25326546>
3967
3968         Reviewed by Zalan Bujtas.
3969
3970         Consolidate the various static template functions into a single function called ContentSecurityPolicy::allPoliciesAllow()
3971         that tests whether a resource request when evaluated with respect to a directive (given as a ContentSecurityPolicyDirectiveList
3972         pointer-to-member function) violates any of the CSPs that were delivered with the document.
3973
3974         No functionality changed. So, no new tests.
3975
3976         * page/csp/ContentSecurityPolicy.cpp:
3977         (WebCore::ContentSecurityPolicy::allPoliciesAllowHashFromContent): Formerly name isAllowedByAllWithHash. Made it
3978         a member function so that we query for the document encoding instead of taking it as an argument. Modified
3979         it to take a predicate function to pass it to allPoliciesAllow().
3980         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Modified to use ContentSecurityPolicy::allPoliciesAllow().
3981         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Ditto.
3982         (WebCore::ContentSecurityPolicy::allowScriptWithNonce): Ditto.
3983         (WebCore::ContentSecurityPolicy::allowStyleWithNonce): Ditto.
3984         (WebCore::ContentSecurityPolicy::allowInlineScript): Modified to use ContentSecurityPolicy::allPoliciesAllow() and
3985         ContentSecurityPolicy::allPoliciesAllowHashFromContent().
3986         (WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
3987         (WebCore::ContentSecurityPolicy::allowEval): Modified to use ContentSecurityPolicy::allPoliciesAllow().
3988         (WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
3989         (WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
3990         (WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
3991         (WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
3992         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
3993         (WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
3994