b3b28ed6f20d067e20996a0f49ae28f4871cd62e
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-03-16  Daniel Bates  <dabates@apple.com>
2
3         <video> and <audio> elements do not obey Content Security Policy on redirect
4         https://bugs.webkit.org/show_bug.cgi?id=155509
5         <rdar://problem/10234844>
6
7         Reviewed by Alex Christensen.
8
9         Fixes an issue where the Content Security Policy of the page was not enforced
10         on redirects when loading a media subresource via an HTML video or HTML audio
11         element.
12
13         Tests: http/tests/security/contentSecurityPolicy/audio-redirect-allowed.html
14                http/tests/security/contentSecurityPolicy/audio-redirect-blocked.html
15                http/tests/security/contentSecurityPolicy/font-redirect-allowed.html
16                http/tests/security/contentSecurityPolicy/font-redirect-blocked.html
17                http/tests/security/contentSecurityPolicy/image-redirect-allowed.html
18                http/tests/security/contentSecurityPolicy/image-redirect-blocked.html
19                http/tests/security/contentSecurityPolicy/script-redirect-allowed.html
20                http/tests/security/contentSecurityPolicy/script-redirect-blocked.html
21                http/tests/security/contentSecurityPolicy/stylesheet-redirect-allowed.html
22                http/tests/security/contentSecurityPolicy/stylesheet-redirect-blocked.html
23                http/tests/security/contentSecurityPolicy/svg-font-redirect-allowed.html
24                http/tests/security/contentSecurityPolicy/svg-font-redirect-blocked.html
25                http/tests/security/contentSecurityPolicy/svg-image-redirect-allowed.html
26                http/tests/security/contentSecurityPolicy/svg-image-redirect-blocked.html
27                http/tests/security/contentSecurityPolicy/track-redirect-allowed.html
28                http/tests/security/contentSecurityPolicy/track-redirect-blocked.html
29                http/tests/security/contentSecurityPolicy/video-redirect-allowed.html
30                http/tests/security/contentSecurityPolicy/video-redirect-blocked.html
31                http/tests/security/contentSecurityPolicy/xsl-redirect-allowed.html
32                http/tests/security/contentSecurityPolicy/xsl-redirect-blocked.html
33
34         * inspector/InspectorPageAgent.cpp:
35         (WebCore::InspectorPageAgent::cachedResourceContent): Treat media resources as raw resources just as we do currently.
36         (WebCore::InspectorPageAgent::cachedResourceType): Ditto.
37         * loader/MediaResourceLoader.cpp:
38         (WebCore::MediaResourceLoader::requestResource): Modified to use CachedResourceLoader::requestMedia() instead
39         of CachedResourceLoader::requestRawResource() so that we can differentiate between a media resource and a raw
40         resource in CachedResourceLoader. Added FIXME comment to skip checking the Content Security Policy for loads
41         initiated by an element in a user agent shadow tree. See <https://bugs.webkit.org/show_bug.cgi?id=155505> for
42         more details.
43         * loader/ResourceLoadInfo.cpp:
44         (WebCore::toResourceType): Treat media resources as raw resources just as we do currently. Also, add cases for
45         CachedResource::LinkPrefetch and CachedResource::LinkSubresource (when ENABLE(LINK_PREFETCH) is enabled) and
46         remove the default statement to force a compile-time error when a new CachedResource enumerator is added and
47         the switch block in this function is not updated.
48         * loader/SubresourceLoader.cpp:
49         (WebCore::logResourceLoaded): Ditto.
50         * loader/cache/CachedRawResource.cpp:
51         (WebCore::CachedRawResource::CachedRawResource): Substitute CachedResource::isMainOrMediaOrRawResource() for
52         CachedResource::isMainOrRawResource() as the latter was renamed to the former.
53         * loader/cache/CachedRawResource.h:
54         (isType): Ditto.
55         * loader/cache/CachedResource.cpp:
56         (WebCore::defaultPriorityForResourceType): Use priority ResourceLoadPriority::Medium for media resources just as
57         we do currently.
58         * loader/cache/CachedResource.h:
59         (WebCore::CachedResource::isMainOrMediaOrRawResource): Formerly named isMainOrRawResource. Returns true if the type
60         of this resource is a main resource, media resource, or raw resource.
61         (WebCore::CachedResource::isMainOrRawResource): Deleted.
62         * loader/cache/CachedResourceLoader.cpp:
63         (WebCore::createResource): Treat media resources as raw resources just as we do currently.
64         (WebCore::CachedResourceLoader::requestMedia): Added.
65         (WebCore::contentTypeFromResourceType): Consider media resources as MixedContentChecker::ContentType::Active
66         just as we do currently.
67         (WebCore::CachedResourceLoader::checkInsecureContent): Apply the mixed content policy to media resources
68         just as we do currently.
69         (WebCore::CachedResourceLoader::canRequest): Apply the Same Origin Policy to media resources just as we
70         do currently. Query the Content Security Policy of the page to determine if the media resource can be
71         requested.
72         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Substitute CachedResource::isMainOrMediaOrRawResource()
73         for CachedResource::isMainOrRawResource() as the latter was renamed to the former.
74         * loader/cache/CachedResourceLoader.h:
75         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
76         (WebCore::WebCoreAVFResourceLoader::startLoading): Modified to use CachedResourceLoader::requestMedia() instead
77         of CachedResourceLoader::requestRawResource() so that we can differentiate between a media resource and a raw
78         resource in CachedResourceLoader. Added FIXME comment to skip checking the Content Security Policy for loads
79         initiated by an element in a user agent shadow tree. See <https://bugs.webkit.org/show_bug.cgi?id=155505> for
80         more details. Additionally, simplified code that determined whether to request the media resource or error out
81         by coalescing two conditional expressions into one conditional on whether we have a loader and substituted
82         nullptr for 0.
83
84 2016-03-16  Chris Dumez  <cdumez@apple.com>
85
86         Unreviewed, rolling out r198235, r198240, r198241, and
87         r198252.
88
89         Causing crashes on ARM
90
91         Reverted changesets:
92
93         "Remove compile time define for SEPARATED_HEAP"
94         https://bugs.webkit.org/show_bug.cgi?id=155508
95         http://trac.webkit.org/changeset/198235
96
97         "Gardening: build fix after r198235."
98         http://trac.webkit.org/changeset/198240
99
100         "Build fix."
101         http://trac.webkit.org/changeset/198241
102
103         "Rename performJITMemcpy to something more inline with our
104         normal webkit function names"
105         https://bugs.webkit.org/show_bug.cgi?id=155525
106         http://trac.webkit.org/changeset/198252
107
108 2016-03-16  Jiewen Tan  <jiewen_tan@apple.com>
109
110         URL Parsing should signal failure for illegal IDN
111         https://bugs.webkit.org/show_bug.cgi?id=154945
112         <rdar://problem/8014795>
113
114         Reviewed by Brent Fulgham.
115
116         WebCore::URL will now invalidate URLs with illegal IDN. And functions inside WebCoreNSURLExtras.h
117         that deal with IDN mapping will now return nil to signal error.
118
119         Test: fast/url/invalid-idn.html
120
121         * platform/URL.cpp:
122         (WebCore::isSchemeFirstChar):
123         (WebCore::URL::init):
124         (WebCore::appendEncodedHostname):
125         (WebCore::encodeHostnames):
126         (WebCore::encodeRelativeString):
127         * platform/mac/WebCoreNSURLExtras.h:
128         * platform/mac/WebCoreNSURLExtras.mm:
129         (WebCore::mapHostNameWithRange):
130         (WebCore::hostNameNeedsDecodingWithRange):
131         (WebCore::hostNameNeedsEncodingWithRange):
132         (WebCore::decodeHostNameWithRange):
133         (WebCore::encodeHostNameWithRange):
134         (WebCore::decodeHostName):
135         (WebCore::encodeHostName):
136         (WebCore::collectRangesThatNeedMapping):
137         (WebCore::mapHostNames):
138         (WebCore::URLWithData):
139         (WebCore::dataWithUserTypedString):
140         (WebCore::URLWithUserTypedString):
141         (WebCore::URLWithUserTypedStringDeprecated):
142         (WebCore::userVisibleString):
143
144 2016-03-16  Antti Koivisto  <antti@apple.com>
145
146         Don't invalidate style unnecessarily when setting inline style cssText
147         https://bugs.webkit.org/show_bug.cgi?id=155541
148         rdar://problem/23318893
149
150         Reviewed by Simon Fraser.
151
152         We currently invalidate style when cssText is set whether the style declaration changed or not.
153
154         Based on a patch by Simon.
155
156         Test: fast/css/style-invalidation-inline-csstext.html
157
158         * css/PropertySetCSSStyleDeclaration.cpp:
159         (WebCore::PropertySetCSSStyleDeclaration::cssText):
160         (WebCore::PropertySetCSSStyleDeclaration::setCssText):
161
162             Invalidate only if the parsed style changed.
163
164         * css/StyleProperties.cpp:
165         (WebCore::MutableStyleProperties::parseDeclaration):
166
167             Compare the original and new style after parsing, return result.
168
169         * css/StyleProperties.h:
170
171 2016-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
172
173         REGRESSION(r195661): [GTK] very slow scrolling
174         https://bugs.webkit.org/show_bug.cgi?id=155334
175
176         Reviewed by Sergio Villar Senin.
177
178         Fix smooth scrolling behaviour change after r195661.
179
180         * platform/ScrollAnimationSmooth.cpp:
181         (WebCore::getAnimationParametersForGranularity): Fix a typo,
182         animationTime for pixel granularity should be 11 * tickTime.
183         (WebCore::ScrollAnimationSmooth::animateScroll): Previous code
184         reset all the data except the visibleLenght, so keep it in the
185         PerAxisData after the reset.
186
187 2016-03-16  Commit Queue  <commit-queue@webkit.org>
188
189         Unreviewed, rolling out r196803.
190         https://bugs.webkit.org/show_bug.cgi?id=155534
191
192         Introduced several rendering issues in popular websites
193         (Requested by KaL on #webkit).
194
195         Reverted changeset:
196
197         "[GTK] Limit the number of tiles according to the visible
198         area"
199         https://bugs.webkit.org/show_bug.cgi?id=126122
200         http://trac.webkit.org/changeset/196803
201
202 2016-03-15  Zalan Bujtas  <zalan@apple.com>
203
204         Remove overflow: -webkit-marquee
205         https://bugs.webkit.org/show_bug.cgi?id=155517
206         <rdar://problem/25028481>
207
208         Reviewed by Simon Fraser.
209
210         This patch is based on Blink patch from jchaffraix@chromium.org (https://src.chromium.org/viewvc/blink?revision=151756&view=revision)
211
212         * css/CSSParser.cpp:
213         (WebCore::isValidKeywordPropertyAndValue):
214         * css/CSSPrimitiveValueMappings.h:
215         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Deleted.
216         (WebCore::CSSPrimitiveValue::operator EOverflow): Deleted.
217         * css/CSSValueKeywords.in:
218         * css/StyleResolver.cpp:
219         (WebCore::StyleResolver::adjustRenderStyle):
220         * css/html.css:
221         (marquee): Deleted.
222         * rendering/RenderBox.cpp:
223         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
224         * rendering/RenderLayer.cpp:
225         (WebCore::RenderLayer::scrollTo):
226         (WebCore::RenderLayer::updateScrollInfoAfterLayout):
227         (WebCore::RenderLayer::calculateClipRects):
228         * rendering/RenderLayer.h:
229         * rendering/RenderMarquee.h:
230         * rendering/style/RenderStyleConstants.h:
231
232 2016-03-15  Joanmarie Diggs  <jdiggs@igalia.com>
233
234         AX: Expose pointers to SVG elements referenced by aria-labelledby
235         https://bugs.webkit.org/show_bug.cgi?id=155481
236
237         Reviewed by Chris Fleizach.
238
239         Expose elements referenced by aria-labelledby via ATK_RELATION_LABELLED_BY.
240         Stop calling the supportsARIA* methods before getting the elements referred
241         to by the associated ARIA property in the accessible wrapper for ATK and
242         the inspector: Getting the elements will be just as fast when there are no
243         such elements, and faster when there are.
244
245         Modified the w3c-svg-name-calculation.html test to include AXTitleUIElement
246         in its output.
247
248         * accessibility/AccessibilityObject.cpp:
249         (WebCore::AccessibilityObject::supportsARIAAttributes):
250         (WebCore::AccessibilityObject::ariaElementsFromAttribute): Added.
251         (WebCore::AccessibilityObject::ariaControlsElements): Added.
252         (WebCore::AccessibilityObject::ariaDescribedByElements): Added.
253         (WebCore::AccessibilityObject::ariaFlowToElements): Added.
254         (WebCore::AccessibilityObject::ariaLabelledByElements): Added.
255         (WebCore::AccessibilityObject::ariaOwnsElements): Added.
256         * accessibility/AccessibilityObject.h:
257         (WebCore::AccessibilityObject::ariaOwnsElements): No longer virtual.
258         (WebCore::AccessibilityObject::supportsARIAFlowTo): Deleted.
259         (WebCore::AccessibilityObject::ariaFlowToElements): No longer virtual.
260         (WebCore::AccessibilityObject::supportsARIADescribedBy): Deleted.
261         (WebCore::AccessibilityObject::ariaDescribedByElements): No longer virtual.
262         (WebCore::AccessibilityObject::supportsARIAControls): Deleted.
263         (WebCore::AccessibilityObject::ariaControlsElements): No longer virtual.
264         * accessibility/AccessibilityRenderObject.cpp:
265         (WebCore::AccessibilityRenderObject::ariaElementsFromAttribute): Moved to AccessibilityObject.
266         (WebCore::AccessibilityRenderObject::supportsARIAFlowTo): Deleted.
267         (WebCore::AccessibilityRenderObject::ariaFlowToElements): Moved to AccessibilityObject.
268         (WebCore::AccessibilityRenderObject::supportsARIADescribedBy): Deleted.
269         (WebCore::AccessibilityRenderObject::ariaDescribedByElements): Moved to AccessibilityObject.
270         (WebCore::AccessibilityRenderObject::supportsARIAControls): Deleted.
271         (WebCore::AccessibilityRenderObject::ariaControlsElements): Moved to AccessibilityObject.
272         (WebCore::AccessibilityRenderObject::ariaOwnsElements): Moved to AccessibilityObject.
273         * accessibility/AccessibilityRenderObject.h:
274         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
275         (setAtkRelationSetFromCoreObject):
276         * inspector/InspectorDOMAgent.cpp:
277         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
278
279 2016-03-15  Simon Fraser  <simon.fraser@apple.com>
280
281         Occasional crash under GraphicsContext::platformContext when dragging Google maps
282         https://bugs.webkit.org/show_bug.cgi?id=155521
283         rdar://problem/24357307
284
285         Reviewed by Tim Horton.
286
287         It's possible for createDragImageForSelection() to return a null image, if the bounds
288         of the selection are an empty rect. That would cause a crash under convertImageToBitmap()
289         because a zero-sized ShareableBitmap will return a null GraphicsContext.
290         
291         To avoid this, early return from DragController::startDrag() if the dragImage is null.
292         
293         I wasn't able to come up with a test for this.
294
295         * page/DragController.cpp:
296         (WebCore::DragController::startDrag):
297
298 2016-03-15  Tim Horton  <timothy_horton@apple.com>
299
300         iOS <attachment> element should allow customization of action text color
301         https://bugs.webkit.org/show_bug.cgi?id=155513
302         <rdar://problem/24805991>
303
304         Reviewed by Simon Fraser.
305
306         Test: fast/attachment/attachment-action.html
307
308         * css/html.css:
309         (attachment):
310         On iOS (the only place it is used), <attachment> color should default to system blue.
311
312         * rendering/RenderThemeIOS.mm:
313         (WebCore::attachmentActionColor):
314         (WebCore::AttachmentInfo::AttachmentInfo):
315         Make use of the <attachment>'s CSS color for the action text.
316         This is a little weird because there are multiple bits of text in an
317         <attachment>, but only the action text ever changes color.
318
319 2016-03-15  Zalan Bujtas  <zalan@apple.com>
320
321         Delay HTMLFormControlElement::focus() call until after layout is finished.
322         https://bugs.webkit.org/show_bug.cgi?id=155503
323         <rdar://problem/24046635>
324
325         Reviewed by Simon Fraser.
326
327         Calling focus on a form element can trigger arbitrary JS code which could interfere with
328         the ongoing layout. 
329         This patch delays HTMLFormControlElement::focus() call until after layout is finished.
330         If we are currently not in the middle of a layout, HTMLFormControlElement::focus() is delayed until
331         after style resolution is done. 
332
333         Covered by LayoutTests/fast/dom/adopt-node-crash-2.html
334
335         * accessibility/AccessibilityObject.cpp:
336         (WebCore::AccessibilityObject::updateBackingStore):
337         * dom/Document.cpp:
338         (WebCore::Document::updateStyleIfNeeded):
339         (WebCore::Document::updateLayout):
340         (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
341         * html/HTMLEmbedElement.cpp:
342         (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin):
343         * html/HTMLFormControlElement.cpp:
344         (WebCore::HTMLFormControlElement::didAttachRenderers):
345         * page/FrameView.cpp:
346         (WebCore::FrameView::layout):
347         (WebCore::FrameView::queuePostLayoutCallback):
348         (WebCore::FrameView::flushPostLayoutTasksQueue):
349         (WebCore::FrameView::performPostLayoutTasks):
350         (WebCore::FrameView::sendResizeEventIfNeeded):
351         * page/FrameView.h:
352         * rendering/RenderBox.cpp:
353         (WebCore::RenderBox::imageChanged):
354         * rendering/RenderLayer.cpp:
355         (WebCore::RenderLayer::scrollTo):
356
357 2016-03-15  Oliver Hunt  <oliver@apple.com>
358
359         Remove compile time define for SEPARATED_HEAP
360         https://bugs.webkit.org/show_bug.cgi?id=155508
361
362         Reviewed by Mark Lam.
363
364         Remove the feature define.
365
366         * Configurations/FeatureDefines.xcconfig:
367
368 2016-03-15  Chris Dumez  <cdumez@apple.com>
369
370         Restore pre-r197244 behavior on Mac
371         https://bugs.webkit.org/show_bug.cgi?id=155507
372         <rdar://problem/25174132>
373
374         Reviewed by Gavin Barraclough.
375
376         <http://trac.webkit.org/changeset/197244> changed the session restore
377         behavior to disallow stale content on all platforms except iOS.
378         We would also like to maintain the behavior on Mac for performance
379         reasons and consistency between iOS and Mac.
380
381         * loader/FrameLoader.cpp:
382         (WebCore::FrameLoader::loadDifferentDocumentItem):
383
384 2016-03-15  Tim Horton  <timothy_horton@apple.com>
385
386         <attachment> on iOS isn't quite vertically centered
387         https://bugs.webkit.org/show_bug.cgi?id=155502
388         <rdar://problem/24805991>
389
390         Reviewed by Beth Dakin.
391
392         No new tests; there are existing tests that will be enabled shortly.
393
394         * rendering/RenderThemeIOS.mm:
395         (WebCore::AttachmentInfo::AttachmentInfo):
396         We were overcounting the total height of the attachment content by one margin, because each item
397         would add in its margin, including the last one. Remove one margin.
398
399 2016-03-15  Chris Fleizach  <cfleizach@apple.com>
400
401         AX: certain elements not included in accessibility tree
402         https://bugs.webkit.org/show_bug.cgi?id=155480
403
404         Reviewed by Beth Dakin.
405
406         This test case exposed a hole in the nextSibling logic where you can get into a state where we skip content.
407         The fix is to check if an inline element continuation has no sibling, to fall back on to the parent case to see if that has a sibling.
408
409         Test: accessibility/double-nested-inline-element-missing-from-tree.html
410
411         * accessibility/AccessibilityRenderObject.cpp:
412         (WebCore::AccessibilityRenderObject::nextSibling):
413
414 2016-03-15  Chris Dumez  <cdumez@apple.com>
415
416         Unreviewed, rolling out r198203.
417
418         Favorites view is no longer loading on iOS
419
420         Reverted changeset:
421
422         "URL Parsing should signal failure for illegal IDN"
423         https://bugs.webkit.org/show_bug.cgi?id=154945
424         http://trac.webkit.org/changeset/198203
425
426 2016-03-15  Tim Horton  <timothy_horton@apple.com>
427
428         <attachment> on iOS should use short and emphasized fonts
429         https://bugs.webkit.org/show_bug.cgi?id=155485
430         <rdar://problem/24805991>
431
432         Reviewed by Simon Fraser.
433
434         No new tests; there are existing tests that will be enabled shortly.
435
436         * rendering/RenderThemeIOS.mm:
437         (WebCore::attachmentActionFont):
438         (WebCore::attachmentTitleFont):
439         (WebCore::attachmentSubtitleFont):
440         (WebCore::AttachmentInfo::buildTitleLines):
441         (WebCore::AttachmentInfo::buildSingleLine):
442         (WebCore::AttachmentInfo::AttachmentInfo):
443         No need for UIFonts, we can use CoreText, and that allows us to ask for the
444         correct Short and Emphasized variants that we need.
445
446 2016-03-15  Antti Koivisto  <antti@apple.com>
447
448         REGRESSION (196383): Class change invalidation does not handle :not correctly
449         https://bugs.webkit.org/show_bug.cgi?id=155493
450         <rdar://problem/24846762>
451
452         Reviewed by Andreas Kling.
453
454         We fail to invalidate bar style in
455
456             :not(.foo) bar { }
457
458         when class foo is added or removed.
459
460         There is a logic error in the invalidation code. It assumes that class addition can only make new selectors match
461         and removal make them not match. This is not true when :not is present.
462
463         * style/AttributeChangeInvalidation.h:
464         (WebCore::Style::AttributeChangeInvalidation::AttributeChangeInvalidation):
465         * style/ClassChangeInvalidation.cpp:
466         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
467
468             Invalidate style and collect full set of rules that may affect descendant style.
469
470         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
471
472             Invalidate with this set both before and after committing the changes.
473
474         (WebCore::Style::ClassChangeInvalidation::computeClassChange): Deleted.
475         * style/ClassChangeInvalidation.h:
476         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
477         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
478
479 2016-03-14  Jer Noble  <jer.noble@apple.com>
480
481         Video elements with autoplay do not begin playing when scrolling into view if InvisibleAutoplayNotPermitted is set.
482         https://bugs.webkit.org/show_bug.cgi?id=155468
483
484         Reviewed by Eric Carlson.
485
486         Test: media/video-restricted-invisible-autoplay-allowed-when-visible.html
487
488         A few bugs came together to cause this behavior. We were not telling the media session that we were going to begin
489         the autoplaying state, we were not restoring the correct state when the interruption ended, and we were not checking
490         to see if we could actually play correctly when the interruption ended.
491
492         * html/HTMLMediaElement.cpp:
493         (WebCore::HTMLMediaElement::prepareForLoad):
494         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay):
495         (WebCore::HTMLMediaElement::setReadyState):
496         (WebCore::HTMLMediaElement::resumeAutoplaying):
497         (WebCore::HTMLMediaElement::updateShouldPlay):
498         (WebCore::elementCanTransitionFromAutoplayToPlay): Deleted.
499         * html/HTMLMediaElement.h:
500         * platform/audio/PlatformMediaSession.cpp:
501         (WebCore::PlatformMediaSession::endInterruption):
502
503 2016-03-15  Manuel Rego Casasnovas  <rego@igalia.com>
504
505         [css-grid] Rename GridCoordinate to GridArea
506         https://bugs.webkit.org/show_bug.cgi?id=155489
507
508         Reviewed by Sergio Villar Senin.
509
510         As the comment in GridCoordinate states,
511         it actually represents a grid area as it stores
512         the initial and final positions in both axis (columns and rows).
513
514         Someone can think about a grid coordinate just like a single cell.
515         However this class was representing an area of several cells.
516
517         On top of that the "grid area" concept is defined in the spec:
518         https://drafts.csswg.org/css-grid/#grid-area-concept
519
520         No new tests, no change of behavior.
521
522         * WebCore.xcodeproj/project.pbxproj:
523         * css/CSSGridTemplateAreasValue.cpp:
524         (WebCore::stringForPosition):
525         * css/CSSGridTemplateAreasValue.h:
526         * css/CSSParser.cpp:
527         (WebCore::CSSParser::parseGridTemplateAreasRow):
528         * css/CSSParser.h:
529         * rendering/RenderGrid.cpp:
530         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
531         (WebCore::RenderGrid::insertItemIntoGrid):
532         (WebCore::RenderGrid::placeItemsOnGrid):
533         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
534         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
535         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
536         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
537         (WebCore::RenderGrid::clearGrid):
538         (WebCore::RenderGrid::cachedGridArea):
539         (WebCore::RenderGrid::cachedGridSpan):
540         * rendering/RenderGrid.h:
541         * rendering/style/GridArea.h: Renamed from Source/WebCore/rendering/style/GridCoordinate.h.
542         (WebCore::GridSpan::untranslatedDefiniteGridSpan):
543         (WebCore::GridSpan::translatedDefiniteGridSpan):
544         (WebCore::GridSpan::indefiniteGridSpan):
545         (WebCore::GridSpan::operator==):
546         (WebCore::GridSpan::integerSpan):
547         (WebCore::GridSpan::untranslatedResolvedInitialPosition):
548         (WebCore::GridSpan::untranslatedResolvedFinalPosition):
549         (WebCore::GridSpan::resolvedInitialPosition):
550         (WebCore::GridSpan::resolvedFinalPosition):
551         (WebCore::GridSpan::GridSpanIterator::GridSpanIterator):
552         (WebCore::GridSpan::GridSpanIterator::operator unsigned&):
553         (WebCore::GridSpan::GridSpanIterator::operator*):
554         (WebCore::GridSpan::begin):
555         (WebCore::GridSpan::end):
556         (WebCore::GridSpan::isTranslatedDefinite):
557         (WebCore::GridSpan::isIndefinite):
558         (WebCore::GridSpan::translate):
559         (WebCore::GridSpan::GridSpan):
560         (WebCore::GridArea::GridArea):
561         (WebCore::GridArea::operator==):
562         (WebCore::GridArea::operator!=):
563         * rendering/style/GridPositionsResolver.cpp:
564         * rendering/style/StyleGridData.h:
565
566 2016-03-15  Joonghun Park  <jh718.park@samsung.com>
567
568         [GTK] Remove duplicate HashMap traversal and unneeded reference count churn in DataObjectGtk::forClipboard
569         https://bugs.webkit.org/show_bug.cgi?id=155470
570
571         Reviewed by Carlos Garcia Campos.
572
573         No new tests, no new behaviours.
574
575         * platform/gtk/DataObjectGtk.cpp:
576         (WebCore::DataObjectGtk::forClipboard):
577
578 2016-03-15  Manuel Rego Casasnovas  <rego@igalia.com>
579
580         [css-grid] Rename GridResolvedPosition to GridPositionsResolver
581         https://bugs.webkit.org/show_bug.cgi?id=155486
582
583         Reviewed by Sergio Villar Senin.
584
585         GridResolvedPosition is not storing a position (track or line) anymore.
586         Currently it's just a class wrapping the methods to resolve
587         grid positions from style.
588         Renamed the class to avoid confusions.
589
590         No new tests, no change of behavior.
591
592         * CMakeLists.txt:
593         * WebCore.xcodeproj/project.pbxproj:
594         * rendering/RenderGrid.cpp:
595         (WebCore::RenderGrid::placeItemsOnGrid):
596         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
597         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
598         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
599         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
600         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
601         * rendering/RenderGrid.h:
602         * rendering/style/GridCoordinate.h:
603         * rendering/style/GridPositionsResolver.cpp: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.cpp.
604         (WebCore::isColumnSide):
605         (WebCore::isStartSide):
606         (WebCore::initialPositionSide):
607         (WebCore::finalPositionSide):
608         (WebCore::gridLinesForSide):
609         (WebCore::implicitNamedGridLineForSide):
610         (WebCore::GridPositionsResolver::isNonExistentNamedLineOrArea):
611         (WebCore::adjustGridPositionsFromStyle):
612         (WebCore::GridPositionsResolver::explicitGridColumnCount):
613         (WebCore::GridPositionsResolver::explicitGridRowCount):
614         (WebCore::explicitGridSizeForSide):
615         (WebCore::lookAheadForNamedGridLine):
616         (WebCore::lookBackForNamedGridLine):
617         (WebCore::resolveNamedGridLinePositionFromStyle):
618         (WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
619         (WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
620         (WebCore::resolveGridPositionAgainstOppositePosition):
621         (WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
622         (WebCore::resolveGridPositionFromStyle):
623         (WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
624         * rendering/style/GridPositionsResolver.h: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.h.
625         * rendering/style/StyleAllInOne.cpp:
626
627 2016-03-15  Miguel Gomez  <magomez@igalia.com>
628
629         Leak: Accelerated ImageBufferCairo doesn't destroy the used textures
630         https://bugs.webkit.org/show_bug.cgi?id=155431
631
632         Reviewed by Žan Doberšek.
633
634         When using the Cairo backend, add a destructor to ImageBufferData and use it to destroy the
635         textures created if the buffer is being accelerated.
636
637         No new tests, already covered by existing ones.
638
639         * platform/graphics/cairo/ImageBufferCairo.cpp:
640         (WebCore::ImageBufferData::ImageBufferData):
641         Store the renderingMode flag.
642         (WebCore::ImageBufferData::~ImageBufferData):
643         Destroy gl resources if renderingMode is accelerated.
644         (WebCore::ImageBuffer::ImageBuffer):
645         Pass renderingMode to the data class and use it fro checks instead of the function parameter.
646         * platform/graphics/cairo/ImageBufferDataCairo.h:
647         Add destructor and a renderingMode flag.
648
649 2016-03-15  Jiewen Tan  <jiewen_tan@apple.com>
650
651         URL Parsing should signal failure for illegal IDN
652         https://bugs.webkit.org/show_bug.cgi?id=154945
653         <rdar://problem/8014795>
654
655         Reviewed by Brent Fulgham.
656
657         WebCore::URL will now invalidate URLs with illegal IDN. And functions inside WebCoreNSURLExtras.h
658         that deal with IDN mapping will now return nil to signal error.
659
660         Test: fast/url/invalid-idn.html
661
662         * platform/URL.cpp:
663         (WebCore::isSchemeFirstChar):
664         (WebCore::URL::init):
665         (WebCore::appendEncodedHostname):
666         (WebCore::encodeHostnames):
667         (WebCore::encodeRelativeString):
668         * platform/mac/WebCoreNSURLExtras.h:
669         * platform/mac/WebCoreNSURLExtras.mm:
670         (WebCore::mapHostNameWithRange):
671         (WebCore::hostNameNeedsDecodingWithRange):
672         (WebCore::hostNameNeedsEncodingWithRange):
673         (WebCore::decodeHostNameWithRange):
674         (WebCore::encodeHostNameWithRange):
675         (WebCore::decodeHostName):
676         (WebCore::encodeHostName):
677         (WebCore::collectRangesThatNeedMapping):
678         (WebCore::mapHostNames):
679         (WebCore::URLWithData):
680         (WebCore::dataWithUserTypedString):
681         (WebCore::URLWithUserTypedString):
682         (WebCore::URLWithUserTypedStringDeprecated):
683         (WebCore::userVisibleString):
684
685 2016-03-15  Carlos Garcia Campos  <cgarcia@igalia.com>
686
687         REGRESSION (r197724): [GTK] Web Inspector: Images being blocked by CSP 2.0
688         https://bugs.webkit.org/show_bug.cgi?id=155432
689
690         Reviewed by Darin Adler.
691
692         The GTK+ port Web Inspector uses GResources for all internal
693         resources (images, fonts, scripts, etc.) that are now blocked by
694         the CSP. GResouces are like data URLs in practice, so we should
695         always allow them.
696
697         * page/csp/ContentSecurityPolicySourceList.cpp:
698         (WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar):
699
700 2016-03-14  Alex Christensen  <achristensen@webkit.org>
701
702         Fix WinCairo build after r198195.
703
704         * platform/network/NetworkingContext.h:
705         curl networking now uses NetworkingContext::storageSession.  That's everybody!
706
707 2016-03-14  Per Arne Vollan  <peavo@outlook.com>
708
709         [WinCairo] Compile fix.
710         https://bugs.webkit.org/show_bug.cgi?id=155463
711
712         Reviewed by Alex Christensen.
713
714         Get the NetworkStorageSession object from the document in the same way as other platforms do.
715
716         * loader/CookieJar.cpp:
717         (WebCore::storageSession):
718
719 2016-03-14  Tim Horton  <timothy_horton@apple.com>
720
721         <attachment> on iOS should paint its progress indicator instead of a green square
722         https://bugs.webkit.org/show_bug.cgi?id=155482
723         <rdar://problem/24805991>
724
725         Reviewed by Simon Fraser.
726
727         No new tests; there are existing tests that will be enabled shortly.
728
729         * rendering/RenderThemeIOS.mm:
730         (WebCore::getAttachmentProgress):
731         Clamp progress to 0-1.
732
733         (WebCore::paintAttachmentProgress):
734         Paint a pie.
735
736 2016-03-14  Chris Dumez  <cdumez@apple.com>
737
738         Unreviewed, rolling out r197981.
739
740         Caused a massive PLT regression on Mac.
741
742         Reverted changeset:
743
744         "Font antialiasing (smoothing) changes when elements are
745         rendered into compositing layers"
746         https://bugs.webkit.org/show_bug.cgi?id=23364
747         http://trac.webkit.org/changeset/197981
748
749 2016-03-14  Chris Dumez  <cdumez@apple.com>
750
751         Unreviewed, rolling out r198145.
752
753         This attempt to disable the feature did not fix the PLT
754         regression
755
756         Reverted changeset:
757
758         "Regression(r197981): Huge regression on Mac PLT"
759         https://bugs.webkit.org/show_bug.cgi?id=155443
760         http://trac.webkit.org/changeset/198145
761
762 2016-03-14  Sam Weinig  <sam@webkit.org>
763
764         Remove errant space.
765
766         * page/UserContentController.cpp:
767
768 2016-03-14  Sam Weinig  <sam@webkit.org>
769
770         Fix the windows build.
771
772         * page/UserContentController.cpp:
773
774 2016-03-14  Sam Weinig  <sam@webkit.org>
775
776         Add a baseURL parameter to _WKUserStyleSheet
777         https://bugs.webkit.org/show_bug.cgi?id=155219
778
779         Reviewed by Tim Horton.
780
781         - Moves to a model for user content where instead of each page having a WebCore::UserContentController
782           object, we have an abstract WebCore::UserContentProvider interface that can be implemented at the WebKit
783           level. For now, legacy WebKit continues to use the old UserContentController, which implements 
784           WebCore::UserContentProvider, and WebKit2 implements its own implementation so it can store additional
785           state.
786
787         * WebCore.xcodeproj/project.pbxproj:
788         Add new files.
789
790         * dom/ExtensionStyleSheets.cpp:
791         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache):
792         Switch to using forEachUserStyleSheet on the UserContentProvider.
793
794         * html/HTMLMediaElement.cpp:
795         (WebCore::HTMLMediaElement::loadResource):
796         Remove null check now that we always have a UserContentProvider.
797
798         * loader/EmptyClients.cpp:
799         (WebCore::fillWithEmptyClients):
800         * loader/EmptyClients.h:
801         Add new EmptyClients.
802
803         * loader/FrameLoader.cpp:
804         (WebCore::FrameLoader::loadResourceSynchronously):
805         Remove null check now that we always have a UserContentProvider.
806
807         * loader/PingLoader.cpp:
808         (WebCore::processContentExtensionRulesForLoad):
809         Remove null check now that we always have a UserContentProvider.
810
811         * loader/ResourceLoader.cpp:
812         (WebCore::ResourceLoader::willSendRequestInternal):
813         Remove null check now that we always have a UserContentProvider.
814
815         * loader/cache/CachedResourceLoader.cpp:
816         (WebCore::CachedResourceLoader::requestResource):
817         Remove null check now that we always have a UserContentProvider.
818
819         * page/DOMWindow.cpp:
820         (WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
821         Remove null checks now that we always have a UserContentProvider, and userMessageHandlerDescriptors
822         returns a reference.
823
824         (WebCore::DOMWindow::open):
825         Remove null check now that we always have a UserContentProvider.
826
827         * page/Frame.cpp:
828         (WebCore::Frame::injectUserScripts):
829         Simplify by lifting document check out of the main loop and using forEachUserScript.
830
831         * page/Page.cpp:
832         (WebCore::Page::Page):
833         (WebCore::Page::~Page):
834         (WebCore::Page::userContentProvider):
835         (WebCore::Page::setUserContentProvider):
836         (WebCore::Page::setUserContentController): Deleted.
837         * page/Page.h:
838         (WebCore::Page::userContentController): Deleted.
839         * page/PageConfiguration.h:
840         Store the UserContentProvider in a Ref, and require PageConfigurations to provide one. This
841         removes a bunch of null checks and simplifies the code.
842
843         * page/UserContentController.cpp:
844         (WebCore::UserContentController::~UserContentController):
845         (WebCore::UserContentController::forEachUserScript):
846         (WebCore::UserContentController::forEachUserStyleSheet):
847         (WebCore::UserContentController::addUserScript):
848         (WebCore::UserContentController::removeUserScript):
849         (WebCore::UserContentController::removeUserScripts):
850         (WebCore::UserContentController::addUserStyleSheet):
851         (WebCore::UserContentController::removeUserStyleSheet):
852         (WebCore::UserContentController::removeUserStyleSheets):
853         (WebCore::UserContentController::addUserMessageHandlerDescriptor):
854         (WebCore::UserContentController::removeUserMessageHandlerDescriptor):
855         (WebCore::UserContentController::addUserContentExtension):
856         (WebCore::UserContentController::removeUserContentExtension):
857         (WebCore::UserContentController::removeAllUserContentExtensions):
858         (WebCore::UserContentController::removeAllUserContent):
859         (WebCore::UserContentController::addPage): Deleted.
860         (WebCore::UserContentController::removePage): Deleted.
861         (WebCore::contentExtensionsEnabled): Deleted.
862         (WebCore::UserContentController::processContentExtensionRulesForLoad): Deleted.
863         (WebCore::UserContentController::actionsForResourceLoad): Deleted.
864         * page/UserContentController.h:
865         (WebCore::UserContentController::userScripts): Deleted.
866         (WebCore::UserContentController::userStyleSheets): Deleted.
867         (WebCore::UserContentController::userMessageHandlerDescriptors): Deleted.
868         Add inheritance from UserContentProvider and simplify things by removing unique_ptrs
869         that were holding the member variables. There is usually only one UserContentController
870         so having these in unique_ptrs doesn't make much sense.
871         
872         * page/UserContentProvider.cpp: Added.
873         (WebCore::UserContentProvider::UserContentProvider):
874         (WebCore::UserContentProvider::~UserContentProvider):
875         (WebCore::UserContentProvider::addPage):
876         (WebCore::UserContentProvider::removePage):
877         (WebCore::UserContentProvider::invalidateInjectedStyleSheetCacheInAllFramesInAllPages):
878         (WebCore::contentExtensionsEnabled):
879         (WebCore::UserContentProvider::processContentExtensionRulesForLoad):
880         (WebCore::UserContentProvider::actionsForResourceLoad):
881         * page/UserContentProvider.h: Added.
882         Add abstract class for providing user content and add some helpers on it.
883
884         * page/UserMessageHandlerDescriptor.h:
885         (WebCore::UserMessageHandlerDescriptor::create):
886         (WebCore::UserMessageHandlerDescriptor::client):
887         (WebCore::UserMessageHandlerDescriptor::invalidateClient):
888         * page/UserMessageHandlersNamespace.cpp:
889         (WebCore::UserMessageHandlersNamespace::handler):
890         Simplify now that userContentProvider() and userMessageHandlerDescriptors() are references.
891
892 2016-03-14  Enrica Casucci  <enrica@apple.com>
893
894         iOS: RTFD format is not available in the pasteboard after copy/cut.
895         https://bugs.webkit.org/show_bug.cgi?id=155477
896         rdar://problem/23500600
897
898         Reviewed by Tim Horton.
899
900         WebKit is using UTTypeRTFD instead of UTTypeFlatRTFD that is the
901         proper RTFD format for pastedboard. I also discovered that, when
902         we create the NSTextAttachment in the NSAttributedString we produce
903         from the DOM range, we are not generating a file name with the
904         appropriate extension for the MIME type. The iOS specific implementation
905         of the MIMETypeRegistry functions were empty.
906         There is no need to have a differentiation between OS X and iOS, so
907         we now have only one file called MIMETypeRegistryCocoa.mm.
908
909         * WebCore.xcodeproj/project.pbxproj:
910         * platform/cocoa/MIMETypeRegistryCocoa.mm: Added.
911         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
912         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType):
913         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
914         (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType):
915         * platform/ios/MIMETypeRegistryIOS.mm: Removed.
916         * platform/ios/PasteboardIOS.mm:
917         (WebCore::Pasteboard::read):
918         (WebCore::Pasteboard::supportedPasteboardTypes):
919         (WebCore::Pasteboard::hasData):
920         * platform/ios/PlatformPasteboardIOS.mm:
921         (WebCore::PlatformPasteboard::write):
922         * platform/mac/MIMETypeRegistryMac.mm: Removed.
923
924 2016-03-14  Daniel Bates  <dabates@apple.com>
925
926         Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
927         https://bugs.webkit.org/show_bug.cgi?id=155466
928         <rdar://problem/25152480>
929
930         Reviewed by Joseph Pecoraro and Timothy Hatcher.
931
932         For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details
933         sidebar for the selected HTML script element or HTML style element. A CSP script hash is
934         only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML
935         script elements only if they do not have a src attribute.
936
937         Tests: inspector/dom/csp-big5-hash.html
938                inspector/dom/csp-hash.html
939
940         * inspector/InspectorDOMAgent.cpp:
941         (WebCore::computeContentSecurityPolicySHA256Hash): Added.
942         (WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style-
943         element, pass the computed SHA-256 CSP hash to the Inspector front end.
944
945 2016-03-14  Joonghun Park  <jh718.park@samsung.com>
946
947         Purge PassRefPtr from ArrayBuffer, ArchiveResource, Pasteboard, LegacyWebArchive and DataObjectGtk
948         https://bugs.webkit.org/show_bug.cgi?id=150497
949
950         Reviewed by Darin Adler.
951
952         No new tests, no new behaviours.
953
954         * Modules/indexeddb/IDBGetResult.h:
955         (WebCore::IDBGetResult::IDBGetResult):
956         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
957         (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord):
958         * Modules/mediastream/RTCDataChannel.cpp:
959         (WebCore::RTCDataChannel::didReceiveRawData):
960         * dom/MessageEvent.cpp:
961         (WebCore::MessageEvent::MessageEvent):
962         * dom/MessageEvent.h:
963         * editing/Editor.cpp:
964         (WebCore::Editor::selectedRange):
965         * editing/Editor.h:
966         * editing/FrameSelection.h:
967         (WebCore::FrameSelection::toNormalizedRange):
968         * editing/VisiblePosition.cpp:
969         (WebCore::makeRange):
970         * editing/VisiblePosition.h:
971         * editing/VisibleSelection.cpp:
972         (WebCore::VisibleSelection::toNormalizedRange):
973         * editing/VisibleSelection.h:
974         * editing/VisibleUnits.cpp:
975         (WebCore::enclosingTextUnitOfGranularity):
976         (WebCore::wordRangeFromPosition):
977         (WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary):
978         (WebCore::rangeExpandedAroundPositionByCharacters):
979         * editing/VisibleUnits.h:
980         * editing/cocoa/HTMLConverter.mm:
981         (HTMLConverter::_addAttachmentForElement):
982         (fileWrapperForURL):
983         * editing/efl/EditorEfl.cpp:
984         (WebCore::Editor::webContentFromPasteboard):
985         * editing/gtk/EditorGtk.cpp:
986         (WebCore::createFragmentFromPasteboardData):
987         (WebCore::Editor::webContentFromPasteboard):
988         * editing/ios/EditorIOS.mm:
989         (WebCore::dataInRTFDFormat):
990         (WebCore::dataInRTFFormat):
991         (WebCore::Editor::selectionInWebArchiveFormat):
992         (WebCore::Editor::WebContentReader::addFragment):
993         (WebCore::Editor::WebContentReader::readWebArchive):
994         (WebCore::Editor::WebContentReader::readRTFD):
995         (WebCore::Editor::WebContentReader::readRTF):
996         (WebCore::Editor::WebContentReader::readImage):
997         (WebCore::Editor::WebContentReader::readURL):
998         (WebCore::Editor::webContentFromPasteboard):
999         (WebCore::Editor::pasteWithPasteboard):
1000         (WebCore::Editor::createFragmentAndAddResources):
1001         (WebCore::Editor::createFragmentForImageResourceAndAddResource):
1002         * editing/mac/EditorMac.mm:
1003         (WebCore::Editor::selectionInWebArchiveFormat):
1004         (WebCore::Editor::adjustedSelectionRange):
1005         (WebCore::dataInRTFDFormat):
1006         (WebCore::dataInRTFFormat):
1007         (WebCore::Editor::dataSelectionForPasteboard):
1008         (WebCore::Editor::WebContentReader::readWebArchive):
1009         (WebCore::Editor::WebContentReader::readRTFD):
1010         (WebCore::Editor::WebContentReader::readRTF):
1011         (WebCore::Editor::WebContentReader::readImage):
1012         (WebCore::Editor::WebContentReader::readURL):
1013         (WebCore::Editor::webContentFromPasteboard):
1014         (WebCore::Editor::createFragmentForImageResourceAndAddResource):
1015         (WebCore::Editor::createFragmentAndAddResources):
1016         * editing/win/EditorWin.cpp:
1017         (WebCore::createFragmentFromPlatformData):
1018         (WebCore::Editor::webContentFromPasteboard):
1019         * inspector/InspectorPageAgent.cpp:
1020         (WebCore::InspectorPageAgent::archive):
1021         * loader/DocumentLoader.cpp:
1022         (WebCore::DocumentLoader::mainResourceData):
1023         (WebCore::DocumentLoader::maybeCreateArchive):
1024         (WebCore::DocumentLoader::addArchiveResource):
1025         (WebCore::DocumentLoader::mainResource):
1026         * loader/DocumentLoader.h:
1027         * loader/FrameLoader.cpp:
1028         (WebCore::FrameLoader::loadArchive):
1029         * loader/SubstituteData.h:
1030         (WebCore::SubstituteData::SubstituteData):
1031         (WebCore::SubstituteData::isValid):
1032         * loader/SubstituteResource.h:
1033         (WebCore::SubstituteResource::data):
1034         (WebCore::SubstituteResource::SubstituteResource):
1035         * loader/appcache/ApplicationCacheGroup.cpp:
1036         (WebCore::ApplicationCacheGroup::didReceiveResponse):
1037         (WebCore::ApplicationCacheGroup::didReceiveData):
1038         (WebCore::ApplicationCacheGroup::didFail):
1039         (WebCore::ApplicationCacheGroup::didReceiveManifestData):
1040         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
1041         * loader/appcache/ApplicationCacheHost.cpp:
1042         (WebCore::ApplicationCacheHost::maybeLoadMainResource):
1043         (WebCore::ApplicationCacheHost::maybeLoadSynchronously):
1044         (WebCore::ApplicationCacheHost::maybeLoadFallbackSynchronously):
1045         * loader/appcache/ApplicationCacheResource.cpp:
1046         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
1047         (WebCore::ApplicationCacheResource::deliver):
1048         (WebCore::ApplicationCacheResource::estimatedSizeInStorage):
1049         * loader/appcache/ApplicationCacheResource.h:
1050         (WebCore::ApplicationCacheResource::create):
1051         * loader/appcache/ApplicationCacheStorage.cpp:
1052         (WebCore::ApplicationCacheStorage::store):
1053         (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
1054         * loader/appcache/ApplicationCacheStorage.h:
1055         * loader/archive/ArchiveFactory.cpp:
1056         (WebCore::archiveFactoryCreate):
1057         (WebCore::ArchiveFactory::create):
1058         * loader/archive/ArchiveFactory.h:
1059         * loader/archive/ArchiveResource.cpp:
1060         (WebCore::ArchiveResource::ArchiveResource):
1061         (WebCore::ArchiveResource::create):
1062         * loader/archive/ArchiveResource.h:
1063         * loader/archive/ArchiveResourceCollection.cpp:
1064         (WebCore::ArchiveResourceCollection::addResource):
1065         * loader/archive/ArchiveResourceCollection.h:
1066         * loader/archive/cf/LegacyWebArchive.cpp:
1067         (WebCore::LegacyWebArchive::createPropertyListRepresentation):
1068         (WebCore::LegacyWebArchive::createResource):
1069         (WebCore::LegacyWebArchive::create):
1070         (WebCore::LegacyWebArchive::createFromSelection):
1071         * loader/archive/cf/LegacyWebArchive.h:
1072         * loader/archive/mhtml/MHTMLArchive.cpp:
1073         (WebCore::MHTMLArchive::create):
1074         * loader/archive/mhtml/MHTMLArchive.h:
1075         * loader/archive/mhtml/MHTMLParser.cpp:
1076         (WebCore::MHTMLParser::parseArchive):
1077         (WebCore::MHTMLParser::parseArchiveWithHeader):
1078         (WebCore::MHTMLParser::parseNextPart):
1079         * loader/archive/mhtml/MHTMLParser.h:
1080         * loader/cache/CachedImage.cpp:
1081         (WebCore::CachedImage::didAddClient):
1082         * loader/icon/IconDatabase.cpp:
1083         (WebCore::loadDefaultIconRecord):
1084         * loader/icon/IconRecord.cpp:
1085         (WebCore::IconRecord::setImageData):
1086         * loader/icon/IconRecord.h:
1087         * platform/Pasteboard.h:
1088         * platform/PasteboardStrategy.h:
1089         * platform/PlatformPasteboard.h:
1090         * platform/SharedBuffer.cpp:
1091         (WebCore::SharedBuffer::createArrayBuffer):
1092         (WebCore::utf8Buffer):
1093         * platform/SharedBuffer.h:
1094         (WebCore::SharedBuffer::create):
1095         * platform/cf/SharedBufferCF.cpp:
1096         (WebCore::SharedBuffer::wrapCFData):
1097         * platform/cocoa/NetworkExtensionContentFilter.mm:
1098         (WebCore::NetworkExtensionContentFilter::replacementData):
1099         * platform/cocoa/ParentalControlsContentFilter.mm:
1100         (WebCore::ParentalControlsContentFilter::replacementData):
1101         * platform/graphics/Image.cpp:
1102         (WebCore::Image::setData):
1103         * platform/graphics/Image.h:
1104         * platform/gtk/DataObjectGtk.cpp:
1105         (WebCore::DataObjectGtk::forClipboard):
1106         * platform/gtk/DataObjectGtk.h:
1107         (WebCore::DataObjectGtk::create):
1108         * platform/gtk/PasteboardGtk.cpp:
1109         (WebCore::Pasteboard::Pasteboard):
1110         (WebCore::Pasteboard::dataObject):
1111         * platform/ios/PasteboardIOS.mm:
1112         (WebCore::Pasteboard::read):
1113         * platform/ios/PlatformPasteboardIOS.mm:
1114         (WebCore::PlatformPasteboard::bufferForType):
1115         (WebCore::PlatformPasteboard::readBuffer):
1116         * platform/mac/PasteboardMac.mm:
1117         (WebCore::writeFileWrapperAsRTFDAttachment):
1118         (WebCore::Pasteboard::read):
1119         * platform/mac/PlatformPasteboardMac.mm:
1120         (WebCore::PlatformPasteboard::bufferForType):
1121         * platform/mac/SharedBufferMac.mm:
1122         (WebCore::SharedBuffer::wrapNSData):
1123         (WebCore::SharedBuffer::createFromReadingFile):
1124         * platform/network/MIMEHeader.cpp:
1125         (WebCore::retrieveKeyValuePairs):
1126         (WebCore::MIMEHeader::parseHeader):
1127         * platform/network/MIMEHeader.h:
1128         * platform/soup/SharedBufferSoup.cpp:
1129         (WebCore::SharedBuffer::wrapSoupBuffer):
1130         * platform/win/ClipboardUtilitiesWin.cpp:
1131         (WebCore::fragmentFromFilenames):
1132         (WebCore::fragmentFromCFHTML):
1133         (WebCore::fragmentFromHTML):
1134         * platform/win/ClipboardUtilitiesWin.h:
1135         * platform/win/PasteboardWin.cpp:
1136         (WebCore::Pasteboard::documentFragment):
1137
1138 2016-03-14  Oliver Hunt  <oliver@apple.com>
1139
1140         Temporarily disable the separated heap.
1141         https://bugs.webkit.org/show_bug.cgi?id=155472
1142
1143         Reviewed by Geoffrey Garen.
1144
1145         Temporarily disable this.
1146
1147         * Configurations/FeatureDefines.xcconfig:
1148
1149 2016-03-10  Antonio Gomes  <tonikitoo@webkit.org>
1150
1151         Selecting with shift+drag results in unexpected drag-n-drop
1152         https://bugs.webkit.org/show_bug.cgi?id=155314
1153
1154         Reviewed by Darin Adler.
1155
1156         Test: editing/selection/shift-drag-selection-no-drag-n-drop.html
1157
1158         Whenever user tries to extend an existing text selection by dragging the mouse
1159         (left button hold) with shift key pressed, WebKit enters drag-n-drop mode.
1160         This behavior does not match common editing behavior out there, including other
1161         browsers' (Firefox, Opera/Presto and IE).
1162
1163         Patch changes WebKit so that whenever one extends a selection with mouse
1164         and shift key pressed off of a #text node, it does not enter drag-n-drop mode.
1165
1166         Additionally, patch also adds some further tests to ensure that when
1167         selection is extended off of either a link or an image, drag-n-drop does
1168         get triggered, no matter if shift key is pressed.
1169
1170         * page/EventHandler.cpp:
1171         (WebCore::EventHandler::handleMousePressEvent):
1172
1173 2016-03-14  Brent Fulgham  <bfulgham@apple.com>
1174
1175         REGRESSION (r197114): Crash in WebCore::MediaDevicesRequest::didCompletePermissionCheck
1176         https://bugs.webkit.org/show_bug.cgi?id=155453
1177         <rdar://problem/24879447>
1178
1179         Reviewed by Daniel Bates.
1180
1181         Tested by fast/mediastream/enumerating-crash.html.
1182
1183         * Modules/mediastream/MediaDevicesRequest.cpp:
1184         (WebCore::MediaDevicesRequest::didCompletePermissionCheck): Prevent UserMediaPermissionCheck object from being
1185         destroyed before the method completes.
1186
1187 2016-03-14  Simon Fraser  <simon.fraser@apple.com>
1188
1189         Fix crash when reloading a page using requestAnimationFrame on iOS
1190         https://bugs.webkit.org/show_bug.cgi?id=155465
1191         rdar://problem/25100202
1192
1193         Reviewed by Tim Horton.
1194
1195         On iOS, it's possible for all clients for a DisplayRefreshMonitor
1196         to be unregistered, but still get a subsequent displayDidRefresh() for that monitor.
1197         In this case, we would remove(notFound) which release-asserts.
1198         
1199         Fix by just checking for notFound.
1200         
1201         Unable to test because requestAnimationFrame doesn't work in the simulator.
1202
1203         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1204         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
1205
1206 2016-03-14  Per Arne Vollan  <peavo@outlook.com>
1207
1208         [WinCairo][MediaFoundation] Implement float versions of MediaPlayer methods.
1209         https://bugs.webkit.org/show_bug.cgi?id=155357
1210
1211         Reviewed by Brent Fulgham.
1212
1213         It is better to implement the float versions of some of the MediaPlayer methods,
1214         since the default implementation of the double versions is to call the float version.
1215         Also added override keyword to overridden methods.
1216
1217         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1218         (WebCore::MediaPlayerPrivateMediaFoundation::seeking):
1219         (WebCore::MediaPlayerPrivateMediaFoundation::seek):
1220         (WebCore::MediaPlayerPrivateMediaFoundation::setRate):
1221         (WebCore::MediaPlayerPrivateMediaFoundation::duration):
1222         (WebCore::MediaPlayerPrivateMediaFoundation::currentTime):
1223         (WebCore::MediaPlayerPrivateMediaFoundation::seekDouble): Deleted.
1224         (WebCore::MediaPlayerPrivateMediaFoundation::setRateDouble): Deleted.
1225         (WebCore::MediaPlayerPrivateMediaFoundation::durationDouble): Deleted.
1226         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1227
1228 2016-03-14  Tim Horton  <timothy_horton@apple.com>
1229
1230         Revert r194125 and r194186: We're going to fix this a different way.
1231
1232         * page/EventHandler.cpp:
1233         (WebCore::EventHandler::clear):
1234         * page/EventHandler.h:
1235
1236 2016-03-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1237
1238         [Fetch API] FetchLoader should check for empty bodies
1239         https://bugs.webkit.org/show_bug.cgi?id=155440
1240
1241         Reviewed by Darin Adler.
1242
1243         Covered by added tests.
1244
1245         * Modules/fetch/FetchLoader.cpp:
1246         (WebCore::FetchLoader::didFinishLoading): returning empty array buffer/empty string if no data received during loading.
1247
1248 2016-03-14  Chris Dumez  <cdumez@apple.com>
1249
1250         Regression(r197981): Huge regression on Mac PLT
1251         https://bugs.webkit.org/show_bug.cgi?id=155443
1252         <rdar://problem/25113391>
1253
1254         Reviewed by Gavin Barraclough.
1255
1256         We have experience a huge regression on Mac PLT after r197981, so
1257         disable the feature until the performance issue is resolved.
1258
1259         * platform/graphics/ca/GraphicsLayerCA.cpp:
1260         (WebCore::GraphicsLayer::supportsSmoothedLayerText):
1261
1262 2016-03-14  Chris Vienneau  <chris.vno@outlook.com>
1263
1264         PingHandle delete's itself but pointer is still used by handleDataURL
1265         https://bugs.webkit.org/show_bug.cgi?id=154752
1266         <rdar://problem/24872347>
1267
1268         Reviewed by Alex Christensen.
1269
1270         When a PingHandle is destroyed, we should tell its client so that the client can clear the pointer it
1271         holds to the element to avoid accidentally attempting to use deallocated memory.
1272
1273         The ResourceHandle's client member may be null after "didReceiveResponse" is called. We should confirm
1274         the client is still valid after these calls.
1275
1276         * platform/network/DataURL.cpp:
1277         (WebCore::handleDataURL): Check the client pointer before using it.
1278         * platform/network/PingHandle.h:
1279         (WebCore::PingHandle::~PingHandle): Notify the client we are being destroyed.
1280         * platform/platform/network/ResourceHandle.h:
1281
1282 2016-03-14  Zalan Bujtas  <zalan@apple.com>
1283
1284         Negative outline offset could break curved outline-style: auto
1285         https://bugs.webkit.org/show_bug.cgi?id=155416
1286
1287         Reviewed by Tim Horton.
1288
1289         When radius becomes negative the rounded rect could end up being un-renderable -> no rounded corners at all.
1290
1291         Test: fast/inline/hidpi-outline-auto-negative-offset-with-border-radius.html
1292
1293         * platform/graphics/PathUtilities.cpp:
1294         (WebCore::adjustedtRadiiForHuggingCurve):
1295
1296 2016-03-14  Zalan Bujtas  <zalan@apple.com>
1297
1298         [Outline: auto] Fractional radius value could result in non-renderable rounded border.
1299         https://bugs.webkit.org/show_bug.cgi?id=155420
1300
1301         Reviewed by Tim Horton.
1302
1303         RoundedRect::pixelSnappedRoundedRectForPainting ensures that the rounded rect is always renderable.
1304
1305         Test: fast/inline/hidpi-outline-auto-with-fractional-radius.html
1306
1307         * platform/graphics/PathUtilities.cpp:
1308         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
1309         * platform/graphics/PathUtilities.h:
1310         * rendering/RenderElement.cpp:
1311         (WebCore::RenderElement::paintFocusRing):
1312
1313 2016-03-14  Zalan Bujtas  <zalan@apple.com>
1314
1315         Outline: auto has sharp corners with single line contenteditable.
1316         https://bugs.webkit.org/show_bug.cgi?id=155418
1317
1318         Reviewed by Tim Horton.
1319
1320         Multiple rectangles assumed multiline content and it broke bottomLeft and bottomRight corner check.
1321         This patch adds fast path for polygons with 4 corners.
1322
1323         Test: fast/inline/hidpi-outline-auto-with-one-focusring-rect.html
1324
1325         * platform/graphics/PathUtilities.cpp:
1326         (WebCore::cornerType):
1327         (WebCore::cornerTypeForMultiline):
1328         (WebCore::rectFromPolygon):
1329         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
1330
1331 2016-03-14  Joanmarie Diggs  <jdiggs@igalia.com>
1332
1333         [AX] SVG element with child desc not exposed
1334         https://bugs.webkit.org/show_bug.cgi?id=155374
1335
1336         Reviewed by Darin Adler.
1337
1338         Covered by the accessibility/w3c-svg-roles.html test, which was updated.
1339
1340         AccessibilitySVGRoot is now a subclass of AccessibilitySVGElement, which
1341         exposes SVG elements with a child desc element as per the specification.
1342         Also made existing protected methods private.
1343
1344         * accessibility/AccessibilitySVGElement.h:
1345         * accessibility/AccessibilitySVGRoot.cpp:
1346         (WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
1347         (WebCore::AccessibilitySVGRoot::parentObject):
1348         * accessibility/AccessibilitySVGRoot.h:
1349
1350 2016-03-14  Alexey Proskuryakov  <ap@apple.com>
1351
1352         Build fix.
1353
1354         * Modules/fetch/FetchBodyOwner.cpp:
1355         (WebCore::FetchBodyOwner::loadedBlobAsText):
1356
1357 2016-03-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1358
1359         [Fetch API] Implement data resolution for blob stored in Body
1360         https://bugs.webkit.org/show_bug.cgi?id=155359
1361
1362         Reviewed by Darin Adler.
1363
1364         Introducing FetchLoader as a wrapper around ThreadableLoader to load resources.
1365         FetchLoader can retrieve data as text or array buffer. It only supports blob currently.
1366
1367         Introducing FetchLoaderClient interface and FetchBodyOwner::BlobLoader as specifc blob loader client.
1368
1369         Covered by existing rebased tests.
1370
1371         * CMakeLists.txt:
1372         * Modules/fetch/FetchBody.cpp:
1373         (WebCore::FetchBody::loadingType):
1374         (WebCore::FetchBody::loadedAsArrayBuffer):
1375         (WebCore::FetchBody::loadedAsText):
1376         * Modules/fetch/FetchBody.h:
1377         * Modules/fetch/FetchBodyOwner.cpp: Added.
1378         (WebCore::FetchBodyOwner::FetchBodyOwner):
1379         (WebCore::FetchBodyOwner::loadBlob):
1380         (WebCore::FetchBodyOwner::finishBlobLoading):
1381         (WebCore::FetchBodyOwner::blobLoadingFailed):
1382         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
1383         * Modules/fetch/FetchBodyOwner.h:
1384         (WebCore::FetchBodyOwner::loadedBlobAsText):
1385         (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer):
1386         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
1387         * Modules/fetch/FetchLoader.cpp: Added.
1388         (WebCore::FetchLoader::start):
1389         (WebCore::FetchLoader::FetchLoader):
1390         (WebCore::FetchLoader::stop):
1391         (WebCore::FetchLoader::didReceiveResponse):
1392         (WebCore::FetchLoader::didReceiveData):
1393         (WebCore::FetchLoader::didFinishLoading):
1394         (WebCore::FetchLoader::didFail):
1395         * Modules/fetch/FetchLoader.h: Added.
1396         * Modules/fetch/FetchLoaderClient.h: Added.
1397         (WebCore::FetchLoaderClient::~FetchLoaderClient):
1398         (WebCore::FetchLoaderClient::didReceiveResponse):
1399         (WebCore::FetchLoaderClient::didFinishLoadingAsText):
1400         (WebCore::FetchLoaderClient::didFinishLoadingAsArrayBuffer):
1401         * WebCore.xcodeproj/project.pbxproj:
1402
1403 2016-03-14  Frederic Wang  <fwang@igalia.com>
1404
1405         Make MathML colspan/rowspan consistent with HTML table cells.
1406         https://bugs.webkit.org/show_bug.cgi?id=150253
1407
1408         Reviewed by Martin Robinson.
1409
1410         Test: mathml/rowspan-crash.xhtml
1411
1412         We make MathMLElement::colSpan and MathMLElement::rowSpan consistent with the corresponding functions in HTMLTableCellElement.cpp.
1413         These functions now return unsigned integers, use the same parsing functions and set a maximum for rowspan.
1414         This latter change fixes crash/timeout with large values of rowspan.
1415
1416         * mathml/MathMLElement.cpp: Include HTMLParserIdioms to use limitToOnlyHTMLNonNegative.
1417         (WebCore::MathMLElement::colSpan): Use unsigned integer and limitToOnlyHTMLNonNegative.
1418         (WebCore::MathMLElement::rowSpan): ditto. We also use the same maximum limit as HTMLTableCellElement.
1419         * mathml/MathMLElement.h: Make colSpan and rowSpan return unsigned integers.
1420
1421 2016-03-14  Tomas Popela  <tpopela@redhat.com>
1422
1423         Enable GSS-Negotiate support in libsoup
1424         https://bugs.webkit.org/show_bug.cgi?id=155354
1425
1426         Reviewed by Carlos Garcia Campos.
1427
1428         Enable the SOUP_TYPE_AUTH_NEGOTIATE feature if libsoup was compiled
1429         with the GSS-Negotiate support.
1430
1431         * platform/network/soup/SoupNetworkSession.cpp:
1432         (WebCore::SoupNetworkSession::SoupNetworkSession):
1433
1434 2016-03-14  Ryosuke Niwa  <rniwa@webkit.org>
1435
1436         Add slotchange event
1437         https://bugs.webkit.org/show_bug.cgi?id=155424
1438         <rdar://problem/24997534>
1439
1440         Reviewed by Antti Koivisto.
1441
1442         Added `slotchange` event as discussed on https://github.com/w3c/webcomponents/issues/288.
1443
1444         While the exact semantics of it could still evolve over time, this patch implements as
1445         an asynchronous event that fires on a slot element whenever its distributed nodes change
1446         (flattened assigned nodes):
1447         http://w3c.github.io/webcomponents/spec/shadow/#dfn-distributed-nodes
1448
1449         Since inserting or removing an element from a shadow host could needs to enqueue this event
1450         on the right slot element, this patch moves the invalidation point of element removals and
1451         insertions from Element::childrenChanged to Element::insertedInto and Element::removedFrom.
1452         Text nodes are still invalidated at Element::childrenChanged for performance reasons
1453         since it could only appear within a default slot element.
1454
1455         Because this more fine-grained invalidation needs to be overridden by HTMLDetailsElement,
1456         we now subclass SlotAssignment in HTMLDetailsElement instead of passing in a std::function.
1457
1458         Test: fast/shadow-dom/slotchange-event.html
1459
1460         * dom/Document.cpp:
1461         (WebCore::Document::enqueueSlotchangeEvent): Added.
1462         * dom/Document.h:
1463         * dom/Element.cpp:
1464         (WebCore::Element::attributeChanged): Call hostChildElementDidChangeSlotAttr.
1465         (WebCore::Element::insertedInto): Call hostChildElementDidChange.
1466         (WebCore::Element::removedFrom): Ditto.
1467         (WebCore::Element::childrenChanged): Don't invalidate the slots on ElementInserted and
1468         ElementRemoved since they're now done in Element::insertedInto and Element::removedFrom.
1469         * dom/Event.cpp:
1470         (WebCore::Event::scoped): slotchange event is scoped.
1471         * dom/EventNames.h: Added eventNames().slotchange.
1472         * dom/ShadowRoot.cpp:
1473         (WebCore::ShadowRoot::invalidateSlotAssignments): Deleted.
1474         (WebCore::ShadowRoot::invalidateDefaultSlotAssignments): Deleted.
1475         * dom/ShadowRoot.h:
1476         (ShadowRoot): Added more fine-grained invalidators, mirroring changes to SlotAssignment.
1477         * dom/SlotAssignment.cpp:
1478         (WebCore::SlotAssignment::SlotAssignment): Removed a variant that takes SlotNameFunction
1479         since HTMLDetailsElement now subclasses SlotAssignment.
1480         (WebCore::SlotAssignment::~SlotAssignment): Added now that the class is virtual.
1481         (WebCore::recursivelyFireSlotChangeEvent): Added.
1482         (WebCore::SlotAssignment::didChangeSlot): Added. Invalidates the style tree only if there
1483         is a corresponding slot element, and fires slotchange event. When the slot element we found
1484         in this shadow tree is assigned to a slot element inside an inner shadow tree, recursively
1485         fire slotchange event on each such inner slots.
1486         (WebCore::SlotAssignment::hostChildElementDidChange): Added. Update the matching slot when
1487         an element is inserted or removed under a shadow host.
1488         (WebCore::SlotAssignment::assignedNodesForSlot): Removed the superfluous early exit to an
1489         release assert since addSlotElementByName should always create a SlotInfo for each element.
1490         (WebCore::SlotAssignment::slotNameForHostChild): Added. This is the equivalent of old
1491         m_slotNameFunction which DetailsSlotAssignment overrides.
1492         (WebCore::SlotAssignment::invalidateDefaultSlot): Deleted.
1493         (WebCore::SlotAssignment::findFirstSlotElement): Added an assertion. slotInfo.element must
1494         be nullptr if elementCount is 0, and elementCount must be 0 if slotInfo.element is nullptr
1495         after calling resolveAllSlotElements, which traverses the entire shadow tree to find all
1496         slot elements.
1497         (WebCore::SlotAssignment::assignSlots):
1498         * dom/SlotAssignment.h: Implemented inline functions of ShadowRoot here to avoid including
1499         SlotAssignment.h in ShadowRoot.h. Not inlining them results in extra function calls for all
1500         builtin elements with shadow root without slot elements, which impacts performance.
1501         (WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost): Added.
1502         (WebCore::ShadowRoot::didChangeDefaultSlot): Added.
1503         (WebCore::ShadowRoot::hostChildElementDidChange): Added.
1504         (WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute): Added.
1505         (WebCore::ShadowRoot::innerSlotDidChange):
1506         * html/HTMLDetailsElement.cpp:
1507         (WebCore::DetailsSlotAssignment): Added. Subclasses SlotAssignment to override
1508         hostChildElementDidChange and slotNameForHostChild.
1509         (WebCore::DetailsSlotAssignment::hostChildElementDidChange): Added. We don't check if this
1510         is the first summary element since we don't know the answer when this function is called
1511         inside Element::removedFrom.
1512         (WebCore::DetailsSlotAssignment::slotNameForHostChild): Renamed from slotNameFunction. Also
1513         removed the code to return nullAtom when details element is not open as that messes up new
1514         fine-grained invalidation. Insert/remove the slot element in parseAttribute instead.
1515         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Don't insert the slot element for
1516         the summary since the details element is not open now.
1517         (WebCore::HTMLDetailsElement::parseAttribute): Remove and insert the slot element for the
1518         summary here instead of changing the behavior of slotNameForHostChild.
1519         * html/HTMLDetailsElement.h:
1520         * html/HTMLSlotElement.cpp:
1521         (WebCore::HTMLSlotElement::enqueueSlotChangeEvent): Added. Enqueues a new slotchange event
1522         if we haven't done so for this element yet.
1523         (WebCore::HTMLSlotElement::dispatchEvent): Added. Clear m_hasEnqueuedSlotChangeEvent when
1524         dispatching a slotchange event so that a subsequent call to enqueueSlotChangeEvent would
1525         enqueue a new event. Note scripts call EventTarget::dispatchEventForBindings instead.
1526         * html/HTMLSlotElement.h:
1527
1528 2016-03-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1529
1530         Introduce CallWith=Document in binding generator
1531         https://bugs.webkit.org/show_bug.cgi?id=155358
1532
1533         Reviewed by Darin Adler.
1534
1535         Covered by existing tests and binding test.
1536
1537         * Modules/notifications/Notification.cpp:
1538         (WebCore::Notification::permission): Taking a Document& instead of ScriptExecutionContext&.
1539         (WebCore::Notification::requestPermission): Ditto.
1540         * Modules/notifications/Notification.h:
1541         * Modules/notifications/Notification.idl: Using CallWith=Document.
1542         * bindings/scripts/CodeGeneratorJS.pm: Adding support for CallWith=Document and changed name from scriptContext to context.
1543         (GenerateCallWith):
1544         (GenerateConstructorDefinition):
1545         * bindings/scripts/IDLAttributes.txt: Adding support for CallWith=Document.
1546         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
1547         (webkit_dom_test_obj_with_document_argument):
1548         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
1549         * bindings/scripts/test/JS/JSTestInterface.cpp:
1550         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
1551         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
1552         * bindings/scripts/test/JS/JSTestObj.cpp:
1553         (WebCore::jsTestObjWithScriptExecutionContextAttribute):
1554         (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
1555         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
1556         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
1557         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
1558         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
1559         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
1560         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
1561         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
1562         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
1563         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
1564         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
1565         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
1566         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
1567         (WebCore::jsTestObjPrototypeFunctionWithDocumentArgument):
1568         * bindings/scripts/test/ObjC/DOMTestObj.h:
1569         * bindings/scripts/test/ObjC/DOMTestObj.mm:
1570         (-[DOMTestObj withDocumentArgument]):
1571         * bindings/scripts/test/TestObj.idl: Adding binding test.
1572         * page/DOMWindow.cpp:
1573         (WebCore::DOMWindow::focus): Taking a Document& instead of ScriptExecutionContext&.
1574         (WebCore::DOMWindow::close): Ditto.
1575         * page/DOMWindow.h:
1576         * page/DOMWindow.idl:
1577         * page/History.cpp:
1578         (WebCore::History::back): Ditto.
1579         (WebCore::History::forward): Ditto.
1580         (WebCore::History::go): Ditto.
1581         * page/History.h:
1582         * page/History.idl:
1583         * testing/Internals.cpp:
1584         (WebCore::InspectorStubFrontend::closeWindow): Calling DOMWindow::close() directly.
1585
1586 2016-03-13  Joseph Pecoraro  <pecoraro@apple.com>
1587
1588         Remove ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX) guards
1589         https://bugs.webkit.org/show_bug.cgi?id=155417
1590
1591         Reviewed by Yusuke Suzuki.
1592
1593         * Configurations/FeatureDefines.xcconfig:
1594
1595 2016-03-13  Sam Weinig  <sam@webkit.org>
1596
1597         Implement unprivileged execCommand("copy") and execCommand("cut")
1598         <rdar://problem/24354406>
1599         https://bugs.webkit.org/show_bug.cgi?id=146336
1600
1601         Reviewed by Dean Jackson.
1602
1603         Test: editing/execCommand/clipboard-access-with-user-gesture.html
1604
1605         * WebCore.xcodeproj/project.pbxproj:
1606         Add new files.
1607
1608         * editing/ClipboardAccessPolicy.h:
1609         Added.
1610
1611         * editing/EditorCommand.cpp:
1612         (WebCore::defaultValueForSupportedCopyCut):
1613         (WebCore::supportedCopyCut):
1614         Match other browsers and allow the copy and cut commands
1615         to be executed when there is a user gesture.
1616
1617         * page/Settings.h:
1618         Add include of ClipboardAccessPolicy.h.
1619
1620         * page/Settings.in:
1621         Add new setting for ClipboardAccessPolicy
1622
1623 2016-03-13  Ryosuke Niwa  <rniwa@webkit.org>
1624
1625         REGRESSION (r190840): crash inside details element's slotNameFunction
1626         https://bugs.webkit.org/show_bug.cgi?id=155388
1627
1628         Reviewed by Antti Koivisto.
1629
1630         The bug was caused by HTMLDetailsElement::isActiveSummary calling findAssignedSlot with a summary element
1631         inside the shadow tree of the detials element. Fixed it by existing early when the summary element passed
1632         to isActiveSummary is not a direct child of the details element.
1633
1634         Test: fast/html/details-summary-tabindex-crash.html
1635
1636         * dom/ShadowRoot.cpp:
1637         (WebCore::ShadowRoot::findAssignedSlot): Added an assertion for regression testing.
1638         * dom/SlotAssignment.cpp:
1639         (WebCore::SlotAssignment::findAssignedSlot): Removed the superfluous call to assignSlots added in r190840.
1640         There is no need to update the slot assignments here (entires in m_slots are added or removed by
1641         addSlotElementByName or removeSlotElementByName and assignSlots only updates assignedNodes in each SlotInfo
1642         which is never used in this function or findFirstSlotElement.
1643         * html/HTMLDetailsElement.cpp:
1644         (WebCore::HTMLDetailsElement::isActiveSummary): Fixed the bug.
1645
1646 2016-03-13  Antti Koivisto  <antti@apple.com>
1647
1648         ComposedTreeIterator fails to traverse slots if root is shadow host
1649         https://bugs.webkit.org/show_bug.cgi?id=155407
1650
1651         Reviewed by Darin Adler.
1652
1653         Test: fast/shadow-dom/composed-tree-shadow-subtree.html
1654
1655         * dom/ComposedTreeIterator.cpp:
1656         (WebCore::ComposedTreeIterator::ComposedTreeIterator):
1657
1658             Traversal functions assume m_contextStack is deeper than 1 before they need to enter slot traversal code paths.
1659             Call initializeContextStack in case of shadow host which does the right thing.
1660
1661         (WebCore::ComposedTreeIterator::traverseSiblingInSlot):
1662         (WebCore::composedTreeAsText):
1663
1664             Add option to include pointers as debugging aid.
1665
1666         * dom/ComposedTreeIterator.h:
1667         (WebCore::composedTreeChildren):
1668
1669 2016-03-12  Sam Weinig  <sam@webkit.org>
1670
1671         WebKit can easily crash below NetworkSession::dataTaskForIdentifier() with NSURLSession enabled
1672         <rdar://problem/25129946>
1673         https://bugs.webkit.org/show_bug.cgi?id=155401
1674
1675         Reviewed by Alex Christensen.
1676
1677         Add a SessionID as a member of NetworkStorageSession. This allows us to avoid having HashMaps
1678         to map between the two types.
1679
1680         * platform/network/NetworkStorageSession.h:
1681         (WebCore::NetworkStorageSession::sessionID):
1682         (WebCore::NetworkStorageSession::credentialStorage):
1683         (WebCore::NetworkStorageSession::platformSession):
1684         * platform/network/NetworkStorageSessionStub.cpp:
1685         (WebCore::NetworkStorageSession::NetworkStorageSession):
1686         (WebCore::NetworkStorageSession::context):
1687         (WebCore::NetworkStorageSession::createPrivateBrowsingSession):
1688         (WebCore::defaultSession):
1689         (WebCore::NetworkStorageSession::defaultStorageSession):
1690         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1691         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1692         (WebCore::NetworkStorageSession::NetworkStorageSession):
1693         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1694         (WebCore::NetworkStorageSession::defaultStorageSession):
1695         (WebCore::NetworkStorageSession::createPrivateBrowsingSession):
1696         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1697         (WebCore::NetworkStorageSession::NetworkStorageSession):
1698         (WebCore::NetworkStorageSession::defaultStorageSession):
1699         (WebCore::NetworkStorageSession::createPrivateBrowsingSession):
1700         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1701         (WebCore::NetworkStorageSession::soupNetworkSession):
1702
1703 2016-03-13  Jon Lee  <jonlee@apple.com>
1704
1705         getUserMedia requests from the main frame should be treated the same as requests from an iframe with the same origin
1706         https://bugs.webkit.org/show_bug.cgi?id=155405
1707         <rdar://problem/25131007>
1708
1709         Reviewed by Eric Carlson.
1710
1711         When gUM is called from the main frame, or from a subframe with the same origin, the
1712         top level document origin should be the same.
1713
1714         * Modules/mediastream/UserMediaRequest.cpp:
1715         (WebCore::UserMediaRequest::userMediaDocumentOrigin): Reverse the logic so that it is similar
1716         to topLevelDocumentOrigin.
1717         (WebCore::UserMediaRequest::topLevelDocumentOrigin): Return the top origin always.
1718
1719 2016-03-13  David Kilzer  <ddkilzer@apple.com>
1720
1721         REGRESSION (r198079): Windows build broke because of "%PRId64" format specifier
1722
1723         * platform/network/ParsedContentRange.cpp: Add #include
1724         <wtf/StdLibExtras.h> and remove local definition of "PRId64".
1725
1726 2016-03-13  Joonghun Park  <jh718.park@samsung.com>
1727
1728         [EFL] Fix debug build error since r197690. Unreviewed.
1729         https://bugs.webkit.org/show_bug.cgi?id=155408
1730
1731         Unreviewed. Change %lld to %PRId instead to correct the error below.
1732         error: format ‘%lld’ expects argument of type ‘long long int’,
1733         but argument 5 has type ‘std::chrono::duration<long int, std::ratio<1l, 1000l> >::rep
1734         {aka long int}’ [-Werror=format=]
1735
1736         * page/DOMTimer.cpp:
1737         (WebCore::DOMTimer::updateTimerIntervalIfNecessary):
1738
1739 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
1740
1741         [Cocoa] Remove typedef from NSScrollerImp to ScrollbarPainter
1742         https://bugs.webkit.org/show_bug.cgi?id=155379
1743
1744         Reviewed by Beth Dakin.
1745
1746         There's no reason to not call them what they are.
1747
1748         No new tests because there is no behavior change.
1749
1750         * page/scrolling/AsyncScrollingCoordinator.cpp:
1751         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1752         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1753         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1754         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars):
1755         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarPaintersFromScrollbars): Deleted.
1756         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1757         * page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm:
1758         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars):
1759         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarPaintersFromScrollbars): Deleted.
1760         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1761         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1762         (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
1763         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac):
1764         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread):
1765         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren):
1766         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1767         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1768         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollbarPaintersOnTheMainThread): Deleted.
1769         * platform/ScrollbarThemeComposite.h:
1770         * platform/mac/ScrollAnimatorMac.h:
1771         * platform/mac/ScrollAnimatorMac.mm:
1772         (scrollbarPainterForScrollbar):
1773         (-[WebScrollerImpDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
1774         (-[WebScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
1775         (-[WebScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
1776         (-[WebScrollerImpDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
1777         (-[WebScrollerImpDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
1778         (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
1779         (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
1780         (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
1781         (WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
1782         (WebCore::ScrollAnimatorMac::mouseIsDownInScrollbar):
1783         (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
1784         (WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar):
1785         (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
1786         (WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar):
1787         (WebCore::ScrollAnimatorMac::invalidateScrollbarPartLayers):
1788         (WebCore::ScrollAnimatorMac::verticalScrollbarLayerDidChange):
1789         (WebCore::ScrollAnimatorMac::horizontalScrollbarLayerDidChange):
1790         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
1791         (WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
1792         (WebCore::ScrollAnimatorMac::cancelAnimations):
1793         (WebCore::ScrollAnimatorMac::updateScrollerStyle):
1794         (WebCore::ScrollAnimatorMac::initialScrollbarPaintTimerFired):
1795         (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]): Deleted.
1796         (-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]): Deleted.
1797         (-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]): Deleted.
1798         (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]): Deleted.
1799         (-[WebScrollbarPainterDelegate scrollerImp:animateExpansionTransitionWithDuration:]): Deleted.
1800         * platform/mac/ScrollbarThemeMac.h:
1801         * platform/mac/ScrollbarThemeMac.mm:
1802         (WebCore::scrollbarMap):
1803         (+[WebScrollbarPrefsObserver appearancePrefsChanged:]):
1804         (WebCore::ScrollbarThemeMac::registerScrollbar):
1805         (WebCore::ScrollbarThemeMac::setNewPainterForScrollbar):
1806         (WebCore::ScrollbarThemeMac::painterForScrollbar):
1807         (WebCore::ScrollbarThemeMac::scrollbarThickness):
1808         (WebCore::ScrollbarThemeMac::updateScrollbarOverlayStyle):
1809         (WebCore::ScrollbarThemeMac::hasThumb):
1810         (WebCore::ScrollbarThemeMac::setPaintCharacteristicsForScrollbar):
1811         (WebCore::scrollbarPainterPaint):
1812
1813 2016-03-12  Dean Jackson  <dino@apple.com>
1814
1815         REGRESSION (r188647): Teamtreehouse website sidebar buttons are not rendered
1816         https://bugs.webkit.org/show_bug.cgi?id=155400
1817         <rdar://problem/24818602>
1818
1819         Reviewed by Anders Carlsson.
1820
1821         When we unprefixed CSS filters we accidentally
1822         stopped SVG elements that use the CSS filter shorthands
1823         from rendering. We still don't actually support
1824         the shorthands in this case, but we should render
1825         the element without the filter.
1826
1827         Tests: css3/filters/filters-on-svg-element.html
1828                css3/filters/filters-on-svg-root.html
1829
1830         * rendering/style/RenderStyle.cpp:
1831         (WebCore::RenderStyle::hasReferenceFilterOnly): Add
1832         this new function that tells us if we have the
1833         style of filter that we can handle in SVG content.
1834         * rendering/style/RenderStyle.h:
1835         * rendering/svg/SVGRenderingContext.cpp:
1836         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
1837         We can mark an element as ready to render if it
1838         has a shorthand filter.
1839
1840 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
1841
1842         Delete dead SVG Font code
1843         https://bugs.webkit.org/show_bug.cgi?id=154718
1844
1845         Reviewed by Antti Koivisto.
1846
1847         All the ports have adopted the SVG -> OTF Font Converter, so there will never
1848         be an instantiation of a font backed by a DOM subtree. We can remove all the
1849         infrastructure used to support that.
1850
1851         No new tests because there is no behavior change.
1852
1853         * CMakeLists.txt:
1854         * Configurations/FeatureDefines.xcconfig:
1855         * WebCore.order:
1856         * WebCore.xcodeproj/project.pbxproj:
1857         * css/CSSFontFaceSource.cpp:
1858         (WebCore::CSSFontFaceSource::CSSFontFaceSource): Deleted.
1859         (WebCore::CSSFontFaceSource::font): Deleted.
1860         * css/CSSFontFaceSource.h:
1861         * loader/cache/CachedFont.cpp:
1862         * loader/cache/CachedSVGFont.cpp:
1863         (WebCore::CachedSVGFont::createFont): Deleted.
1864         (WebCore::CachedSVGFont::ensureCustomFontData): Deleted.
1865         * loader/cache/CachedSVGFont.h:
1866         * platform/graphics/Font.cpp:
1867         (WebCore::Font::Font):
1868         (WebCore::fillGlyphPage):
1869         (WebCore::Font::description): Deleted.
1870         (WebCore::Font::createScaledFont): Deleted.
1871         (WebCore::Font::applyTransforms): Deleted.
1872         * platform/graphics/Font.h:
1873         (WebCore::Font::widthForGlyph):
1874         (WebCore::Font::SVGData::~SVGData): Deleted.
1875         (WebCore::Font::create): Deleted.
1876         (WebCore::Font::svgData): Deleted.
1877         (WebCore::Font::isSVGFont): Deleted.
1878         * platform/graphics/win/FontWin.cpp:
1879         * platform/graphics/FontCascade.cpp:
1880         (WebCore::FontCascade::drawText):
1881         (WebCore::FontCascade::drawEmphasisMarks):
1882         (WebCore::FontCascade::glyphDataForCharacter):
1883         (WebCore::FontCascade::adjustSelectionRectForText):
1884         (WebCore::FontCascade::offsetForPosition):
1885         (WebCore::FontCascade::drawEmphasisMarksForSimpleText):
1886         (WebCore::FontCascade::drawGlyphBuffer):
1887         (WebCore::isDrawnWithSVGFont): Deleted.
1888         (WebCore::FontCascade::width): Deleted.
1889         (WebCore::FontCascade::codePath): Deleted.
1890         * platform/graphics/FontCascade.h:
1891         * platform/graphics/GraphicsContext.h:
1892         * platform/graphics/SVGGlyph.cpp: Removed.
1893         (WebCore::processArabicFormDetection): Deleted.
1894         (WebCore::charactersWithArabicForm): Deleted.
1895         (WebCore::isCompatibleArabicForm): Deleted.
1896         (WebCore::isCompatibleGlyph): Deleted.
1897         * platform/graphics/SVGGlyph.h: Removed.
1898         (WebCore::SVGGlyph::SVGGlyph): Deleted.
1899         (WebCore::SVGGlyph::inheritedValue): Deleted.
1900         (WebCore::SVGGlyph::operator==): Deleted.
1901         * platform/graphics/TextRun.cpp:
1902         * platform/graphics/TextRun.h:
1903         (WebCore::TextRun::RenderingContext::~RenderingContext): Deleted.
1904         (WebCore::TextRun::renderingContext): Deleted.
1905         (WebCore::TextRun::setRenderingContext): Deleted.
1906         * platform/graphics/WidthIterator.cpp:
1907         (WebCore::WidthIterator::applyFontTransforms):
1908         (WebCore::WidthIterator::advanceInternal):
1909         (WebCore::WidthIterator::glyphDataForCharacter): Deleted.
1910         * platform/graphics/WidthIterator.h:
1911         (WebCore::WidthIterator::lastGlyphName): Deleted.
1912         (WebCore::WidthIterator::setLastGlyphName): Deleted.
1913         (WebCore::WidthIterator::arabicForms): Deleted.
1914         * platform/graphics/cairo/FontCairo.cpp:
1915         (WebCore::CairoGlyphToPathTranslator::advance):
1916         (WebCore::FontCascade::dashesForIntersectionsWithRect):
1917         (WebCore::CairoGlyphToPathTranslator::moveToNextValidGlyph): Deleted.
1918         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1919         (WebCore::MacGlyphToPathTranslator::advance):
1920         (WebCore::FontCascade::dashesForIntersectionsWithRect):
1921         (WebCore::FontCascade::primaryFontIsSystemFont):
1922         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
1923         (WebCore::MacGlyphToPathTranslator::moveToNextValidGlyph): Deleted.
1924         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1925         (WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): Deleted.
1926         * platform/graphics/mac/ComplexTextController.cpp:
1927         (WebCore::TextLayout::isNeeded):
1928         (WebCore::TextLayout::TextLayout):
1929         (WebCore::TextLayout::constructTextRun):
1930         * rendering/EllipsisBox.cpp:
1931         (WebCore::EllipsisBox::paint):
1932         (WebCore::EllipsisBox::selectionRect):
1933         (WebCore::EllipsisBox::paintSelection):
1934         * rendering/InlineTextBox.cpp:
1935         (WebCore::InlineTextBox::localSelectionRect):
1936         (WebCore::InlineTextBox::paint):
1937         (WebCore::InlineTextBox::paintSelection):
1938         (WebCore::InlineTextBox::paintCompositionBackground):
1939         (WebCore::InlineTextBox::paintDocumentMarker):
1940         (WebCore::InlineTextBox::paintTextMatchMarker):
1941         (WebCore::InlineTextBox::offsetForPosition):
1942         (WebCore::InlineTextBox::positionForOffset):
1943         (WebCore::InlineTextBox::constructTextRun):
1944         * rendering/InlineTextBox.h:
1945         * rendering/RenderBlock.cpp:
1946         (WebCore::RenderBlock::constructTextRun):
1947         * rendering/RenderBlock.h:
1948         * rendering/RenderBlockFlow.cpp:
1949         (WebCore::stripTrailingSpace):
1950         * rendering/RenderBlockLineLayout.cpp:
1951         (WebCore::RenderBlockFlow::checkLinesForTextOverflow):
1952         * rendering/RenderDeprecatedFlexibleBox.cpp:
1953         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
1954         * rendering/RenderFileUploadControl.cpp:
1955         (WebCore::RenderFileUploadControl::paintObject):
1956         (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths):
1957         * rendering/RenderImage.cpp:
1958         (WebCore::RenderImage::setImageSizeForAltText):
1959         (WebCore::RenderImage::paintReplaced):
1960         * rendering/RenderListBox.cpp:
1961         (WebCore::RenderListBox::updateFromElement):
1962         * rendering/RenderListMarker.cpp:
1963         (WebCore::RenderListMarker::paint):
1964         (WebCore::RenderListMarker::computePreferredLogicalWidths):
1965         (WebCore::RenderListMarker::getRelativeMarkerRect):
1966         * rendering/RenderMenuList.cpp:
1967         (RenderMenuList::updateOptionsWidth):
1968         * rendering/RenderText.cpp:
1969         (WebCore::RenderText::widthFromCache):
1970         (WebCore::RenderText::trimmedPrefWidths):
1971         (WebCore::hyphenWidth):
1972         (WebCore::maxWordFragmentWidth):
1973         (WebCore::RenderText::computePreferredLogicalWidths):
1974         (WebCore::RenderText::width):
1975         * rendering/RenderTextControl.cpp:
1976         (WebCore::RenderTextControl::getAverageCharWidth):
1977         * rendering/RenderThemeIOS.mm:
1978         (WebCore::RenderThemeMeasureTextClient::RenderThemeMeasureTextClient):
1979         (WebCore::adjustInputElementButtonStyle):
1980         * rendering/SimpleLineLayout.cpp:
1981         (WebCore::SimpleLineLayout::canUseForFontAndText): Deleted.
1982         * rendering/line/BreakingContext.h:
1983         (WebCore::WordTrailingSpace::WordTrailingSpace):
1984         (WebCore::WordTrailingSpace::width):
1985         (WebCore::measureHyphenWidth):
1986         (WebCore::textWidth):
1987         (WebCore::tryHyphenating):
1988         (WebCore::BreakingContext::handleText):
1989         * rendering/svg/RenderSVGAllInOne.cpp:
1990         * rendering/svg/RenderSVGText.cpp:
1991         * rendering/svg/SVGInlineTextBox.cpp:
1992         (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting):
1993         (WebCore::SVGInlineTextBox::restoreGraphicsContextAfterTextPainting):
1994         (WebCore::SVGInlineTextBox::paintTextWithShadows):
1995         (WebCore::SVGInlineTextBox::constructTextRun): Deleted.
1996         * rendering/svg/SVGInlineTextBox.h:
1997         * rendering/svg/SVGTextLayoutEngine.cpp:
1998         (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
1999         * rendering/svg/SVGTextLayoutEngineSpacing.cpp:
2000         (WebCore::SVGTextLayoutEngineSpacing::calculateSVGKerning): Deleted.
2001         * rendering/svg/SVGTextLayoutEngineSpacing.h:
2002         * rendering/svg/SVGTextMetrics.cpp:
2003         (WebCore::SVGTextMetrics::SVGTextMetrics):
2004         (WebCore::SVGTextMetrics::constructTextRun): Deleted.
2005         * rendering/svg/SVGTextMetrics.h:
2006         * rendering/svg/SVGTextMetricsBuilder.cpp:
2007         (WebCore::SVGTextMetricsBuilder::advanceSimpleText):
2008         * rendering/svg/SVGTextRunRenderingContext.cpp: Removed.
2009         (WebCore::svgFontAndFontFaceElementForFontData): Deleted.
2010         (WebCore::SVGTextRunRenderingContext::floatWidthUsingSVGFont): Deleted.
2011         (WebCore::SVGTextRunRenderingContext::applySVGKerning): Deleted.
2012         (WebCore::SVGGlyphToPathTranslator::SVGGlyphToPathTranslator): Deleted.
2013         (WebCore::SVGGlyphToPathTranslator::transform): Deleted.
2014         (WebCore::SVGGlyphToPathTranslator::path): Deleted.
2015         (WebCore::SVGGlyphToPathTranslator::extents): Deleted.
2016         (WebCore::SVGGlyphToPathTranslator::moveToNextValidGlyph): Deleted.
2017         (WebCore::SVGGlyphToPathTranslator::advance): Deleted.
2018         (WebCore::SVGTextRunRenderingContext::createGlyphToPathTranslator): Deleted.
2019         (WebCore::SVGTextRunRenderingContext::drawSVGGlyphs): Deleted.
2020         (WebCore::missingGlyphForFont): Deleted.
2021         (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter): Deleted.
2022         * rendering/svg/SVGTextRunRenderingContext.h: Removed.
2023         * svg/SVGAllInOne.cpp:
2024         * svg/SVGFontData.cpp: Removed.
2025         (WebCore::SVGFontData::SVGFontData): Deleted.
2026         (WebCore::SVGFontData::initializeFont): Deleted.
2027         (WebCore::SVGFontData::widthForSVGGlyph): Deleted.
2028         (WebCore::SVGFontData::applySVGGlyphSelection): Deleted.
2029         (WebCore::SVGFontData::fillSVGGlyphPage): Deleted.
2030         (WebCore::SVGFontData::fillBMPGlyphs): Deleted.
2031         (WebCore::SVGFontData::fillNonBMPGlyphs): Deleted.
2032         (WebCore::computeNormalizedSpaces): Deleted.
2033         (WebCore::createStringWithMirroredCharacters): Deleted.
2034         * svg/SVGFontData.h: Removed.
2035         (WebCore::SVGFontData::~SVGFontData): Deleted.
2036         (WebCore::SVGFontData::svgFontFaceElement): Deleted.
2037         (WebCore::SVGFontData::horizontalOriginX): Deleted.
2038         (WebCore::SVGFontData::horizontalOriginY): Deleted.
2039         (WebCore::SVGFontData::horizontalAdvanceX): Deleted.
2040         (WebCore::SVGFontData::verticalOriginX): Deleted.
2041         (WebCore::SVGFontData::verticalOriginY): Deleted.
2042         (WebCore::SVGFontData::verticalAdvanceY): Deleted.
2043         * svg/SVGFontElement.cpp:
2044         (WebCore::SVGFontElement::SVGFontElement): Deleted.
2045         (WebCore::SVGFontElement::invalidateGlyphCache): Deleted.
2046         (WebCore::SVGFontElement::firstMissingGlyphElement): Deleted.
2047         (WebCore::SVGFontElement::registerLigaturesInGlyphCache): Deleted.
2048         (WebCore::SVGFontElement::ensureGlyphCache): Deleted.
2049         (WebCore::SVGKerningMap::clear): Deleted.
2050         (WebCore::SVGKerningMap::insert): Deleted.
2051         (WebCore::stringMatchesUnicodeRange): Deleted.
2052         (WebCore::stringMatchesGlyphName): Deleted.
2053         (WebCore::stringMatchesUnicodeName): Deleted.
2054         (WebCore::matches): Deleted.
2055         (WebCore::kerningForPairOfStringsAndGlyphs): Deleted.
2056         (WebCore::SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs): Deleted.
2057         (WebCore::SVGFontElement::verticalKerningForPairOfStringsAndGlyphs): Deleted.
2058         (WebCore::SVGFontElement::collectGlyphsForString): Deleted.
2059         (WebCore::SVGFontElement::collectGlyphsForGlyphName): Deleted.
2060         (WebCore::SVGFontElement::svgGlyphForGlyph): Deleted.
2061         (WebCore::SVGFontElement::missingGlyph): Deleted.
2062         * svg/SVGFontElement.h:
2063         (WebCore::SVGKerning::SVGKerning): Deleted.
2064         (WebCore::SVGKerningMap::isEmpty): Deleted.
2065         * svg/SVGGlyphElement.cpp:
2066         (WebCore::SVGGlyphElement::invalidateGlyphCache): Deleted.
2067         (WebCore::SVGGlyphElement::parseAttribute): Deleted.
2068         (WebCore::SVGGlyphElement::insertedInto): Deleted.
2069         (WebCore::SVGGlyphElement::removedFrom): Deleted.
2070         (WebCore::parseArabicForm): Deleted.
2071         (WebCore::parseOrientation): Deleted.
2072         (WebCore::SVGGlyphElement::inheritUnspecifiedAttributes): Deleted.
2073         (WebCore::parseSVGGlyphAttribute): Deleted.
2074         (WebCore::SVGGlyphElement::buildGenericGlyphIdentifier): Deleted.
2075         (WebCore::SVGGlyphElement::buildGlyphIdentifier): Deleted.
2076         * svg/SVGGlyphElement.h:
2077         * svg/SVGGlyphMap.h: Removed.
2078         (WebCore::GlyphMapNode::GlyphMapNode): Deleted.
2079         (WebCore::GlyphMapNode::create): Deleted.
2080         (WebCore::SVGGlyphMap::SVGGlyphMap): Deleted.
2081         (WebCore::SVGGlyphMap::addGlyph): Deleted.
2082         (WebCore::SVGGlyphMap::appendToGlyphTable): Deleted.
2083         (WebCore::SVGGlyphMap::compareGlyphPriority): Deleted.
2084         (WebCore::SVGGlyphMap::collectGlyphsForString): Deleted.
2085         (WebCore::SVGGlyphMap::clear): Deleted.
2086         (WebCore::SVGGlyphMap::svgGlyphForGlyph): Deleted.
2087         (WebCore::SVGGlyphMap::glyphIdentifierForGlyphName): Deleted.
2088         * svg/SVGHKernElement.cpp:
2089         (WebCore::SVGHKernElement::insertedInto): Deleted.
2090         (WebCore::SVGHKernElement::removedFrom): Deleted.
2091         * svg/SVGHKernElement.h:
2092         * svg/SVGToOTFFontConversion.cpp:
2093         * svg/SVGToOTFFontConversion.h:
2094         * svg/SVGVKernElement.cpp:
2095         (WebCore::SVGVKernElement::insertedInto): Deleted.
2096         (WebCore::SVGVKernElement::removedFrom): Deleted.
2097         * svg/SVGVKernElement.h:
2098
2099 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
2100
2101         [OS X] Scrollbars of overflow:scroll divs should appear on the left on RTL systems
2102         https://bugs.webkit.org/show_bug.cgi?id=155385
2103
2104         Reviewed by Simon Fraser.
2105
2106         There is already some existing setup for RTL scrollbars. This patch hooks up this
2107         existing support to the OS X triggering mechanism introduced in r197956. It also
2108         fixes up the existing support to function even when the direction of the
2109         RTL-scrollbar div is LTR (this means the contents of the div must be pushed
2110         over by the width of the scrollbar).
2111
2112         Tests: fast/scrolling/rtl-scrollbars-overflow-contents.html
2113                fast/scrolling/rtl-scrollbars-overflow-dir-rtl.html
2114                fast/scrolling/rtl-scrollbars-overflow-padding.html
2115                fast/scrolling/rtl-scrollbars-overflow-simple.html
2116                fast/scrolling/rtl-scrollbars-overflow.html
2117
2118         * rendering/RenderBlock.cpp:
2119         (WebCore::RenderBlock::addOverflowFromPositionedObjects):
2120         (WebCore::RenderBlock::logicalLeftOffsetForContent):
2121         (WebCore::RenderBlock::logicalRightOffsetForContent):
2122         * rendering/RenderBlockFlow.cpp:
2123         (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
2124         * rendering/RenderBox.cpp:
2125         (WebCore::RenderBox::overflowClipRect):
2126         (WebCore::RenderBox::layoutOverflowRectForPropagation):
2127         * rendering/RenderLayer.cpp:
2128         (WebCore::RenderLayer::computeScrollDimensions):
2129         * rendering/style/RenderStyle.cpp:
2130         (WebCore::RenderStyle::shouldPlaceBlockDirectionScrollbarOnLogicalLeft):
2131         * rendering/style/RenderStyle.h:
2132
2133 2016-03-12  Zalan Bujtas  <zalan@apple.com>
2134
2135         [Forms: focus] focus rings around text fields do not follow contour (border-radius)
2136         https://bugs.webkit.org/show_bug.cgi?id=154099
2137         rdar://problem/9988429
2138
2139         Reviewed by Tim Horton.
2140
2141         This patch enables outline-style: auto to follow the curve of border-radius.
2142         When both border-radius and outline-style: auto are set, the native focusring painting will take the border-radius values
2143         into account. This is only for outline-style: auto, other non-auto outline styles paint as if there
2144         was no border-radius set.
2145         It supports both single and multiline content with joint rectangles.
2146         However in case of disjoint rectangles, we fallback to the non-radius drawing.
2147
2148         Tests: fast/inline/hidpi-outline-auto-with-border-radius-horizontal-ltr.html
2149                fast/inline/hidpi-outline-auto-with-border-radius-horizontal-rtl.html
2150                fast/inline/hidpi-outline-auto-with-border-radius-vertical-ltr.html
2151                fast/inline/hidpi-outline-auto-with-border-radius-vertical-rtl.html
2152
2153         * platform/graphics/GraphicsContext.h:
2154         * platform/graphics/Path.cpp:
2155         (WebCore::Path::addBeziersForRoundedRect):
2156         * platform/graphics/Path.h:
2157         (WebCore::Path::circleControlPoint):
2158         * platform/graphics/PathUtilities.cpp:
2159         (WebCore::polygonsForRect):
2160         (WebCore::PathUtilities::pathsWithShrinkWrappedRects):
2161         (WebCore::startAndEndPointsForCorner):
2162         (WebCore::cornerType):
2163         (WebCore::controlPointsForBezierCurve):
2164         (WebCore::adjustedtRadiiForHuggingCurve):
2165         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
2166         * platform/graphics/PathUtilities.h:
2167         * platform/graphics/mac/GraphicsContextMac.mm:
2168         (WebCore::GraphicsContext::drawFocusRing):
2169         * rendering/RenderElement.cpp:
2170         (WebCore::RenderElement::paintFocusRing):
2171
2172 2016-03-11  Ryosuke Niwa  <rniwa@webkit.org>
2173
2174         Add Event.deepPath() and Event.scoped
2175         https://bugs.webkit.org/show_bug.cgi?id=153538
2176         <rdar://problem/24363836>
2177
2178         Reviewed by Darin Adler.
2179
2180         Added the support for deepPath(), scoped, and relatedTargetScoped on Event.prototype for shadow DOM:
2181         http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event-interface
2182         and updated the EventPath class to respect scoped and relatedTargetScoped flags as specified at:
2183         http://w3c.github.io/webcomponents/spec/shadow/#get-the-parent
2184
2185         Tests: fast/shadow-dom/Extensions-to-Event-Interface.html
2186                fast/shadow-dom/trusted-event-scoped-flags.html
2187
2188         * bindings/scripts/CodeGeneratorJS.pm:
2189         (GenerateConstructorDefinition): Added the support for Conditional for InitializedByEventConstructor.
2190         * bindings/scripts/test/GObject/WebKitDOMTestEventConstructor.cpp:
2191         * bindings/scripts/test/GObject/WebKitDOMTestEventConstructor.h:
2192         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2193         * bindings/scripts/test/ObjC/DOMTestEventConstructor.h:
2194         * bindings/scripts/test/ObjC/DOMTestEventConstructor.mm:
2195         * bindings/scripts/test/TestEventConstructor.idl: Added a test case for using InitializedByEventConstructor
2196         with Conditional.
2197         * dom/Event.cpp:
2198         (WebCore::Event::Event): Initialize m_scoped and m_relatedTargetScoped from EventInit dictionary.
2199         (WebCore::Event::scoped): Added. Implements http://w3c.github.io/webcomponents/spec/shadow/#scoped-flag
2200         (WebCore::Event::deepPath): Added.
2201         * dom/Event.h:
2202         (WebCore::Event::relatedTargetScoped): Added. Overridden by FocusEvent and MouseEvent to implement
2203         http://w3c.github.io/webcomponents/spec/shadow/#relatedtargetscoped-flag
2204         (WebCore::Event::setEventPath): Added.
2205         (WebCore::Event::clearEventPath): Added.
2206         * dom/Event.idl: Added scoped, relatedTargetScoped, and deepPath() conditionally enabled for shadow DOM.
2207         * dom/EventContext.h:
2208         (WebCore::EventContext::currentTarget):
2209         * dom/EventDispatcher.cpp:
2210         (WebCore::EventDispatcher::dispatchEvent): Set the event path while the event is being dispatched.
2211         * dom/EventPath.cpp:
2212         (WebCore::shouldEventCrossShadowBoundary): Check event.scoped flag instead of hard-coding a list of events here
2213         which has been moved to Event::scoped. See above.
2214         (WebCore::EventPath::setRelatedTarget): Check m_event.relatedTargetScoped() instead of hard-coding a list of
2215         events here. relatedTargetScoped is overridden by FocusEvent and MouseEvent.
2216         (WebCore::EventPath::hasEventListeners): Fixed the misleading variable name.
2217         (WebCore::isUnclosedNodeOf): Added. Implements http://w3c.github.io/webcomponents/spec/shadow/#dfn-unclosed-node
2218         (WebCore::EventPath::computePathDisclosedToTarget): Added. Implements the algorithm to filter event targets:
2219         http://w3c.github.io/webcomponents/spec/shadow/#widl-Event-deepPath-sequence-EventTarget
2220         * dom/EventPath.h:
2221         * dom/FocusEvent.cpp:
2222         (WebCore::FocusEvent::relatedTargetScoped): Returns true when this is a trusted event per:
2223         http://w3c.github.io/webcomponents/spec/shadow/#relatedtargetscoped-flag
2224         * dom/FocusEvent.h:
2225         * dom/MouseEvent.cpp:
2226         (WebCore::MouseEvent::relatedTargetScoped): Ditto.
2227         * dom/MouseEvent.h:
2228
2229 2016-03-11  John Wilander  <wilander@apple.com>
2230
2231         Move prevalent resource classifier from WebCore to WebKit.
2232         https://bugs.webkit.org/show_bug.cgi?id=155242
2233         <rdar://problem/24913272>
2234
2235         Reviewed by Andy Estes.
2236
2237         No new tests since we have yet to decide how to set up tests for prevalent resources.
2238
2239         * loader/ResourceLoadObserver.cpp:
2240         (WebCore::ResourceLoadObserver::logFrameNavigation):
2241         (WebCore::ResourceLoadObserver::logSubresourceLoading):
2242             - Removed calls to old classifier in WebCore.
2243         * loader/ResourceLoadStatistics.cpp:
2244         (WebCore::encodeHashCountedSet):
2245         (WebCore::ResourceLoadStatistics::checkAndSetAsPrevalentResourceIfNecessary): Deleted.
2246         (WebCore::ResourceLoadStatistics::hasPrevalentResourceCharacteristics): Deleted.
2247         * loader/ResourceLoadStatistics.h:
2248             - Deleted old classification functions.
2249         * loader/ResourceLoadStatisticsStore.cpp:
2250         (WebCore::ResourceLoadStatisticsStore::create):
2251         (WebCore::ResourceLoadStatisticsStore::fireDataModificationHandler):
2252         (WebCore::ResourceLoadStatisticsStore::hasEnoughDataForStatisticsProcessing):
2253             - New function to allow for checks before calls to processStatistics.
2254         (WebCore::ResourceLoadStatisticsStore::processStatistics):
2255             - New function that receives a lamda and executes it on every entry in its statistics map.
2256         * loader/ResourceLoadStatisticsStore.h:
2257
2258 2016-03-11  Jiewen Tan  <jiewen_tan@apple.com>
2259
2260         WebKit should not be redirected to an invalid URL
2261         https://bugs.webkit.org/show_bug.cgi?id=155263
2262         <rdar://problem/22820172>
2263
2264         Reviewed by Brent Fulgham.
2265
2266         Test: http/tests/navigation/redirect-to-invalid-url.html
2267
2268         * loader/SubresourceLoader.cpp:
2269         (WebCore::SubresourceLoader::willSendRequestInternal):
2270
2271 2016-03-10  Maksim Kisilev <mkisilev@yandex-team.ru>
2272
2273         Fix typo in StyleTreeResolver.cpp
2274         https://bugs.webkit.org/show_bug.cgi?id=139946
2275
2276         Reviewed by Andy Estes.
2277
2278         The constructor for CheckForVisibilityChangeOnRecalcStyle was improperly comparing the
2279         result of WKContentChange() (which is not a function) to WKContentVisibilityChange. I
2280         believe the above cast would implicitly resolve to WKContentNoChange in all cases,
2281         whether a visibility change had been observed or not.
2282         
2283         This patch corrects this problem. I would expect that this might affect some content
2284         visibility change behavior, but I'm not sure what the appropriate test case would be
2285         since this was apparently found through code inspection.
2286
2287         * style/StyleTreeResolver.cpp:
2288         (WebCore::Style::CheckForVisibilityChangeOnRecalcStyle::CheckForVisibilityChangeOnRecalcStyle):
2289
2290 2016-03-11  Chris Dumez  <cdumez@apple.com>
2291
2292         iOS-sim debug: WebCoreNSURLSessionTest.BasicOperation and WebCoreNSURLSessionTest.InvalidateEmpty asserting
2293         https://bugs.webkit.org/show_bug.cgi?id=155256
2294
2295         Reviewed by Alexey Proskuryakov.
2296
2297         r197628 consolidated the runtime application checking code for iOS and
2298         Mac. However, while the new code works fine for WebKit2, it is unsafe
2299         on WebKit1 / iOS and hits assertion in debug. The reason is that
2300         applicationBundleIdentifier() for getting called from several threads
2301         (WebThread, UIThread).
2302
2303         To address the problem, this patch renames applicationBundleIdentifier()
2304         to applicationBundleIdentifierOverride() and only initializes the
2305         override upon WebProcess and Network process initialization. We therefore
2306         do not initialize the override in WebKit1 or in the WebKit2 UIProcess.
2307         When the override is not set, we fall back to using the main bundle
2308         identifier (which does the right thing for WebKit1 / WebKit2 UIProcess)
2309         but without caching it to avoid thread safety issues.
2310
2311         No new tests, already covered by API tests currently crashing.
2312
2313         * platform/RuntimeApplicationChecks.mm:
2314         (WebCore::applicationBundleIdentifierOverride):
2315         - Renamed applicationBundleIdentifier() to applicationBundleIdentifierOverride()
2316           and only initialize upon initialization of the WebProcess or the Network
2317           process.
2318         - In debug, set a flag to indicate that the override was already queried.
2319
2320         (WebCore::applicationBundleIdentifier):
2321         New utility function that is returns the application bundle override if it is
2322         set and fallback to calling [[NSBundle mainBundle] bundleIdentifier] otherwise.
2323
2324         (WebCore::setApplicationBundleIdentifier):
2325         Add assertions to make sure that:
2326         1. This is always called from the main thread.
2327         2. The application bundle identifier has not been queried *before* getting
2328            overriden as this would indicate a bug in our code and we would have wrongly
2329            returned the main bundle identifier in such case.
2330
2331         (WebCore::MacApplication::isAppleMail):
2332         (WebCore::MacApplication::isIBooks):
2333         (WebCore::MacApplication::isITunes):
2334         (WebCore::MacApplication::isMicrosoftMessenger):
2335         (WebCore::MacApplication::isAdobeInstaller):
2336         (WebCore::MacApplication::isMicrosoftOutlook):
2337         (WebCore::MacApplication::isQuickenEssentials):
2338         (WebCore::MacApplication::isAperture):
2339         (WebCore::MacApplication::isVersions):
2340         (WebCore::MacApplication::isHRBlock):
2341         (WebCore::MacApplication::isHipChat):
2342         (WebCore::IOSApplication::isMobileSafari):
2343         (WebCore::IOSApplication::isDumpRenderTree):
2344         (WebCore::IOSApplication::isMobileStore):
2345         (WebCore::IOSApplication::isFacebook):
2346         (WebCore::IOSApplication::isDaijisenDictionary):
2347         (WebCore::IOSApplication::isNASAHD):
2348         (WebCore::IOSApplication::isTheEconomistOnIphone):
2349         (WebCore::IOSApplication::isWebProcess):
2350         (WebCore::IOSApplication::isIBooks):
2351         Drop assertions making sure the cached flag is correct. We now have
2352         an assertion to detect this earlier in setApplicationBundleIdentifier().
2353
2354 2016-03-10  Jer Noble  <jer.noble@apple.com>
2355
2356         Web Audio becomes distorted after sample rate changes
2357         https://bugs.webkit.org/show_bug.cgi?id=154538
2358         <rdar://problem/24771292>
2359
2360         Reviewed by Darin Adler.
2361
2362         When the underlying audio hardware sample rate changes, the AudioUnit render callback will begin asking
2363         for fewer or more frames. For example, when the sample rate goes from 44.1kHz to 48kHz, it will ask for
2364         118 samples instead of 128. (And vice-versa, 140 samples instead of 128.) But the Web Audio engine can only
2365         really handle requests in multiples of 128 samples. In the case where there are requests for < 128 samples,
2366         actually render 128, but save off the unrequested samples in a separate bus. Then fill that bus during the
2367         next request.
2368
2369         * platform/audio/AudioBus.cpp:
2370         (WebCore::AudioBus::copyFromRange): Added utility method.
2371         * platform/audio/AudioBus.h:
2372         * platform/audio/ios/AudioDestinationIOS.cpp:
2373         (WebCore::AudioDestinationIOS::AudioDestinationIOS): Create a "spare" bus.
2374         (WebCore::assignAudioBuffersToBus): Moved from inside render.
2375         (WebCore::AudioDestinationIOS::render): Save off extra samples to the "spare" bus.
2376         * platform/audio/ios/AudioDestinationIOS.h:
2377
2378 2016-03-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2379
2380         Unreviewed build fix after r198023.
2381         https://bugs.webkit.org/show_bug.cgi?id=155024
2382
2383         Reviewed by Geoffrey Garen.
2384
2385         Update binding test results.
2386
2387         * bindings/scripts/test/JS/JSTestObj.cpp:
2388         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
2389         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
2390         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
2391         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
2392         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
2393
2394 2016-03-11  Ryan Haddad  <ryanhaddad@apple.com>
2395
2396         Unreviewed, rolling out r197984.
2397
2398         This change caused an existing LayoutTest to fail
2399
2400         Reverted changeset:
2401
2402         "WebKit should not be redirected to an invalid URL"
2403         https://bugs.webkit.org/show_bug.cgi?id=155263
2404         http://trac.webkit.org/changeset/197984
2405
2406 2016-03-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2407
2408         [ES6] Implement Reflect.set without receiver support
2409         https://bugs.webkit.org/show_bug.cgi?id=155024
2410
2411         Reviewed by Geoffrey Garen.
2412
2413         CustomSetter returns boolean value that indicates the result of [[Set]].
2414         According to this change, this patch modifies the CodeGeneratorJS and test results.
2415
2416         Currently, DOM elements' [[Set]] return true when the setter is found.
2417         This is good for the first step.
2418
2419         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
2420         (WebCore::JSCSSStyleDeclaration::putDelegate):
2421         * bindings/js/JSDOMBinding.cpp:
2422         (WebCore::throwSetterTypeError):
2423         * bindings/js/JSDOMBinding.h:
2424         * bindings/js/JSDOMStringMapCustom.cpp:
2425         (WebCore::JSDOMStringMap::putDelegate):
2426         * bindings/js/JSDOMWindowBase.cpp:
2427         (WebCore::JSDOMWindowBase::updateDocument):
2428         * bindings/js/JSDOMWindowCustom.cpp:
2429         (WebCore::JSDOMWindow::put):
2430         (WebCore::JSDOMWindow::putByIndex):
2431         * bindings/js/JSHTMLAppletElementCustom.cpp:
2432         (WebCore::JSHTMLAppletElement::putDelegate):
2433         * bindings/js/JSHTMLEmbedElementCustom.cpp:
2434         (WebCore::JSHTMLEmbedElement::putDelegate):
2435         * bindings/js/JSHTMLObjectElementCustom.cpp:
2436         (WebCore::JSHTMLObjectElement::putDelegate):
2437         * bindings/js/JSLocationCustom.cpp:
2438         (WebCore::JSLocation::putDelegate):
2439         (WebCore::JSLocationPrototype::putDelegate):
2440         * bindings/js/JSPluginElementFunctions.cpp:
2441         (WebCore::pluginElementCustomPut):
2442         * bindings/js/JSPluginElementFunctions.h:
2443         * bindings/js/JSStorageCustom.cpp:
2444         (WebCore::JSStorage::putDelegate):
2445         * bindings/scripts/CodeGeneratorJS.pm:
2446         (GenerateHeader):
2447         (GenerateImplementation):
2448         (GeneratePrototypeDeclaration):
2449         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2450         (WebCore::setJSTestActiveDOMObjectConstructor):
2451         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2452         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
2453         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2454         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
2455         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2456         (WebCore::setJSTestCustomNamedGetterConstructor):
2457         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2458         (WebCore::setJSTestEventConstructorConstructor):
2459         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2460         (WebCore::setJSTestEventTargetConstructor):
2461         * bindings/scripts/test/JS/JSTestException.cpp:
2462         (WebCore::setJSTestExceptionConstructor):
2463         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2464         (WebCore::setJSTestGenerateIsReachableConstructor):
2465         * bindings/scripts/test/JS/JSTestInterface.cpp:
2466         (WebCore::setJSTestInterfaceConstructor):
2467         (WebCore::JSTestInterface::put):
2468         (WebCore::JSTestInterface::putByIndex):
2469         (WebCore::setJSTestInterfaceConstructorImplementsStaticAttr):
2470         (WebCore::setJSTestInterfaceImplementsStr2):
2471         (WebCore::setJSTestInterfaceImplementsStr3):
2472         (WebCore::setJSTestInterfaceImplementsNode):
2473         (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
2474         (WebCore::setJSTestInterfaceSupplementalStr2):
2475         (WebCore::setJSTestInterfaceSupplementalStr3):
2476         (WebCore::setJSTestInterfaceSupplementalNode):
2477         * bindings/scripts/test/JS/JSTestInterface.h:
2478         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2479         (WebCore::setJSTestJSBuiltinConstructorConstructor):
2480         (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
2481         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2482         (WebCore::setJSTestMediaQueryListListenerConstructor):
2483         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2484         (WebCore::setJSTestNamedConstructorConstructor):
2485         * bindings/scripts/test/JS/JSTestNode.cpp:
2486         (WebCore::setJSTestNodeConstructor):
2487         (WebCore::setJSTestNodeName):
2488         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2489         (WebCore::setJSTestNondeterministicConstructor):
2490         (WebCore::setJSTestNondeterministicNondeterministicWriteableAttr):
2491         (WebCore::setJSTestNondeterministicNondeterministicExceptionAttr):
2492         (WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr):
2493         (WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr):
2494         * bindings/scripts/test/JS/JSTestObj.cpp:
2495         (WebCore::setJSTestObjConstructor):
2496         (WebCore::setJSTestObjConstructorStaticStringAttr):
2497         (WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
2498         (WebCore::setJSTestObjEnumAttr):
2499         (WebCore::setJSTestObjByteAttr):
2500         (WebCore::setJSTestObjOctetAttr):
2501         (WebCore::setJSTestObjShortAttr):
2502         (WebCore::setJSTestObjUnsignedShortAttr):
2503         (WebCore::setJSTestObjLongAttr):
2504         (WebCore::setJSTestObjLongLongAttr):
2505         (WebCore::setJSTestObjUnsignedLongLongAttr):
2506         (WebCore::setJSTestObjStringAttr):
2507         (WebCore::setJSTestObjTestObjAttr):
2508         (WebCore::setJSTestObjLenientTestObjAttr):
2509         (WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString):
2510         (WebCore::setJSTestObjXMLObjAttr):
2511         (WebCore::setJSTestObjCreate):
2512         (WebCore::setJSTestObjReflectedStringAttr):
2513         (WebCore::setJSTestObjReflectedIntegralAttr):
2514         (WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
2515         (WebCore::setJSTestObjReflectedBooleanAttr):
2516         (WebCore::setJSTestObjReflectedURLAttr):
2517         (WebCore::setJSTestObjReflectedCustomIntegralAttr):
2518         (WebCore::setJSTestObjReflectedCustomBooleanAttr):
2519         (WebCore::setJSTestObjReflectedCustomURLAttr):
2520         (WebCore::setJSTestObjTypedArrayAttr):
2521         (WebCore::setJSTestObjAttrWithGetterException):
2522         (WebCore::setJSTestObjAttrWithGetterExceptionWithMessage):
2523         (WebCore::setJSTestObjAttrWithSetterException):
2524         (WebCore::setJSTestObjAttrWithSetterExceptionWithMessage):
2525         (WebCore::setJSTestObjStringAttrWithGetterException):
2526         (WebCore::setJSTestObjStringAttrWithSetterException):
2527         (WebCore::setJSTestObjStrictTypeCheckingAttribute):
2528         (WebCore::setJSTestObjCustomAttr):
2529         (WebCore::setJSTestObjOnfoo):
2530         (WebCore::setJSTestObjWithScriptStateAttribute):
2531         (WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute):
2532         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
2533         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
2534         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
2535         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
2536         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
2537         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
2538         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
2539         (WebCore::setJSTestObjConditionalAttr1):
2540         (WebCore::setJSTestObjConditionalAttr2):
2541         (WebCore::setJSTestObjConditionalAttr3):
2542         (WebCore::setJSTestObjConditionalAttr4Constructor):
2543         (WebCore::setJSTestObjConditionalAttr5Constructor):
2544         (WebCore::setJSTestObjConditionalAttr6Constructor):
2545         (WebCore::setJSTestObjAnyAttribute):
2546         (WebCore::setJSTestObjMutablePoint):
2547         (WebCore::setJSTestObjImmutablePoint):
2548         (WebCore::setJSTestObjStrawberry):
2549         (WebCore::setJSTestObjStrictFloat):
2550         (WebCore::setJSTestObjId):
2551         (WebCore::setJSTestObjReplaceableAttribute):
2552         (WebCore::setJSTestObjNullableLongSettableAttribute):
2553         (WebCore::setJSTestObjNullableStringSettableAttribute):
2554         (WebCore::setJSTestObjNullableStringValue):
2555         (WebCore::setJSTestObjAttributeWithReservedEnumType):
2556         (WebCore::setJSTestObjPutForwardsAttribute):
2557         (WebCore::setJSTestObjPutForwardsNullableAttribute):
2558         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2559         (WebCore::setJSTestOverloadedConstructorsConstructor):
2560         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2561         (WebCore::setJSTestOverrideBuiltinsConstructor):
2562         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2563         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
2564         (WebCore::setJSTestSerializedScriptValueInterfaceValue):
2565         (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
2566         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2567         (WebCore::setJSTestTypedefsConstructor):
2568         (WebCore::setJSTestTypedefsUnsignedLongLongAttr):
2569         (WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
2570         (WebCore::setJSTestTypedefsAttrWithGetterException):
2571         (WebCore::setJSTestTypedefsAttrWithSetterException):
2572         (WebCore::setJSTestTypedefsStringAttrWithGetterException):
2573         (WebCore::setJSTestTypedefsStringAttrWithSetterException):
2574         * bindings/scripts/test/JS/JSattribute.cpp:
2575         (WebCore::setJSattributeConstructor):
2576         * bindings/scripts/test/JS/JSreadonly.cpp:
2577         (WebCore::setJSreadonlyConstructor):
2578         * bridge/c/c_runtime.cpp:
2579         (JSC::Bindings::CField::setValueToInstance):
2580         * bridge/c/c_runtime.h:
2581         * bridge/jsc/BridgeJSC.h:
2582         (JSC::Bindings::Instance::put):
2583         * bridge/objc/objc_runtime.h:
2584         * bridge/objc/objc_runtime.mm:
2585         (JSC::Bindings::ObjcField::setValueToInstance):
2586         (JSC::Bindings::ObjcArray::setValueAt):
2587         (JSC::Bindings::ObjcFallbackObjectImp::put):
2588         * bridge/runtime_array.cpp:
2589         (JSC::RuntimeArray::put):
2590         (JSC::RuntimeArray::putByIndex):
2591         * bridge/runtime_array.h:
2592         * bridge/runtime_object.cpp:
2593         (JSC::Bindings::RuntimeObject::put):
2594         * bridge/runtime_object.h:
2595
2596 2016-03-11  David Kilzer  <ddkilzer@apple.com>
2597
2598         REGRESSION (r197956): WebContent process crashes on launch due to unrecognized selector
2599         <http://webkit.org/b/155356>
2600
2601         Reviewed by Alexey Proskuryakov.
2602
2603         * platform/mac/ScrollableAreaMac.mm:
2604         (WebCore::ScrollableArea::systemLanguageIsRTL): Add
2605         -respondsToSelector: check.
2606
2607 2016-03-11  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2608
2609         WTF should have a similar function as equalLettersIgnoringASCIICase to match beginning of strings
2610         https://bugs.webkit.org/show_bug.cgi?id=153419
2611
2612         Reviewed by Darin Adler.
2613
2614         Covered by added unint tests.
2615
2616         * Modules/fetch/FetchHeaders.cpp:
2617         (WebCore::isForbiddenHeaderName): Using startsWithLettersIgnoringASCIICase.
2618
2619 2016-03-11  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2620
2621         [Fetch API] Use DeferredWrapper directly in FetchBody promise handling
2622         https://bugs.webkit.org/show_bug.cgi?id=155291
2623
2624         Reviewed by Darin Adler.
2625
2626         Moved from typed DOMPromise to DeferredWrapper as there can only be one promise resolved.
2627         Started preparing the handling of blobs translation to other resolved types.
2628
2629         Fixed the case of empty body, in which case promises should resolve with empty objects (strings, buffers...) and not null.
2630
2631         Added Consumer structure to handle asynchronous resolution/rejection of promises.
2632         Added preliminary API to resolve promises based on data stored as a Blob.
2633         FetchBodyOwner will be responsible to do/stop blob loading.
2634
2635         Tests: imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html
2636                imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html
2637
2638         * Modules/fetch/FetchBody.cpp:
2639         (WebCore::FetchBody::processIfEmptyOrDisturbed): Fixed empty body case.
2640         (WebCore::FetchBody::arrayBuffer):
2641         (WebCore::FetchBody::blob):
2642         (WebCore::FetchBody::json):
2643         (WebCore::FetchBody::text):
2644         (WebCore::FetchBody::consume):
2645         (WebCore::FetchBody::consumeText):
2646         (WebCore::FetchBody::loadingType):
2647         (WebCore::FetchBody::consumeBlob):
2648         (WebCore::FetchBody::resolveAsJSON):
2649         (WebCore::FetchBody::loadingFailed):
2650         (WebCore::FetchBody::loadedAsBlob):
2651         * Modules/fetch/FetchBody.h:
2652         (WebCore::FetchBody::formData):
2653         (WebCore::FetchBody::Consumer::Consumer):
2654         * Modules/fetch/FetchBody.idl:
2655         * Modules/fetch/FetchBodyOwner.h:
2656         (WebCore::FetchBodyOwner::arrayBuffer):
2657         (WebCore::FetchBodyOwner::blob):
2658         (WebCore::FetchBodyOwner::formData):
2659         (WebCore::FetchBodyOwner::json):
2660         (WebCore::FetchBodyOwner::text):
2661         (WebCore::FetchBodyOwner::loadBlob):
2662
2663 2016-03-11  Yoav Weiss  <yoav@yoav.ws>
2664
2665         Avoid applying link tags with an invalid media attribute
2666         https://bugs.webkit.org/show_bug.cgi?id=143262
2667
2668         Reviewed by Brent Fulgham.
2669
2670         In current HTML spec, unlike HTML4, the UA must not apply <link> based resources
2671         when the media attribute does not match:
2672         https://html.spec.whatwg.org/multipage/semantics.html#attr-link-media
2673
2674         An invalid media attribute parsing creates a non-empty MediaQuerySet
2675         containing a single query with no expressions and no media type.
2676         (and with its m_ignored flag off)
2677
2678         In order to ignore such MediaQueries, I added an extra check that makes sure
2679         that the queries handled by MediaQueryEvaluator::eval have either expressions
2680         or a media type, and if not, they are ignored.
2681
2682         Test: fast/dom/HTMLLinkElement/link-stylesheet-invalid-media.html
2683
2684         * css/MediaQueryEvaluator.cpp:
2685         (WebCore::MediaQueryEvaluator::eval):
2686
2687 2016-03-11  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2688
2689         [CallWith=ScriptExecutionContext] should pass ScriptExecutionContext to the implementation by reference
2690         https://bugs.webkit.org/show_bug.cgi?id=155297
2691
2692         Reviewed by Darin Adler.
2693
2694         Changing the binding generator to pass ScriptExecutionContext by reference.
2695         Updating DOM classes accordingly.
2696
2697         Covered by existing tests.
2698
2699         * Modules/encryptedmedia/MediaKeySession.cpp:
2700         (WebCore::MediaKeySession::create):
2701         (WebCore::MediaKeySession::MediaKeySession):
2702         * Modules/encryptedmedia/MediaKeySession.h:
2703         * Modules/encryptedmedia/MediaKeys.cpp:
2704         (WebCore::MediaKeys::createSession):
2705         * Modules/encryptedmedia/MediaKeys.h:
2706         * Modules/fetch/FetchRequest.cpp:
2707         (WebCore::FetchRequest::clone):
2708         * Modules/fetch/FetchRequest.h:
2709         * Modules/fetch/FetchResponse.cpp:
2710         (WebCore::FetchResponse::error):
2711         (WebCore::FetchResponse::redirect):
2712         (WebCore::FetchResponse::clone):
2713         * Modules/fetch/FetchResponse.h:
2714         * Modules/indexeddb/IDBCursor.h:
2715         (WebCore::IDBCursor::continueFunction):
2716         * Modules/indexeddb/IDBFactory.h:
2717         * Modules/indexeddb/IDBIndex.h:
2718         * Modules/indexeddb/IDBKeyRange.cpp:
2719         (WebCore::IDBKeyRange::lowerValue):
2720         (WebCore::IDBKeyRange::upperValue):
2721         (WebCore::IDBKeyRange::only):
2722         (WebCore::IDBKeyRange::lowerBound):
2723         (WebCore::IDBKeyRange::upperBound):
2724         (WebCore::IDBKeyRange::bound):
2725         * Modules/indexeddb/IDBKeyRange.h:
2726         (WebCore::IDBKeyRange::lowerBound):
2727         (WebCore::IDBKeyRange::upperBound):
2728         (WebCore::IDBKeyRange::bound):
2729         * Modules/indexeddb/IDBObjectStore.h:
2730         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2731         (WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
2732         * Modules/indexeddb/IDBOpenDBRequest.h:
2733         * Modules/indexeddb/IDBRequest.cpp:
2734         (WebCore::IDBRequest::IDBRequest):
2735         * Modules/indexeddb/IDBRequest.h:
2736         * Modules/indexeddb/client/IDBCursorImpl.cpp:
2737         (WebCore::IDBClient::IDBCursor::continueFunction):
2738         (WebCore::IDBClient::IDBCursor::deleteFunction):
2739         * Modules/indexeddb/client/IDBCursorImpl.h:
2740         * Modules/indexeddb/client/IDBFactoryImpl.cpp:
2741         (WebCore::IDBClient::shouldThrowSecurityException):
2742         (WebCore::IDBClient::IDBFactory::getDatabaseNames):
2743         (WebCore::IDBClient::IDBFactory::open):
2744         (WebCore::IDBClient::IDBFactory::openInternal):
2745         (WebCore::IDBClient::IDBFactory::deleteDatabase):
2746         (WebCore::IDBClient::IDBFactory::cmp):
2747         * Modules/indexeddb/client/IDBFactoryImpl.h:
2748         * Modules/indexeddb/client/IDBIndexImpl.cpp:
2749         (WebCore::IDBClient::IDBIndex::IDBIndex):
2750         (WebCore::IDBClient::IDBIndex::openCursor):
2751         (WebCore::IDBClient::IDBIndex::count):
2752         (WebCore::IDBClient::IDBIndex::openKeyCursor):
2753         (WebCore::IDBClient::IDBIndex::get):
2754         (WebCore::IDBClient::IDBIndex::getKey):
2755         * Modules/indexeddb/client/IDBIndexImpl.h:
2756         * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
2757         (WebCore::IDBClient::IDBObjectStore::create):
2758         (WebCore::IDBClient::IDBObjectStore::IDBObjectStore):
2759         (WebCore::IDBClient::IDBObjectStore::openCursor):
2760         (WebCore::IDBClient::IDBObjectStore::get):
2761         (WebCore::IDBClient::IDBObjectStore::deleteFunction):
2762         (WebCore::IDBClient::IDBObjectStore::doDelete):
2763         (WebCore::IDBClient::IDBObjectStore::modernDelete):
2764         (WebCore::IDBClient::IDBObjectStore::clear):
2765         (WebCore::IDBClient::IDBObjectStore::createIndex):
2766         (WebCore::IDBClient::IDBObjectStore::index):
2767         (WebCore::IDBClient::IDBObjectStore::count):
2768         * Modules/indexeddb/client/IDBObjectStoreImpl.h:
2769         * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
2770         (WebCore::IDBClient::IDBOpenDBRequest::createDeleteRequest):
2771         (WebCore::IDBClient::IDBOpenDBRequest::createOpenRequest):
2772         (WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest):
2773         * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
2774         * Modules/indexeddb/client/IDBRequestImpl.cpp:
2775         (WebCore::IDBClient::IDBRequest::IDBRequest):
2776         * Modules/indexeddb/client/IDBRequestImpl.h:
2777         * Modules/indexeddb/client/IDBTransactionImpl.cpp:
2778         (WebCore::IDBClient::IDBTransaction::objectStore):
2779         (WebCore::IDBClient::IDBTransaction::createObjectStore):
2780         (WebCore::IDBClient::IDBTransaction::createIndex):
2781         * Modules/mediasource/DOMURLMediaSource.cpp:
2782         (WebCore::DOMURLMediaSource::createObjectURL):
2783         * Modules/mediasource/DOMURLMediaSource.h:
2784         * Modules/mediastream/DOMURLMediaStream.cpp:
2785         (WebCore::DOMURLMediaStream::createObjectURL):
2786         * Modules/mediastream/DOMURLMediaStream.h:
2787         * Modules/mediastream/HTMLMediaElementMediaStream.cpp:
2788         (WebCore::HTMLMediaElementMediaStream::setSrcObject):
2789         * Modules/mediastream/HTMLMediaElementMediaStream.h:
2790         * Modules/mediastream/HTMLMediaElementMediaStream.idl:
2791         * Modules/notifications/Notification.cpp:
2792         (WebCore::Notification::Notification):
2793         (WebCore::Notification::create):
2794         (WebCore::Notification::permission):
2795         (WebCore::Notification::requestPermission):
2796         * Modules/notifications/Notification.h:
2797         * Modules/notifications/NotificationCenter.cpp:
2798         (WebCore::NotificationCenter::createNotification):
2799         * Modules/notifications/NotificationClient.h:
2800         * Modules/quota/StorageInfo.cpp:
2801         (WebCore::StorageInfo::queryUsageAndQuota):
2802         (WebCore::StorageInfo::requestQuota):
2803         * Modules/quota/StorageInfo.h:
2804         * Modules/quota/StorageQuota.h:
2805         * bindings/js/JSIDBObjectStoreCustom.cpp:
2806         (WebCore::JSIDBObjectStore::createIndex):
2807         * bindings/scripts/CodeGeneratorJS.pm:
2808         (GenerateCallWith):
2809         * bindings/scripts/test/JS/JSTestInterface.cpp:
2810         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
2811         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
2812         * bindings/scripts/test/JS/JSTestObj.cpp:
2813         (WebCore::jsTestObjWithScriptExecutionContextAttribute):
2814         (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
2815         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
2816         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
2817         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
2818         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
2819         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
2820         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
2821         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
2822         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
2823         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
2824         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
2825         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
2826         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
2827         * fileapi/FileReaderSync.cpp:
2828         (WebCore::FileReaderSync::readAsArrayBuffer):
2829         (WebCore::FileReaderSync::readAsBinaryString):
2830         (WebCore::FileReaderSync::readAsText):
2831         (WebCore::FileReaderSync::readAsDataURL):
2832         (WebCore::FileReaderSync::startLoading):
2833         * fileapi/FileReaderSync.h:
2834         (WebCore::FileReaderSync::readAsText):
2835         * html/DOMURL.cpp:
2836         (WebCore::DOMURL::createObjectURL):
2837         (WebCore::DOMURL::createPublicURL):
2838         (WebCore::DOMURL::revokeObjectURL):
2839         * html/DOMURL.h:
2840         * html/HTMLMediaElement.cpp:
2841         (WebCore::HTMLMediaElement::setSrcObject):
2842         * html/HTMLMediaElement.h:
2843         * inspector/InspectorIndexedDBAgent.cpp:
2844         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
2845         * page/DOMWindow.h:
2846         * page/History.h:
2847         (WebCore::History::back):
2848         (WebCore::History::forward):
2849         (WebCore::History::go):
2850
2851 2016-03-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2852
2853         [GTK] Fix rendering of slider input elements
2854         https://bugs.webkit.org/show_bug.cgi?id=155296
2855
2856         Reviewed by Michael Catanzaro.
2857
2858         Use the new gadgets for newer GTK+ and improve a bit the rendering
2859         for previous versions to better match GTK+.
2860
2861         * rendering/RenderThemeGtk.cpp:
2862         (WebCore::createStyleContext): Add ScaleContents and
2863         ScaleHighlight parts that are only used with GTK+ 3.19.
2864         (WebCore::RenderThemeGtk::paintSliderTrack): Use a smaller trough,
2865         centered in the given rectangle to better match GTK+. Also render
2866         the hightlight gadget with GTK+ 3.19.
2867         (WebCore::RenderThemeGtk::paintSliderThumb): Also create the style
2868         context for contents gadget.
2869         (WebCore::RenderThemeGtk::adjustSliderThumbSize): Take into
2870         account the slider border when calculating the slider thumb size.
2871
2872 2016-03-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2873
2874         [GTK] Scrollbars are broken once again with current GTK+ master
2875         https://bugs.webkit.org/show_bug.cgi?id=155292
2876
2877         Reviewed by Michael Catanzaro.
2878
2879         Most of the trough theming properties have been moved to the
2880         scrollbar, and a new gadget "contents" has been added between the
2881         scrollbar and its children.
2882
2883         * platform/gtk/ScrollbarThemeGtk.cpp:
2884         (WebCore::ScrollbarThemeGtk::getOrCreateStyleContext): Add
2885         left/bottom style classes to ensure the scrollbars border is taken
2886         into account and rendered.
2887         (WebCore::ScrollbarThemeGtk::paintTrackBackground): Also create
2888         style context for contents gadget.
2889         (WebCore::ScrollbarThemeGtk::paintThumb): Ditto.
2890         (WebCore::ScrollbarThemeGtk::paintButton): Ditto.
2891         (WebCore::ScrollbarThemeGtk::scrollbarThickness): Take the
2892         scrollbar border into account.
2893         (WebCore::ScrollbarThemeGtk::buttonSize): Also create style
2894         context for contents gadget.
2895         (WebCore::ScrollbarThemeGtk::getStepperSpacing): Ditto.
2896         (WebCore::ScrollbarThemeGtk::minimumThumbLength): Ditto.
2897         (WebCore::ScrollbarThemeGtk::thumbFatness): Ditto.
2898         (WebCore::ScrollbarThemeGtk::getTroughBorder): Take the scrollbar
2899         border into account.
2900
2901 2016-03-10  David Kilzer  <ddkilzer@apple.com>
2902
2903         REGRESSION (r197983): Build fails due to missing inline method
2904
2905         Attempt to fix the following build failure:
2906
2907             Undefined symbols for architecture arm64:
2908               "JSC::GenericTypedArrayView<JSC::Uint8ClampedAdaptor>::createUninitialized(unsigned int)", referenced from:
2909                   WebCore::ImageBufferData::getData(WebCore::IntRect const&, WebCore::IntSize const&, bool, bool, float) const in ImageBufferDataCG.o
2910
2911         * platform/graphics/cg/ImageBufferDataCG.cpp: Include some
2912         headers to match FEGaussianBlur.cpp and FilterEffect.cpp.
2913
2914 2016-03-10  Tim Horton  <timothy_horton@apple.com>
2915
2916         Try to fix the iOS 9 build.
2917
2918         * editing/cocoa/DataDetection.mm:
2919         (WebCore::DataDetection::detectContentInRange):
2920         * platform/cocoa/DataDetectorsCoreSoftLink.h:
2921         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
2922         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
2923
2924 2016-03-10  David Kilzer  <ddkilzer@apple.com>
2925
2926         REGRESSION (r197976): Build failure due to missing DDOptionalSource.h header
2927
2928         Follow-up fix for:
2929             Expose additional WKDataDetectorTypes.
2930             <https://bugs.webkit.org/show_bug.cgi?id=155331>
2931
2932         * platform/spi/cocoa/DataDetectorsCoreSPI.h: Protect
2933         DDOptionalSource.h with version check.
2934
2935 2016-03-10  Alex Christensen  <achristensen@webkit.org>
2936
2937         Fix Windows build after r197986.
2938
2939         * accessibility/AccessibilityObject.h:
2940
2941 2016-03-10  Jeremy Jones  <jeremyj@apple.com>
2942
2943         Set AVURLAssetUsesNoPersistentCacheKey on AVAsset to match caching policy.
2944         https://bugs.webkit.org/show_bug.cgi?id=155117
2945         rdar://problem/6802240
2946
2947         Reviewed by Simon Fraser.
2948
2949         No new tests because no new functionality was added.
2950
2951         This will prevent persistent media caches when webkit is using in memory caching.
2952
2953         * html/HTMLMediaElement.cpp:
2954         (WebCore::HTMLMediaElement::mediaPlayerShouldUsePersistentCache): Added.
2955         * html/HTMLMediaElement.h: Declare mediaPlayerShouldUsePersistentCache().
2956         * page/ChromeClient.h: Declare mediaPlayerShouldUsePersistentCache().
2957         * platform/graphics/MediaPlayer.h:
2958         (WebCore::MediaPlayerClient::mediaPlayerShouldUsePersistentCache): Added.
2959         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2960         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Set property on AVAssetOptions.
2961
2962 2016-03-10  Jer Noble  <jer.noble@apple.com>
2963
2964         CRASH at WebCore::RenderView::updateVisibleViewportRect
2965         https://bugs.webkit.org/show_bug.cgi?id=155209
2966         <rdar://problem/23997530>
2967
2968         Reviewed by Simon Fraser.
2969
2970         Test: media/video-crash-invisible-autoplay-display-none.html
2971
2972         Between the time when the video element's renderer is created and destroyed, we may have unset the
2973         InvisibleAutoplayNotPermitted restriction. So rather than check for that restriction before
2974         unregistering for the "visible in viewport" notification, unregister only if the renderer
2975         was previously registered.
2976
2977         * html/HTMLMediaElement.cpp:
2978         (WebCore::HTMLMediaElement::willDetachRenderers):
2979
2980 2016-03-10  Zalan Bujtas  <zalan@apple.com>
2981
2982         Simple line layout: Add text-align: justify support.
2983         https://bugs.webkit.org/show_bug.cgi?id=155006
2984
2985         Reviewed by Antti Koivisto.
2986
2987         This patch enables text-align: justify; for simple line layout (only latin text for now).
2988         It speeds up/reduced memory consumption for justified text.
2989
2990         PerformanceTests/Layout/line-layout-simple.html
2991         before text-align: justify support -> mean: 86.20513022288704 runs/s
2992         after -> mean: 96.73972475626084 runs/s
2993
2994         Covered by existing text-align: justify tests.
2995
2996         * rendering/SimpleLineLayout.cpp:
2997         (WebCore::SimpleLineLayout::canUseForFontAndText):
2998         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
2999         (WebCore::SimpleLineLayout::LineState::expansionOportunity):
3000         (WebCore::SimpleLineLayout::expansionBehavior):
3001         (WebCore::SimpleLineLayout::justifyRuns):
3002         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
3003         (WebCore::SimpleLineLayout::createTextRuns):
3004         (WebCore::SimpleLineLayout::printReason):
3005         (WebCore::SimpleLineLayout::canUseForStyle): Deleted.
3006         * rendering/SimpleLineLayout.h:
3007         * rendering/SimpleLineLayoutFunctions.cpp:
3008         (WebCore::SimpleLineLayout::paintFlow):
3009         * rendering/SimpleLineLayoutResolver.h:
3010         (WebCore::SimpleLineLayout::RunResolver::Run::expansion):
3011         (WebCore::SimpleLineLayout::RunResolver::Run::expansionBehavior):
3012
3013 2016-03-10  Nan Wang  <n_wang@apple.com>
3014
3015         AX: Force allow user zoom
3016         https://bugs.webkit.org/show_bug.cgi?id=155056
3017
3018         Reviewed by Simon Fraser.
3019
3020         Override the maximum/minimum scale factor when forceAlwaysUserScalable is true.
3021
3022         Test: fast/viewport/ios/force-always-user-scalable.html
3023
3024         * Configurations/WebCoreTestSupport.xcconfig:
3025         * page/ViewportConfiguration.cpp:
3026         (WebCore::ViewportConfiguration::minimumScale):
3027         * page/ViewportConfiguration.h:
3028         (WebCore::ViewportConfiguration::maximumScale):
3029         * testing/Internals.cpp:
3030         (WebCore::Internals::resetToConsistentState):
3031         (WebCore::Internals::Internals):
3032         (WebCore::Internals::composedTreeAsText):
3033         (WebCore::Internals::setViewportForceAlwaysUserScalable):
3034         * testing/Internals.h:
3035         * testing/Internals.idl:
3036
3037 2016-03-10  Jiewen Tan  <jiewen_tan@apple.com>
3038
3039         WebKit should not be redirected to an invalid URL
3040         https://bugs.webkit.org/show_bug.cgi?id=155263
3041         <rdar://problem/22820172>
3042
3043         Reviewed by Brent Fulgham.
3044
3045         Test: http/tests/navigation/redirect-to-invalid-url.html
3046
3047         * loader/SubresourceLoader.cpp:
3048         (WebCore::SubresourceLoader::willSendRequestInternal):
3049
3050 2016-03-10  Nan Wang  <n_wang@apple.com>
3051
3052         AX: Implement bounds/position and index related text marker functions using TextIterator
3053         https://bugs.webkit.org/show_bug.cgi?id=154976
3054
3055         Reviewed by Chris Fleizach.
3056
3057         Implemented position and index related text marker calls with TextIterator. Also fixed some
3058         VoiceOver navigation issues.
3059
3060         Test: accessibility/mac/text-marker-for-index.html
3061
3062         * accessibility/AXObjectCache.cpp:
3063         (WebCore::AXObjectCache::traverseToOffsetInRange):
3064         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
3065         (WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
3066         (WebCore::AXObjectCache::shouldSkipBoundary):
3067         (WebCore::AXObjectCache::textMarkerDataForNextCharacterOffset):
3068         (WebCore::AXObjectCache::startCharacterOffsetOfWord):
3069         (WebCore::AXObjectCache::nextBoundary):
3070         (WebCore::AXObjectCache::previousBoundary):
3071         (WebCore::AXObjectCache::previousSentenceStartCharacterOffset):
3072         (WebCore::AXObjectCache::localCaretRectForCharacterOffset):
3073         (WebCore::AXObjectCache::absoluteCaretBoundsForCharacterOffset):
3074         (WebCore::AXObjectCache::characterOffsetForPoint):
3075         (WebCore::AXObjectCache::characterOffsetForBounds):
3076         (WebCore::AXObjectCache::endCharacterOffsetOfLine):
3077         (WebCore::AXObjectCache::startCharacterOffsetOfLine):
3078         (WebCore::AXObjectCache::characterOffsetForIndex):
3079         (WebCore::AXObjectCache::indexForCharacterOffset):
3080         (WebCore::AXObjectCache::rootAXEditableElement):
3081         * accessibility/AXObjectCache.h:
3082         * accessibility/AccessibilityObject.cpp:
3083         (WebCore::AccessibilityObject::visiblePositionRangeForRange):
3084         (WebCore::AccessibilityObject::rangeForPlainTextRange):
3085         (WebCore::AccessibilityObject::lineRangeForPosition):
3086         * accessibility/AccessibilityObject.h:
3087         (WebCore::AccessibilityObject::boundsForVisiblePositionRange):
3088         (WebCore::AccessibilityObject::boundsForRange):
3089         (WebCore::AccessibilityObject::setSelectedVisiblePositionRange):
3090         (WebCore::AccessibilityObject::doAXStringForRange):
3091         (WebCore::AccessibilityObject::doAXBoundsForRange):
3092         (WebCore::AccessibilityObject::doAXBoundsForRangeUsingCharacterOffset):
3093         * accessibility/AccessibilityRenderObject.cpp:
3094         (WebCore::AccessibilityRenderObject::nodeIsTextControl):
3095         (WebCore::AccessibilityRenderObject::boundsForRects):
3096         (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange):
3097         (WebCore::AccessibilityRenderObject::boundsForRange):
3098         (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
3099         (WebCore::AccessibilityRenderObject::doAXBoundsForRange):
3100         (WebCore::AccessibilityRenderObject::doAXBoundsForRangeUsingCharacterOffset):
3101         (WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest):
3102         * accessibility/AccessibilityRenderObject.h:
3103         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3104         (-[WebAccessibilityObjectWrapper positionForTextMarker:]):
3105         (-[WebAccessibilityObjectWrapper textMarkerRange]):
3106         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
3107         (-[WebAccessibilityObjectWrapper textMarkerForPosition:]):
3108         (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
3109         (-[WebAccessibilityObjectWrapper frameForTextMarkers:]):
3110         (-[WebAccessibilityObjectWrapper textMarkerForPoint:]):
3111         (-[WebAccessibilityObjectWrapper nextMarkerForCharacterOffset:]):
3112         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3113         (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]):
3114         (-[WebAccessibilityObjectWrapper _convertToNSRange:]):
3115         (-[WebAccessibilityObjectWrapper _indexForTextMarker:]):
3116         (-[WebAccessibilityObjectWrapper _textMarkerForIndex:]):
3117         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
3118         * editing/htmlediting.cpp:
3119         (WebCore::localCaretRectInRendererForCaretPainting):
3120         (WebCore::localCaretRectInRendererForRect):
3121         * editing/htmlediting.h:
3122
3123 2016-03-10  Simon Fraser  <simon.fraser@apple.com>
3124
3125         Font antialiasing (smoothing) changes when elements are rendered into compositing layers
3126         https://bugs.webkit.org/show_bug.cgi?id=23364
3127
3128         Reviewed by Tim Horton.
3129
3130         Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
3131         by opting in to a new CALayer backing store format.
3132
3133         GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
3134         when the platform has support for the new feature. Ideally this would only be set when
3135         we know a layer has smoothed text drawn into it, but, for now, enable this for all
3136         layers. The right thing happens with opaque layers under the hood.
3137
3138         setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
3139         is ultimately passed to setBackingStoreFormat().
3140
3141         We also need to propagate this flag to TileController tiles.
3142
3143         * platform/graphics/GraphicsLayer.cpp:
3144         (WebCore::GraphicsLayer::supportsSmoothedLayerText):
3145         (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
3146         (WebCore::GraphicsLayer::smoothedLayerTextEnabled):
3147         (WebCore::GraphicsLayer::GraphicsLayer):
3148         * platform/graphics/GraphicsLayer.h:
3149         (WebCore::GraphicsLayer::supportsSmoothedFonts):
3150         (WebCore::GraphicsLayer::setSupportsSmoothedFonts):
3151         * platform/graphics/TiledBacking.h:
3152         * platform/graphics/ca/GraphicsLayerCA.cpp:
3153         (WebCore::GraphicsLayer::supportsSmoothedLayerText):
3154         (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
3155         (WebCore::GraphicsLayer::smoothedLayerTextEnabled):
3156         (WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
3157         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3158         (WebCore::GraphicsLayerCA::updateContentsFormat):
3159         * platform/graphics/ca/GraphicsLayerCA.h:
3160         * platform/graphics/ca/PlatformCALayer.cpp:
3161         (WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
3162         the contents format says we support smoothed fonts.
3163         * platform/graphics/ca/PlatformCALayer.h:
3164         * platform/graphics/ca/TileController.cpp:
3165         (WebCore::TileController::setTileContentsFormatFlags):
3166         (WebCore::TileController::createTileLayer):
3167         * platform/graphics/ca/TileController.h:
3168         * platform/graphics/ca/TileGrid.cpp:
3169         (WebCore::TileGrid::updateTileLayerProperties):
3170         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
3171         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3172         (WebCore::setBackingStoreFormat):
3173         (PlatformCALayerCocoa::commonInit):
3174         (PlatformCALayerCocoa::setContentsFormat):
3175         (PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
3176         non-opaque layers to improve text appearance. We no longer need to do that when
3177         the contents format has "SmoothedFonts".
3178         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3179         (PlatformCALayerWin::setContentsFormat):
3180         (PlatformCALayerWin::contentsFormat):
3181         * platform/graphics/ca/win/PlatformCALayerWin.h:
3182         * platform/ios/LegacyTileGridTile.mm:
3183         (WebCore::setBackingStoreFormat):
3184         (WebCore::LegacyTileGridTile::LegacyTileGridTile):
3185         * rendering/RenderLayerBacking.cpp:
3186         (WebCore::RenderLayerBacking::createGraphicsLayer):
3187
3188 2016-03-10  Commit Queue  <commit-queue@webkit.org>
3189
3190         Unreviewed, rolling out r197922.
3191         https://bugs.webkit.org/show_bug.cgi?id=155340
3192
3193         This change broke storage/websql tests on ios-simulator.
3194         (Requested by ryanhaddad on #webkit).
3195
3196         Reverted changeset:
3197
3198         "WebKit should adopt journal_mode=wal for all SQLite
3199         databases."
3200         https://bugs.webkit.org/show_bug.cgi?id=133496
3201         http://trac.webkit.org/changeset/197922
3202
3203 2016-03-10  Tim Horton  <timothy_horton@apple.com>
3204
3205         Fix the build again.
3206
3207         * editing/cocoa/DataDetection.mm:
3208         (WebCore::constructURLStringForResult):
3209
3210 2016-03-10  Tim Horton  <timothy_horton@apple.com>
3211
3212         Fix the build.
3213
3214         * editing/cocoa/DataDetection.mm:
3215
3216 2016-03-10  Enrica Casucci  <enrica@apple.com>
3217
3218         Expose additional WKDataDetectorTypes.
3219         https://bugs.webkit.org/show_bug.cgi?id=155331
3220         rdar://problem/24175813
3221
3222         Reviewed by Tim Horton.
3223
3224         Adding support for additional data detector types (tracking
3225         numbers, flight information and spotlight suggestions).
3226
3227         * editing/cocoa/DataDetection.h:
3228         * editing/cocoa/DataDetection.mm:
3229         (WebCore::constructURLStringForResult):
3230         (WebCore::DataDetection::detectContentInRange):
3231         * platform/cocoa/DataDetectorsCoreSoftLink.h:
3232         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
3233         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
3234
3235 2016-03-10  Daniel Bates  <dabates@apple.com>
3236
3237         CSP: Implement frame-ancestors directive
3238         https://bugs.webkit.org/show_bug.cgi?id=154345
3239         <rdar://problem/24702161>
3240
3241         Reviewed by Brent Fulgham.
3242
3243         Add support for the Content Security Policy directive frame-ancestors per the Content Security
3244         Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.
3245
3246         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-meta-element-ignored.html
3247                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-report-only-ignored.html
3248                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html
3249                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin.html
3250                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https.html
3251                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin.html
3252
3253         * loader/DocumentLoader.cpp:
3254         (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Extracted from DocumentLoader::responseReceived().
3255         (WebCore::DocumentLoader::responseReceived): Extracted logic to cancel a load and dispatch a DOM Load
3256         event at the frame owner into DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
3257         Make use of this function when loading of the frame is blocked by either the Content Security Policy or
3258         the X-Frame-Option policy. We explicitly instantiate a ContentSecurityPolicy object with a SecurityOrigin
3259         and Frame instead of using ScriptExecutionContext m_frame->document() because m_frame->document() is not
3260         in a stable state (for instance, Document::m_url has not been initialized) as we are in the process of
3261         loading the underlying document data for it.
3262         * loader/DocumentLoader.h:
3263         * loader/FrameLoader.cpp:
3264         (WebCore::FrameLoader::didBeginDocument): Pass ContentSecurityPolicy::ReportParsingErrors::No to silence
3265         errors raised when parsing the Content Security Policy headers to avoid duplicate error messages. Any
3266         parsing errors would have been raised when we parsed the Content Security Policy in DocumentLoader.
3267         * page/csp/ContentSecurityPolicy.cpp:
3268         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Modified to take an optional pointer to a Frame (defaults
3269         to nullptr). The specified Frame is used to support emitting console messages for violations/syntax errors and
3270         send violation reports. We make use of this constructor variant in DocumentLoader to support emitting console
3271         message and sending violation reports in the context of DocumentLoader where its associated Document is not in a
3272         stable state and making use of a Frame seems less error prone.
3273         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Modified to take argument reportParsingErrors as
3274         to whether to silence parsing errors when parsing the specified headers.
3275         (WebCore::isAllowedByAllWithFrame): Helper function to query a ContentSecurityPolicyDirectiveList function
3276         passing a Frame and URL for each Content Security Policy.
3277         (WebCore::ContentSecurityPolicy::allowFrameAncestors): Calls WebCore::isAllowedByAllWithFrame().
3278         (WebCore::ContentSecurityPolicy::reportViolation): Modified to support sending a violation report when
3279         we have a Frame and no ScriptExecutionContext (such as when we are instantiated in DocumentLoader).
3280         Additionally, we only will send a report if reporting is enabled (i.e. ContentSecurityPolicy::m_isReportingEnabled == true).
3281         (WebCore::ContentSecurityPolicy::logToConsole): Modified to support logging a message to the console
3282         we have a Frame and no ScriptExecutionContext. We also only allow logging if reporting is enabled.
3283         * page/csp/ContentSecurityPolicy.h:
3284         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3285         (WebCore::checkFrameAncestors): Added.
3286         (WebCore::ContentSecurityPolicyDirectiveList::checkFrameAncestorsAndReportViolation): Added.
3287         (WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Added.
3288         (WebCore::ContentSecurityPolicyDirectiveList::parse): Ignore the directive frame-ancestors when defined
3289         in a policy given in an HTML meta element and report such use as invalid.
3290         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Parse the directive frame-ancestors.
3291         * page/csp/ContentSecurityPolicyDirectiveList.h:
3292         * page/csp/ContentSecurityPolicyResponseHeaders.h: Mark constructor "explicit".
3293
3294 2016-03-10  Jer Noble  <jer.noble@apple.com>
3295
3296         Add WebCore, WebKit, & WebKit2 preference/setting to enable Main Content heuristic.
3297         https://bugs.webkit.org/show_bug.cgi?id=155326
3298         <rdar://problem/25095408>
3299
3300         Reviewed by Beth Dakin.
3301
3302         * html/HTMLMediaElement.cpp:
3303         (WebCore::HTMLMediaElement::HTMLMediaElement): Set the OverrideUserGestureRequirementForMainContent if the new setting is enabled.
3304         * page/Settings.in:
3305
3306 2016-03-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
3307
3308         REGRESSION: GuardMallloc crash in SVGListPropertyTearOff<SVGPointList>::processIncomingListItemWrapper
3309         https://bugs.webkit.org/show_bug.cgi?id=154969
3310
3311         Reviewed by Darin Adler.
3312
3313         The life cycle of the SVGAnimatedPropertyTearOff::m_baseVal and m_animVal
3314         was not correct. Like what was done in SVGAnimatedListPropertyTearOff,
3315         m_baseVal and m_animVal have to be raw RefCounted pointers. When requested
3316         through, SVGAnimatedPropertyTearOff::baseVal() and animVal() they are
3317         encapsulated in a RefPtr to ensure they existence as long as they are
3318         referenced. When the animated property object (which is stored in either
3319         m_baseVal or m_animVal) is not referenced by anyone, it is going to be
3320         deleted. In the destructor of their class, SVGAnimatedPropertyTearOff
3321         will be notified of this deletion through propertyWillBeDeleted() to clean
3322         its member m_baseVal or m_animVal.
3323
3324         * bindings/scripts/CodeGeneratorJS.pm:
3325         (NativeToJSValue): Now all the SVG animated property return RefPtrs. In
3326         addition to that, SVGViewSpec.transform also returns
3327         RefPtr<SVGTransformListPropertyTearOff>.
3328         
3329         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3330         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
3331         (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
3332         (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
3333         (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
3334         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
3335         (WebCore::SVGAnimatedListPropertyTearOff::isAnimating):
3336         (WebCore::SVGAnimatedListPropertyTearOff::propertyWillBeDeleted):
3337         Change propertyWillBeDeleted() to be virtual and make it takes an SVGProperty*.
3338         Rename m_animatingAnimVal to be m_animatedProperty. Add isAnimating() which
3339         returns true if m_animatedProperty is not null. Use isAnimating() instead of
3340         m_isAnimating because it's deleted from the base class.
3341         
3342         * svg/properties/SVGAnimatedProperty.cpp:
3343         (WebCore::SVGAnimatedProperty::SVGAnimatedProperty):
3344         (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
3345         * svg/properties/SVGAnimatedProperty.h:
3346         (WebCore::SVGAnimatedProperty::isAnimating):
3347         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted):
3348         Delete m_isAnimating since its value can be deduced from the value of
3349         m_animatedProperty in the derived class. Add propertyWillBeDeleted() and
3350         isAnimating() as virtual functions with the default behavior.
3351         
3352         * svg/properties/SVGAnimatedPropertyTearOff.h:
3353         (WebCore::SVGAnimatedPropertyTearOff::baseVal):
3354         (WebCore::SVGAnimatedPropertyTearOff::animVal):
3355         Like SVGAnimatedListPropertyTearOff::baseVal() and animVal() create the
3356         value if it does not exist. Keep a raw RefCounted pointer but return a
3357         RefPtr.
3358
3359         (WebCore::SVGAnimatedPropertyTearOff::isAnimating):
3360         (WebCore::SVGAnimatedPropertyTearOff::propertyWillBeDeleted):
3361         Override virtual functions.
3362         
3363         (WebCore::SVGAnimatedPropertyTearOff::currentAnimatedValue):
3364         (WebCore::SVGAnimatedPropertyTearOff::animationStarted):
3365         (WebCore::SVGAnimatedPropertyTearOff::animationEnded):
3366         (WebCore::SVGAnimatedPropertyTearOff::animValWillChange):
3367         (WebCore::SVGAnimatedPropertyTearOff::animValDidChange):
3368         Replace m_isAnimating with isAnimating(). Ensure that we get a new animated
3369         property through animVal() and store it in a RefPtr to ensure it will not
3370         go away while animating.
3371         
3372         * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
3373         (WebCore::SVGAnimatedStaticPropertyTearOff::isAnimating):
3374         (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
3375         (WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
3376         (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
3377         (WebCore::SVGAnimatedStaticPropertyTearOff::animValWillChange):
3378         (WebCore::SVGAnimatedStaticPropertyTearOff::animValDidChange):
3379         Add isAnimating() and replace all the instances of m_isAnimating with calls
3380         to isAnimating().
3381         
3382         * svg/properties/SVGPropertyTearOff.h:
3383         (WebCore::SVGPropertyTearOff::animatedProperty):
3384         (WebCore::SVGPropertyTearOff::setAnimatedProperty):
3385         (WebCore::SVGPropertyTearOff::contextElement):
3386         (WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
3387         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
3388         SVGPropertyTearOff is what SVGAnimatedPropertyTearOff creates for its 
3389         baseVal() and animVal() values. These values can be null anytime once
3390         they are not referenced. The SVGAnimatedPropertyTearOff holds only raw
3391         RefCounted pointer for them. So (1) SVGPropertyTearOff needs to hold a
3392         RefPtr for its SVGAnimatedProperty and (2) it needs to notify its
3393         SVGAnimatedProperty when it's deleted by calling propertyWillBeDeleted()
3394         from the destructor. Also there is no need to get the contextElement()
3395         and save it in class member, m_contextElement since it can be always be
3396         retrieved from SVGAnimatedProperty::contextElement().
3397
3398 2016-03-10  Jonathan Davis  <jond@apple.com>
3399
3400         Fixed broken link for "WebGL 2" on the Feature Status page
3401         https://bugs.webkit.org/show_bug.cgi?id=155235
3402
3403         Reviewed by Alex Christensen.
3404
3405         * features.json:
3406
3407 2016-03-10  Myles C. Maxfield  <mmaxfield@apple.com>
3408
3409         [OS X] Main frame scrollbars should appear on the left on RTL systems
3410         https://bugs.webkit.org/show_bug.cgi?id=155149
3411
3412         Reviewed by Simon Fraser.
3413
3414         A helper function, ScrollableArea::systemLanguageIsRTL() is used to determine
3415         if we should be in this new mode. Once we have determined we should be in
3416         this new mode, there are some scattered places where the geometry math
3417         needed to be updated.
3418
3419         Tests: fast/scrolling/rtl-scrollbars-simple.html
3420                fast/scrolling/rtl-scrollbars.html
3421
3422         * page/scrolling/AsyncScrollingCoordinator.cpp:
3423         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3424         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
3425         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3426         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
3427         * platform/mac/ScrollableAreaMac.mm:
3428         (WebCore::ScrollableArea::systemLanguageIsRTL):
3429         * platform/ScrollableArea.h:
3430         * platform/ScrollView.cpp:
3431         (WebCore::ScrollView::updateScrollbars):
3432         (WebCore::ScrollView::scrollCornerRect):
3433         * platform/mac/ScrollAnimatorMac.mm:
3434         (WebCore::ScrollAnimator::scrollbarsAreRTL):
3435         * platform/spi/mac/NSScrollerImpSPI.h:
3436         * rendering/RenderLayerCompositor.cpp:
3437         (WebCore::RenderLayerCompositor::positionForClipLayer):
3438
3439 2016-03-07  Jer Noble  <jer.noble@apple.com>
3440
3441         Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
3442         https://bugs.webkit.org/show_bug.cgi?id=155141
3443
3444         Reviewed by Beth Dakin.
3445
3446         Rename RequireUserGestureForRateChange -> RequireUserGestureForVideoRateChange.
3447         Rename Settings::requiresUserGestureForMediaPlayback -> Settings::videoPlaybackRequiresUserGesture.
3448
3449         Fix longstanding FIXME unifying our behavior restrictions between iOS and Mac.
3450
3451         * Modules/webaudio/AudioContext.cpp:
3452         (WebCore::AudioContext::constructCommon): Rename.
3453         * html/HTMLMediaElement.cpp:
3454         (WebCore::HTMLMediaElement::HTMLMediaElement): Unify behavior restriction behavior.
3455         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Rename.
3456         * html/MediaElementSession.cpp:
3457         (WebCore::restrictionName): Rename.
3458         (WebCore::MediaElementSession::playbackPermitted): Rename.
3459         * html/MediaElementSession.h:
3460         * page/Settings.cpp:
3461         * page/Settings.in:
3462         * testing/Internals.cpp:
3463         (WebCore::Internals::setMediaElementRestrictions): Rename.
3464
3465 2016-03-10  Ryosuke Niwa  <rniwa@webkit.org>
3466
3467         Add :defined support
3468         https://bugs.webkit.org/show_bug.cgi?id=155108
3469
3470         Reviewed by Antti Koivisto.
3471
3472         Added :defined pseudo class which applies to a successfully instantiated custom element or a builtin element.
3473         A new node flag, isUnresolvedCustomElement, which was added in r197917 tracks un-upgraded / unresolved custom
3474         elements for which :defined should not apply.
3475
3476         Tests: fast/custom-elements/defined-pseudo-class.html
3477                fast/custom-elements/defined-rule.html
3478
3479         * bindings/js/JSCustomElementInterface.cpp:
3480         (WebCore::JSCustomElementInterface::constructElement): Unset isUnresolvedCustomElement now that HTMLElement's
3481         constructor sets isUnresolvedCustomElement.
3482         * bindings/js/JSHTMLElementCustom.cpp:
3483         (WebCore::constructJSHTMLElement): Set isUnresolvedCustomElement to true since :defined should never apply to
3484         a custom element inside its constructor as HTMLElement constructor does not set the defined flag:
3485         https://w3c.github.io/webcomponents/spec/custom/#htmlelement-constructor
3486         * css/CSSSelector.cpp:
3487         (WebCore::CSSSelector::selectorText): Added the support for serializing :defined.
3488         * css/CSSSelector.h:
3489         (PseudoClassType): Added PseudoClassDefined for :defined.
3490         * css/SelectorChecker.cpp:
3491         (WebCore::SelectorChecker::checkOne): Added the support for :defined.
3492         * css/SelectorCheckerTestFunctions.h:
3493         (WebCore::isDefinedElement): Added. Returns true for any builtin element and a custom element after a successful
3494         construction / upgrades.
3495         * css/SelectorPseudoClassAndCompatibilityElementMap.in: Added :defined.
3496         * cssjit/SelectorCompiler.cpp:
3497         (WebCore::SelectorCompiler::addPseudoClassType): Added the support for :defined.
3498
3499 2016-03-10  Commit Queue  <commit-queue@webkit.org>
3500
3501         Unreviewed, rolling out r197943.
3502         https://bugs.webkit.org/show_bug.cgi?id=155317
3503
3504         This change broke Windows, WinCairo, GTK and EFL builds
3505         (Requested by ryanhaddad on #webkit).
3506
3507         Reverted changeset:
3508
3509         "Add a baseURL parameter to _WKUserStyleSheet"
3510         https://bugs.webkit.org/show_bug.cgi?id=155219
3511         http://trac.webkit.org/changeset/197943
3512
3513 2016-03-10  Daniel Bates  <dabates@apple.com>
3514
3515         CSP: Implement support for script and style nonces
3516         https://bugs.webkit.org/show_bug.cgi?id=116508
3517         <rdar://problem/24963980>
3518
3519         Reviewed by Brent Fulgham.
3520
3521         Add support for script-src and style-src nonces as per sections Nonce usage for script elements
3522         and Nonce usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.
3523
3524         * dom/InlineStyleSheetOwner.cpp:
3525         (WebCore::InlineStyleSheetOwner::createSheet): Check if the nonce for an HTML style element matches a known nonce.
3526         * dom/ScriptElement.cpp:
3527         (WebCore::ScriptElement::requestScript): Check if the nonce for an HTML script element for an external JavaScript
3528         script matches a known nonce. If it does then skip subsequent checks of the Content Security Policy when loading
3529         the script.
3530         (WebCore::ScriptElement::executeScript): Check if the nonce for an HTML script element for an inline JavaScript
3531         script matches a known nonce.
3532         * html/HTMLLinkElement.cpp:
3533         (WebCore::HTMLLinkElement::process): Check if the nonce for an HTML link element matches a known nonce. If it does
3534         then skip subsequent checks of the Content Security Policy when loading the stylesheet.
3535         * html/HTMLScriptElement.idl: Unconditionally expose attribute nonce.
3536         * html/HTMLStyleElement.idl: Ditto.
3537         * page/csp/ContentSecurityPolicy.cpp:
3538         (WebCore::isAllowedByAllWithNonce):
3539         (WebCore::ContentSecurityPolicy::allowScriptWithNonce): Check if the nonce attribute value of a script element
3540         matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowScriptWithNonce().
3541         (WebCore::ContentSecurityPolicy::allowStyleWithNonce): Check if the nonce attribute value of a style/link element
3542         matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowStyleWithNonce().
3543         * page/csp/ContentSecurityPolicy.h:
3544         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3545         (WebCore::checkNonce): Checks if the directive allows the specified nonce.
3546         (WebCore::ContentSecurityPolicyDirectiveList::allowScriptWithNonce): Check if the specified nonce is in
3547         the source list of the script-src directive (if specified) or the source list of the default-src directive (if specified).
3548         (WebCore::ContentSecurityPolicyDirectiveList::allowStyleWithNonce): Check if the specified nonce is in
3549         the source list of the style-src directive (if specified) or the source list of the default-src directive (if specified).
3550         * page/csp/ContentSecurityPolicyDirectiveList.h:
3551         * page/csp/ContentSecurityPolicySourceList.cpp:
3552         (WebCore::ContentSecurityPolicySourceList::matches): Returns whether the specified nonce is in the HashSet of
3553         nonces for the directive.
3554         (WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseNonceSource()
3555         to parse a nonce source expression.
3556         (WebCore::isBase64Character): Moved function to be above function ContentSecurityPolicySourceList::parseNonceSource()
3557         so that it can referenced from both ContentSecurityPolicySourceList::parseNonceSource() and ContentSecurityPolicySourceList::parseHashSource().
3558         (WebCore::isNonceCharacter): Added. Matches Blink's definition of a valid nonce character. This definition differs
3559         from the definition in the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp/> (29 February 2016).
3560         (WebCore::ContentSecurityPolicySourceList::parseNonceSource): Parses a source expression for a nonce value.
3561         * page/csp/ContentSecurityPolicySourceList.h:
3562         (WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
3563         'unsafe-inline' was specified in the source list and the source list does not contain any hash sources
3564         or nonce sources.
3565         * page/csp/ContentSecurityPolicySourceListDirective.cpp:
3566         (WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified nonce is in the source list.
3567         * page/csp/ContentSecurityPolicySourceListDirective.h:
3568
3569 2016-03-08  Sam Weinig  <sam@webkit.org>
3570
3571         Add a baseURL parameter to _WKUserStyleSheet
3572         https://bugs.webkit.org/show_bug.cgi?id=155219
3573
3574         Reviewed by Tim Horton.
3575
3576         - Moves to a model for user content where instead of each page having a WebCore::UserContentController
3577           object, we have an abstract WebCore::UserContentProvider interface that can be implemented at the WebKit
3578           level. For now, legacy WebKit continues to use the old UserContentController, which implements 
3579           WebCore::UserContentProvider, and WebKit2 implements its own implementation so it can store additional
3580           state.
3581
3582         * WebCore.xcodeproj/project.pbxproj:
3583         Add new files.
3584
3585         * dom/ExtensionStyleSheets.cpp:
3586         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache):
3587         Switch to using forEachUserStyleSheet on the UserContentProvider.
3588
3589         * html/HTMLMediaElement.cpp:
3590         (WebCore::HTMLMediaElement::loadResource):
3591         Remove null check now that we always have a UserContentProvider.
3592
3593         * loader/EmptyClients.cpp:
3594         (WebCore::fillWithEmptyClients):
3595         * loader/EmptyClients.h:
3596         Add new EmptyClients.
3597
3598         * loader/FrameLoader.cpp:
3599         (WebCore::FrameLoader::loadResourceSynchronously):
3600         Remove null check now that we always have a UserContentProvider.
3601
3602         * loader/PingLoader.cpp:
3603         (WebCore::processContentExtensionRulesForLoad):
3604         Remove null check now that we always have a UserContentProvider.
3605
3606         * loader/ResourceLoader.cpp:
3607         (WebCore::ResourceLoader::willSendRequestInternal):
3608         Remove null check now that we always have a UserContentProvider.
3609
3610         * loader/cache/CachedResourceLoader.cpp:
3611         (WebCore::CachedResourceLoader::requestResource):
3612         Remove null check now that we always have a UserContentProvider.
3613
3614         * page/DOMWindow.cpp:
3615         (WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
3616         Remove null checks now that we always have a UserContentProvider, and userMessageHandlerDescriptors
3617         returns a reference.
3618
3619         (WebCore::DOMWindow::open):
3620         Remove null check now that we always have a UserContentProvider.
3621
3622         * page/Frame.cpp:
3623         (WebCore::Frame::injectUserScripts):
3624         Simplify by lifting document check out of the main loop and using forEachUserScript.
3625
3626         * page/Page.cpp:
3627         (WebCore::Page::Page):
3628         (WebCore::Page::~Page):
3629         (WebCore::Page::userContentProvider):
3630         (WebCore::Page::setUserContentProvider):
3631         (WebCore::Page::setUserContentController): Deleted.
3632         * page/Page.h:
3633         (WebCore::Page::userContentController): Deleted.
3634         * page/PageConfiguration.h:
3635         Store the UserContentProvider in a Ref, and require PageConfigurations to provide one. This
3636         removes a bunch of null checks and simplifies the code.
3637
3638         * page/UserContentController.cpp:
3639         (WebCore::UserContentController::~UserContentController):
3640         (WebCore::UserContentController::forEachUserScript):
3641         (WebCore::UserContentController::forEachUserStyleSheet):
3642         (WebCore::UserContentController::addUserScript):
3643         (WebCore::UserContentController::removeUserScript):
3644         (WebCore::UserContentController::removeUserScripts):
3645         (WebCore::UserContentController::addUserStyleSheet):
3646         (WebCore::UserContentController::removeUserStyleSheet):
3647         (WebCore::UserContentController::removeUserStyleSheets):
3648         (WebCore::UserContentController::addUserMessageHandlerDescriptor):
3649         (WebCore::UserContentController::removeUserMessageHandlerDescriptor):
3650         (WebCore::UserContentController::addUserContentExtension):
3651         (WebCore::UserContentController::removeUserContentExtension):
3652         (WebCore::UserContentController::removeAllUserContentExtensions):
3653         (WebCore::UserContentController::removeAllUserContent):
3654         (WebCore::UserContentController::addPage): Deleted.
3655         (WebCore::UserContentController::removePage): Deleted.
3656         (WebCore::contentExtensionsEnabled): Deleted.
3657         (WebCore::UserContentController::processContentExtensionRulesForLoad): Deleted.
3658         (WebCore::UserContentController::actionsForResourceLoad): Deleted.
3659         * page/UserContentController.h:
3660         (WebCore::UserContentController::userScripts): Deleted.
3661         (WebCore::UserContentController::userStyleSheets): Deleted.
3662         (WebCore::UserContentController::userMessageHandlerDescriptors): Deleted.
3663         Add inheritance from UserContentProvider and simplify things by removing unique_ptrs
3664         that were holding the member variables. There is usually only one UserContentController
3665         so having these in unique_ptrs doesn't make much sense.
3666         
3667         * page/UserContentProvider.cpp: Added.
3668         (WebCore::UserContentProvider::UserContentProvider):
3669         (WebCore::UserContentProvider::~UserContentProvider):
3670         (WebCore::UserContentProvider::addPage):
3671         (WebCore::UserContentProvider::removePage):
3672         (WebCore::UserContentProvider::invalidateInjectedStyleSheetCacheInAllFramesInAllPages):
3673         (WebCore::contentExtensionsEnabled):
3674         (WebCore::UserContentProvider::processContentExtensionRulesForLoad):
3675         (WebCore::UserContentProvider::actionsForResourceLoad):
3676         * page/UserContentProvider.h: Added.
3677         Add abstract class for providing user content and add some helpers on it.
3678
3679         * page/UserMessageHandlerDescriptor.h:
3680         (WebCore::UserMessageHandlerDescriptor::create):
3681         (WebCore::UserMessageHandlerDescriptor::client):
3682         (WebCore::UserMessageHandlerDescriptor::invalidateClient):
3683         * page/UserMessageHandlersNamespace.cpp:
3684         (WebCore::UserMessageHandlersNamespace::handler):
3685         Simplify now that userContentProvider() and userMessageHandlerDescriptors() are references.
3686
3687 2016-03-10  Commit Queue  <commit-queue@webkit.org>
3688
3689         Unreviewed, rolling out r197923.
3690         https://bugs.webkit.org/show_bug.cgi?id=155301
3691
3692         Rolling out this change due to breaking the build and
3693         LayoutTests. (Requested by ryanhaddad on #webkit).
3694
3695         Reverted changeset:
3696
3697         "Font antialiasing (smoothing) changes when elements are
3698         rendered into compositing layers"
3699         https://bugs.webkit.org/show_bug.cgi?id=23364
3700         http://trac.webkit.org/changeset/197923
3701
3702 2016-03-10  Daniel Bates  <dabates@apple.com>
3703
3704         CSP: Implement support for inline script and inline style hashes
3705         https://bugs.webkit.org/show_bug.cgi?id=155007
3706         <rdar://problem/24964098>
3707
3708         Reviewed by Brent Fulgham.
3709
3710         Inspiration taken from the analogous implementation in Blink.
3711
3712         Add support for script-src and style-src hashes as per sections Hash usage for script elements
3713         and Hash usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.
3714
3715         Test: http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html
3716
3717         * WebCore.xcodeproj/project.pbxproj: Add file ContentSecurityPolicyHash.h. Also sort the list of files
3718         in the group WebCore/page/csp.
3719         * dom/InlineStyleSheetOwner.cpp:
3720         (WebCore::InlineStyleSheetOwner::createSheet): Pass the content of the stylesheet when querying whether
3721         the stylesheet is allowed by the Content Security Policy.
3722         * dom/ScriptElement.cpp:
3723         (WebCore::ScriptElement::executeScript): Pass the content of the inline JavaScript script when querying
3724         whether the script is allowed by the Content Security Policy.
3725         * dom/StyledElement.cpp:
3726         (WebCore::StyledElement::styleAttributeChanged): The Content Security Policy style-src hashes do not apply
3727         to inline styles defined in the HTML style attribute. So, pass a null string (to indicate the absence of
3728         content) when querying whether the inline style is allowed by the Content Security Policy.
3729         * page/csp/ContentSecurityPolicy.cpp:
3730         (WebCore::toCryptoDigestAlgorithm): Convenience function that maps a ContentSecurityPolicyHashAlgorithm
3731         enumerator to a CryptoDigest::Algorithm enumerator.
3732         (WebCore::isAllowedByAllWithHashFromContent): Computes the digest of the specified content for each
3733         hash algorithm and checks if digest matches a hash that was specified in a policy.
3734         (WebCore::ContentSecurityPolicy::documentEncoding): Added.
3735         (WebCore::ContentSecurityPolicy::allowInlineScript): Check if the hash of the script matches a known
3736         hash if applicable. Otherwise, fall back to checking the URL of the script.
3737         (WebCore::ContentSecurityPolicy::allowInlineStyle): Check if the hash of the stylesheet matches a
3738         known hash if applicable. Otherwise, fall back to checking the URL of the stylesheet.
3739         * page/csp/ContentSecurityPolicy.h:
3740         (WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineScripts): Adds the specified set of
3741         hash algorithms to the existing set of hash algorithms we know are used for inline scripts.
3742         (WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineStylesheets): Adds the specified set of
3743         hash algorithms to the existing set of hash algorithms we know are used for inline stylesheets.
3744         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3745         (WebCore::checkEval): Make this a static, non-member function because it does not depend on any
3746         instance or class variables. Mark this function as inline to give a hint to the compiler that it
3747         should consider inlining the implementation of this function into the caller.
3748         (WebCore::checkInline): Ditto.
3749         (WebCore::checkSource): Ditto.
3750         (WebCore::checkHash): Checks if the directive allows content with the specified hash.
3751         (WebCore::checkMediaType): Make this a static, non-member function because it does not depend on
3752         any instance or class variables. Mark this function as inline to give a hint to the compiler that
3753         it should consider inlining the implementation of this function into the caller.
3754         (WebCore::ContentSecurityPolicyDirectiveList::create): Modified as needed now that WebCore::checkEval()
3755         is a static, non-member function.
3756         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash): Added.
3757         (WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash): Added.
3758         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Modified to pass the hash algorithms seen
3759         from parsing the directives script-src, style-src, and default-src to the ContentSecurityPolicy object.
3760         (WebCore::ContentSecurityPolicyDirectiveList::checkEval): Deleted.
3761         (WebCore::ContentSecurityPolicyDirectiveList::checkInline): Deleted.
3762         (WebCore::ContentSecurityPolicyDirectiveList::checkSource): Deleted.
3763         (WebCore::ContentSecurityPolicyDirectiveList::checkMediaType): Deleted.
3764         * page/csp/ContentSecurityPolicyDirectiveList.h:
3765         * page/csp/ContentSecurityPolicyHash.h: Added.
3766         (WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::hash): Compute the hash of a digest as
3767         we would compute the hash of a string.
3768         (WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::equal): Compare digests for equality
3769         by making use of Vector's equality operator.
3770         * page/csp/ContentSecurityPolicySourceList.cpp:
3771         (WebCore::ContentSecurityPolicySourceList::matches): Checks if the hash is in the set of known hashes.
3772         (WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseHashSource()
3773         to try to parse the source list expression as a hash source. If this fails then we try to parse the
3774         source expression as a scheme/host/port expression.
3775         (WebCore::parseHashAlgorithmAdvancingPosition): Parses the hash algorithm from a hash source expression.
3776         (WebCore::isBase64Character): Returns whether the specified character is a valid Base64/Base64url character,
3777         excluding the padding character '='. Disregarding the omission of the padding character '=', this function
3778         conforms to the ABNF grammar defined in section Source Lists of the Content Security Policy Level 3 spec.,
3779         <https://w3c.github.io/webappsec-csp> (Editor’s Draft, 29 February 2016). We take the padding character '='
3780         into account in ContentSecurityPolicySourceList::parseHashSource().
3781         (WebCore::ContentSecurityPolicySourceList::parseHashSource): Parses a hash source expression per the ABNF
3782         grammar described in section Source Lists of the Content Security Policy Level 3 spec.
3783         * page/csp/ContentSecurityPolicySourceList.h:
3784         (WebCore::ContentSecurityPolicySourceList::hashAlgorithmsUsed): Returns the set of hash algorithms seen from
3785         parsing the source list.
3786         (WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
3787         'unsafe-inline' was specified in the source list and the source list does not contain any hash sources.
3788         * page/csp/ContentSecurityPolicySourceListDirective.cpp:
3789         (WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified hash is in the source list.
3790         * page/csp/ContentSecurityPolicySourceListDirective.h:
3791         (WebCore::ContentSecurityPolicySourceListDirective::hashAlgorithmsUsed): Turns around and calls ContentSecurityPolicySourceList::hashAlgorithmsUsed().
3792         
3793
3794 2016-03-10  Chris Dumez  <cdumez@apple.com>
3795
3796         Speculative revalidation requests do not have their 'first party for cookies' URL set
3797         https://bugs.webkit.org/show_bug.cgi?id=155284
3798         <rdar://problem/25053203>
3799
3800         Reviewed by Antti Koivisto.
3801
3802         Export a few more symbols so they can be used in WebKit2.
3803
3804         * platform/URL.h:
3805         * platform/network/ResourceRequestBase.h:
3806
3807 2016-02-22  Jer Noble  <jer.noble@apple.com>
3808
3809         Enable AVFoundationNSURLSessionEnabled by default
3810         https://bugs.webkit.org/show_bug.cgi?id=154469
3811
3812         Reviewed by Sam Weinig.
3813
3814         * page/Settings.cpp:
3815
3816 2016-03-10  Frederic Wang  <fwang@igalia.com>
3817
3818         [GTK] Add support for WOFF2
3819         https://bugs.webkit.org/show_bug.cgi?id=152616
3820
3821         Reviewed by Carlos Garcia Campos.
3822
3823         No new tests (Covered by existing tests).
3824
3825         * CMakeLists.txt: Add woff2 source to the include directory and link WebCore against brotli and woff2.
3826         * platform/graphics/WOFFFileFormat.cpp:
3827         (WebCore::isWOFF): Recognize the signature of WOFF2 font.
3828         (WebCore::convertWOFFToSfnt): If the font has the WOFF2 signature, then try and decompress it using the woff2 library.
3829         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
3830         (WebCore::FontCustomPlatformData::supportsFormat): Add woff2 to the list of supported formats.
3831
3832 2016-03-10  Manuel Rego Casasnovas  <rego@igalia.com>
3833
3834         [css-grid] Fix placement for unknown named grid lines
3835         https://bugs.webkit.org/show_bug.cgi?id=155230
3836
3837         Reviewed by Sergio Villar Senin.
3838
3839         The spec has changed and now all the implicit lines should be considered
3840         when we're resolving named grid lines with an unknown name.
3841
3842         The relevant part of the spec is
3843         (http://dev.w3.org/csswg/css-grid/#line-placement):
3844         "If a name is given as a <custom-ident>, only lines with that name
3845          are counted. If not enough lines with that name exist,
3846          all implicit grid lines are assumed to have that name
3847          for the purpose of finding this position."
3848
3849         Modified the code to resolve named grid lines in GridResolvedPosition.
3850         We need to keep the old behavior of considering "auto" unknown named
3851         grid lines for the case of positioned grid items.
3852
3853         Test: fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution.html
3854
3855         * rendering/style/GridResolvedPosition.cpp:
3856         (WebCore::adjustGridPositionsFromStyle):
3857         (WebCore::lookAheadForNamedGridLine):
3858         (WebCore::lookBackForNamedGridLine):
3859         (WebCore::resolveNamedGridLinePositionFromStyle):
3860         (WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
3861         (WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
3862         (WebCore::resolveGridPositionAgainstOppositePosition):
3863         (WebCore::resolveGridPositionFromStyle):
3864
3865 2016-03-10  Eric Carlson  <eric.carlson@apple.com>
3866
3867         [MediaStream] push media stream state to the UI process
3868         https://bugs.webkit.org/show_bug.cgi?id=155281
3869
3870         Reviewed by Darin Adler.
3871
3872         * Modules/mediastream/MediaStream.cpp:
3873         (WebCore::MediaStream::MediaStream): Register with the document as an audio producer.
3874         (WebCore::MediaStream::~MediaStream): Unregister.
3875         (WebCore::MediaStream::setIsActive): Update document status.
3876         (WebCore::MediaStream::pageMutedStateDidChange): Mute/unmute according to the page mute setting.
3877         (WebCore::MediaStream::mediaState): Return state.
3878         (WebCore::MediaStream::statusDidChange): Call document.updateIsPlayingMedia.
3879         (WebCore::MediaStream::characteristicsChanged): Track stream mute state.
3880         (WebCore::MediaStream::scheduleActiveStateChange): m_isActive -> m_active.
3881         * Modules/mediastream/MediaStream.h:
3882
3883         * page/MediaProducer.h: Add HasActiveMediaCaptureDevice.
3884
3885         * platform/mediastream/MediaStreamPrivate.cpp:
3886         (WebCore::MediaStreamPrivate::hasVideo): Make const.
3887         (WebCore::MediaStreamPrivate::hasAudio): Ditto.
3888         (WebCore::MediaStreamPrivate::muted): New.
3889         * platform/mediastream/MediaStreamPrivate.h:
3890
3891         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3892         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Initialize muted to true.
3893         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange): Set muted.
3894
3895 2016-03-09  Ryosuke Niwa  <rniwa@webkit.org>
3896
3897         Extract EventPath.h/cpp out of EventDispatcher.cpp
3898         https://bugs.webkit.org/show_bug.cgi?id=155285
3899
3900         Reviewed by Chris Dumez.
3901
3902         Extracted EventPath.h/cpp out of EventDispatcher.cpp to add the support for Event.deepPath()
3903         in webkit.org/b/153538. The new file defines member functions of EventPath and RelatedNodeRetargeter.
3904
3905         * CMakeLists.txt:
3906         * WebCore.xcodeproj/project.pbxproj:
3907         * dom/DOMAllInOne.cpp:
3908         * dom/EventDispatcher.cpp:
3909         (WebCore::EventDispatcher::dispatchScopedEvent):
3910         (WebCore::EventDispatcher::dispatchEvent):
3911         (WebCore::EventPath): Moved to EventPath.cpp.
3912         (WebCore::eventTargetRespectingTargetRules): Moved to EventPath.h.
3913         (WebCore::shouldEventCrossShadowBoundary): Moved to EventPath.cpp.
3914         (WebCore::nodeOrHostIfPseudoElement): Ditto.
3915         (WebCore::RelatedNodeRetargeter): Moved to EventPath.cpp.
3916         * dom/EventPath.cpp: Added.
3917         (WebCore::shouldEventCrossShadowBoundary): Moved from EventDispatcher.cpp.
3918         (WebCore::nodeOrHostIfPseudoElement): Ditto.
3919         (WebCore::EventPath::EventPath): Ditto.
3920         (WebCore::RelatedNodeRetargeter): Ditto.
3921         * dom/EventPath.h: Added.
3922         (WebCore::EventPath::isEmpty):
3923         (WebCore::EventPath::size):
3924         (WebCore::EventPath::contextAt):
3925         (WebCore::EventPath::lastContextIfExists):
3926         (WebCore::EventPath::eventTargetRespectingTargetRules): Moved from EventDispatcher.cpp.
3927
3928 2016-03-09  Simon Fraser  <simon.fraser@apple.com>
3929
3930         Font antialiasing (smoothing) changes when elements are rendered into compositing layers
3931         https://bugs.webkit.org/show_bug.cgi?id=23364
3932         rdar://problem/7288429
3933
3934         Reviewed by Tim Horton.
3935
3936         Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
3937         by opting in to a new CALayer backing store format.
3938         
3939         GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
3940         when the platform has support for the new feature. Ideally this would only be set when
3941         we know a layer has smoothed text drawn into it, but, for now, enable this for all