Unreviewed attempt to fix Windows build after r182881.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2015-04-16  Chris Dumez  <cdumez@apple.com>
2
3         Unreviewed attempt to fix Windows build after r182881.
4
5         Add missing header include.
6
7         * page/PageConsoleClient.h:
8
9 2015-04-16  Chris Dumez  <cdumez@apple.com>
10
11         Tests introduced in r182877 are flaky
12         https://bugs.webkit.org/show_bug.cgi?id=143784
13
14         Reviewed by Alexey Proskuryakov.
15
16         Tests introduced in r182877 are flaky as the line number sometimes
17         appears in the console messages. This patch updates the console
18         logging code so that no Document is provided when logging. Therefore,
19         no line number will ever be displayed. In this case, I don't think
20         having the line number is terribly useful anyway.
21
22         * css/StyleSheetContents.cpp:
23         (WebCore::StyleSheetContents::parseAuthorStyleSheet):
24
25 2015-04-15  Simon Fraser  <simon.fraser@apple.com>
26
27         We should dump GraphicsLayer's anchorPoint z component
28         https://bugs.webkit.org/show_bug.cgi?id=143815
29
30         Reviewed by Tim Horton.
31
32         We didn't include the z component of a layer's anchor point when dumping.
33         Dump if it's non-zero (to avoid having to change lots of test output).
34         No test with non-zero z appears to dump layers.
35
36         * platform/graphics/GraphicsLayer.cpp:
37         (WebCore::GraphicsLayer::dumpProperties):
38         * rendering/style/RenderStyle.cpp:
39         (WebCore::requireTransformOrigin): Remove a FIXME which, on further consideration,
40         is wrong.
41
42 2015-04-15  Brent Fulgham  <bfulgham@apple.com>
43
44         [Mac] Disable "Save to Downloads" option for local files
45         https://bugs.webkit.org/show_bug.cgi?id=143794
46
47         Reviewed by Tim Horton.
48
49         Disable the Image and Media download options if the download
50         target is a local file. We can only download web resources;
51         anything else is actually a no-op.
52
53         * page/ContextMenuController.cpp:
54         (WebCore::ContextMenuController::checkOrEnableIfNeeded): Disable
55         menu item if appropriate.
56
57 2015-04-15  Chris Dumez  <cdumez@apple.com>
58
59         Add a console message when a stylesheet is not parsed due to invalid MIME type
60         https://bugs.webkit.org/show_bug.cgi?id=143784
61
62         Reviewed by Joseph Pecoraro.
63
64         After r180020, we no longer have a quirks mode exception for CSS MIME
65         types. This means that we'll start rejecting stylesheets that were
66         previously accepted due to this quirk. In this case we log a console
67         message to help Web developers understand why their stylesheet is being
68         rejected.
69
70         * css/StyleRuleImport.cpp:
71         (WebCore::StyleRuleImport::setCSSStyleSheet):
72
73         * css/StyleSheetContents.cpp:
74         (WebCore::StyleSheetContents::parseAuthorStyleSheet):
75         - Initialize hasValidMIMEType to true so that it ends up being false
76           only when canUseSheet(hasValidMIMEType) is called and we've determined
77           the MIME type is indeed invalid. Otherwise, hasValidMIMEType would
78           also be false when m_data is null or empty in
79           CachedCSSStyleSheet::sheetText() and we don't want to display the MIME
80           type error in this case.
81         - If hasValidMIMEType is false, display the console message and abort
82           early. We don't need to execute the rest of the function in this case
83           as sheetText is a null String and there is no point in trying to parse
84           it.
85         - Drop handling of !hasValidMIMEType && !hasSyntacticallyValidCSSHeader()
86           as this can no longer be reached. This handling no longer makes sense
87           after r180020 as sheetText() will now always return a null String if
88           the MIME type is invalid (as we no longer support the CSS MIME type
89           quirks mode).
90
91         * css/StyleSheetContents.h:
92         * html/HTMLLinkElement.cpp:
93         (WebCore::HTMLLinkElement::setCSSStyleSheet):
94
95 2015-04-15  Said Abou-Hallawa  <said@apple.com>
96
97         Minimum font size pref breaks SVG text very badly.
98         https://bugs.webkit.org/show_bug.cgi?id=143590.
99
100         Reviewed by Simon Fraser.
101
102         When enabling the minimum font size perf, the computed font size is set
103         to the minimum font size if the computed value is smaller than the minimum.
104         The bug happens because the SVG text element applies its scaling on the
105         computed value after applying the minimum fort size rule. This means the
106         final computed value for the font size will be the scaling of the minimum
107         font size and not minimum font size itself. What we need is to postpone
108         applying the minimum font size rules, till the SVG scaling is applied.
109
110         Tests: svg/text/font-small-enlarged-minimum-larger.svg
111                svg/text/font-small-enlarged-minimum-smaller.svg
112
113         * rendering/svg/RenderSVGInlineText.cpp:
114         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): Call
115         computedFontSizeFromSpecifiedSizeForSVGInlineText() even if scalingFactor
116         is 1. We need to make sure the minimum font size rules are applied. This
117         function was assuming the mininum font size rule was applied when resolving
118         the style. This is not true anymore for the SVG text.
119
120         * style/StyleFontSizeFunctions.cpp:
121         (WebCore::Style::computedFontSizeFromSpecifiedSize): Do not apply the
122         minimum size rules for the SVG element until it applies its scaling to
123         the font size.
124
125 2015-04-15  Mark Lam  <mark.lam@apple.com>
126
127         Remove obsolete VMInspector debugging tool.
128         https://bugs.webkit.org/show_bug.cgi?id=143798
129
130         Reviewed by Michael Saboff.
131
132         No new tests needed.  Just removing obsolete code.
133
134         * ForwardingHeaders/interpreter/VMInspector.h: Removed.
135
136 2015-04-15  Timothy Horton  <timothy_horton@apple.com>
137
138         Custom CSS cursors do not use -webkit-image-set on retina displays
139         https://bugs.webkit.org/show_bug.cgi?id=120783
140         <rdar://problem/14921432>
141
142         Reviewed by Beth Dakin.
143         Patch by Evan Wallace <evan.exe@gmail.com>.
144
145         Scale NSCursor images correctly so custom CSS cursors work with
146         -webkit-image-set on retina displays.
147
148         * WebCore.exp.in:
149         * page/EventHandler.cpp:
150         (WebCore::EventHandler::selectCursor):
151         * platform/mac/CursorMac.mm:
152         (WebCore::createCustomCursor):
153         (WebCore::Cursor::ensurePlatformCursor):
154
155 2015-04-15  Alexey Proskuryakov  <ap@apple.com>
156
157         No thread safety when passing ThreadableLoaderOptions from a worker thread
158         https://bugs.webkit.org/show_bug.cgi?id=143790
159
160         Reviewed by Geoffrey Garen.
161
162         * loader/ThreadableLoader.h:
163         * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::isolatedCopy): Added.
164
165         * loader/WorkerThreadableLoader.cpp:
166         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Don't just send
167         a structure with strings to a different thread, that's bad.
168
169         * platform/CrossThreadCopier.h: I think that this is dead code, but for this bug,
170         just removing a clearly wrong specialization.
171
172 2015-04-15  Alex Christensen  <achristensen@webkit.org>
173
174         Progress towards CMake on Mac.
175         https://bugs.webkit.org/show_bug.cgi?id=143785
176
177         Reviewed by Csaba Osztrogonác.
178
179         * CMakeLists.txt:
180         * PlatformMac.cmake:
181
182 2015-04-15  Daniel Bates  <dabates@apple.com>
183
184         Clean up: Have SVGTextLayoutEngine::beginTextPathLayout() take a reference to a
185         RenderSVGTextPath instead of a pointer
186         https://bugs.webkit.org/show_bug.cgi?id=143787
187
188         Reviewed by Andreas Kling.
189
190         SVGTextLayoutEngine::beginTextPathLayout() assumes that the passed RenderObject is a
191         non-null pointer to a RenderSVGTextPath object. Instead we should have this function take a
192         reference to a RenderSVGTextPath object to help callers catch bad usage and better document
193         the expectation of a valid RenderSVGTextPath object.
194
195         * rendering/svg/SVGRootInlineBox.cpp:
196         (WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes): Downcast the renderer of the
197         inline box to a RenderSVGTextPath object and pass it to SVGTextLayoutEngine::beginTextPathLayout().
198         We ensured that this cast is safe earlier in this function.
199         SVGTextLayoutEngine::beginTextPathLayout().
200         * rendering/svg/SVGTextLayoutEngine.cpp:
201         (WebCore::SVGTextLayoutEngine::beginTextPathLayout): Change type of first parameter from
202         RenderObject* to RenderSVGTextPath. Remove ASSERT() that was checking for a non-null
203         RenderObject pointer since we are passing the renderer by reference and a well-formed
204         reference must refer to a valid object.
205         * rendering/svg/SVGTextLayoutEngine.h: Substitute RenderSVGTextPath& for RenderObject*.
206
207 2015-04-13  Jer Noble  <jer.noble@apple.com>
208
209         [Fullscreen] ChromeClient::exitVideoFullscreen() should take a pointer to a HTMLVideoElement.
210         https://bugs.webkit.org/show_bug.cgi?id=143674
211
212         Reviewed by Darin Adler.
213
214         * html/HTMLMediaElement.cpp:
215         (WebCore::HTMLMediaElement::enterFullscreen): Pass a reference.
216         (WebCore::HTMLMediaElement::exitFullscreen): exitVideoFullscreen() -> exitVideoFullscreenForVideoElement(...).
217         * page/ChromeClient.h:
218
219 2015-04-14  Anders Carlsson  <andersca@apple.com>
220
221         Make creating send rights from shared memory more robust
222         https://bugs.webkit.org/show_bug.cgi?id=143730
223         rdar://problem/16595870
224
225         Reviewed by Darin Adler.
226
227         Add a bool conversion operator to MachSendRight and tidy up the default constructor.
228
229         * platform/cocoa/MachSendRight.h:
230         (WebCore::MachSendRight::operator bool):
231         (WebCore::MachSendRight::MachSendRight): Deleted.
232
233 2015-04-15  Eric Carlson  <eric.carlson@apple.com>
234
235         Generalize "isPlayingAudio" to include other media characteristics
236         https://bugs.webkit.org/show_bug.cgi?id=143713
237
238         Reviewed by Jer Noble.
239
240         No new functionality.
241
242         * Modules/webaudio/AudioContext.cpp:
243         (WebCore::AudioContext::stop): updateIsPlayingAudio -> updateIsPlayingMedia.
244         (WebCore::AudioContext::isPlayingAudioDidChange): Ditto.
245
246         * dom/Document.cpp:
247         (WebCore::Document::addAudioProducer): Ditto.
248         (WebCore::Document::removeAudioProducer): Ditto.
249         (WebCore::Document::updateIsPlayingMedia): Renamed.
250         (WebCore::Document::updateIsPlayingAudio): Deleted.
251         * dom/Document.h:
252
253         * html/HTMLMediaElement.cpp:
254         (WebCore::HTMLMediaElement::setMuted): updateIsPlayingAudio -> updateIsPlayingMedia.
255         (WebCore::HTMLMediaElement::setPlaying): Ditto.
256
257         * page/ChromeClient.h:
258         * page/Page.cpp:
259         (WebCore::Page::updateIsPlayingMedia): Renamed.
260         (WebCore::Page::updateIsPlayingAudio): Deleted.
261         * page/Page.h:
262
263 2015-04-15  Joonghun Park  <jh718.park@samsung.com>
264
265         Fix Debug build error 'comparison of unsigned expression >= 0 is always true [-Werror=type-limits]'
266         https://bugs.webkit.org/show_bug.cgi?id=143751
267
268         Reviewed by Csaba Osztrogonác.
269
270         No new tests, no new behaviors.
271
272         * rendering/svg/SVGTextChunk.cpp:
273         (WebCore::SVGTextChunk::SVGTextChunk):
274
275 2015-04-14  Zalan Bujtas  <zalan@apple.com>
276
277         Make inline continuation style change logic consistent.
278         https://bugs.webkit.org/show_bug.cgi?id=143737
279         rdar://problem/20486596
280
281         Reviewed by Simon Fraser.
282
283         Do not force RenderBlock type-casting on the first sibling of the continuation's container.
284         The first sibling of the container of a continuation should be handled as the rest of the siblings.
285
286         Test: fast/inline/inline-with-column-span-and-remove-block-child-crash.html
287
288         * rendering/RenderInline.cpp:
289         (WebCore::updateStyleOfAnonymousBlockContinuations):
290         (WebCore::RenderInline::styleDidChange):
291
292 2015-04-14  Chris Dumez  <cdumez@apple.com>
293
294         Regression(r180020): Web Inspector crashes on pages that have a stylesheet with an invalid MIME type
295         https://bugs.webkit.org/show_bug.cgi?id=143745
296         <rdar://problem/20243916>
297
298         Reviewed by Joseph Pecoraro.
299
300         After r180020, we are stricter and no longer accept CSS resources that
301         are not served with a CSS MIME type. Showing Web inspector on a page
302         with such bad resource would crash because
303         InspectorPageAgent::cachedResourceContent() would return true but
304         the result String would be null. This null String would then later
305         be passed to the Yarr interpreter and crash on a String::is8Bit()
306         call.
307
308         cachedResourceContent() calls CachedCSSStyleSheet::sheetText(). Before
309         r180020, it would return the text, even if the MIME type was incorrect.
310         However, this is no longer the case and we now need to make sure that
311         cachedResourceContent() returns false if sheetText() returns a null
312         String.
313
314         Test: http/tests/inspector/css/bad-mime-type.html
315
316         * inspector/InspectorPageAgent.cpp:
317         (WebCore::InspectorPageAgent::cachedResourceContent):
318
319 2015-04-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
320
321         textPath layout performance improvement.
322         https://bugs.webkit.org/show_bug.cgi?id=141570.
323
324         Reviewed by Darin Adler.
325
326         The bottleneck of the text-on-path performance is the position and angle
327         calculations for every single character. If the number of characters is
328         'n' and the number of path elements is 'm', the total number of processing
329         the path elements is O(2 x n x m). What makes it really worse is, for every
330         curve we keep splitting the curve till the split curve is almost a straight
331         line. The changes we need to do are:
332         1. Merge the position and the angle traversals in one pass since they are
333            returning info for the same length on the path. There is a degenerate
334            case for the starting point when calculating the angle. The original
335            code was solving this problem by passing an epsilon instead of zero but
336            because traversing the path for position and angle are now merged, we
337            will pass zero for the starting point as is. All we need is to move one
338            step ahead without moving the position. We need the extra step forward
339            to calculate the slope of the path at the starting point.
340         2. We need to add a new mode to traversing a path. The new mode will take
341            a vector of lengths and returns a vector of arrow vectors. Every arrow
342            vector represents a position and an angle on the path at a certain length.
343            This requires changing the SVGTextLayoutEngine to calculate the lengths
344            of the characters on the curve first and then passing all of them to the
345            path traversal function. Instead of traversing the path for every length,
346            we are going to get the required point and angle from the vector of arrow
347            vectors.
348
349         This patch is addressing the first fix only. The second one will require
350         refactoring the SVGTextLayoutEngine so I am going to address it in a
351         different patch.
352
353         * platform/graphics/Path.cpp:
354         (WebCore::pathLengthApplierFunction): It is cleaner to move the function
355         of this method to PathTraversalState::processPathElement().
356         
357         (WebCore::Path::length): Use new enum Action value and access methods.
358         
359         (WebCore::Path::traversalStateAtLength): New function which returns the
360         traversalState at a certain length on a path.
361         
362         (WebCore::Path::pointAtLength):
363         (WebCore::Path::normalAngleAtLength): Use traversalStateAtLength() to get
364         the traversalState and from it return either the position or the angle.
365         
366         * platform/graphics/Path.h: Define traversalStateAtLength().
367         
368         * platform/graphics/PathTraversalState.cpp:
369         (WebCore::distanceLine): Code clean up.
370         
371         (WebCore::curveLength): Make the setting of m_previous and m_current happens
372         only in this function.
373         
374         (WebCore::PathTraversalState::PathTraversalState): Add an optional parameter
375         for the desired length and move the initialization of the other members to
376         the class definition.
377         
378         (WebCore::PathTraversalState::closeSubpath):
379         (WebCore::PathTraversalState::moveTo):
380         (WebCore::PathTraversalState::lineTo): Add the distance to the m_totalLength
381         instead of returning it since this is what all the callers were doing.
382         
383         (WebCore::PathTraversalState::quadraticBezierTo):
384         (WebCore::PathTraversalState::cubicBezierTo): Add the distance to the
385         m_totalLength. Move the setting of m_previous and m_current to curveLength().
386         Remove unused members m_control1 and m_control2.
387
388         (WebCore::PathTraversalState::processSegment): Deleted.        
389         (WebCore::PathTraversalState::finalizeAppendPathElement): Create a new
390         name for the function. Handle the case of the angle at the starting point
391         where m_desiredLength is set to zero. The new flag m_isZeroVector will be
392         set to notify the caller that the  next iteration will be the last one and
393         it is only needed for the calculating the angle of a zero vector. m_current
394         should not change by this last iteration.
395         
396         (WebCore::PathTraversalState::appendPathElement): This code is moved from
397         pathLengthApplierFunction().
398         
399         (WebCore::PathTraversalState::processPathElement): This function is used
400         by the class Path. It is a wrapper for appendPathElement(). If m_isZeroVector
401         is set we append the new element to a copy for the PathTraversalState just
402         to get the angle for the zero vector.
403
404         * platform/graphics/PathTraversalState.h: Change the enum values to not
405         not include the class or the enum class. Make the data members private and
406         expose the needed ones through access methods. Make all the internal methods
407         to be private.
408         
409         (WebCore::PathTraversalState::processPathElement):  Another wrapper for
410         appendPathElement() which is used by SVGPathTraversalStateBuilder.
411         
412         (WebCore::PathTraversalState::action):
413         (WebCore::PathTraversalState::setAction):
414         (WebCore::PathTraversalState::desiredLength):
415         (WebCore::PathTraversalState::setDesiredLength):
416         (WebCore::PathTraversalState::success):
417         (WebCore::PathTraversalState::totalLength):
418         (WebCore::PathTraversalState::current):
419         (WebCore::PathTraversalState::normalAngle): New access methods which are now
420         needed after making the data members private.
421         
422         * rendering/svg/SVGRootInlineBox.cpp:
423         (WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes): Make the casting
424         of the renderer on the caller side.
425         
426         * rendering/svg/SVGTextChunk.cpp:
427         (WebCore::SVGTextChunk::SVGTextChunk): The constructor should append the
428         elements of m_boxes instead of making this from outside the class.
429         
430         (WebCore::SVGTextChunk::totalCharacters):
431         (WebCore::SVGTextChunk::totalLength):
432         (WebCore::SVGTextChunk::calculateLength): Deleted.
433         Replace calculateLength() by totalCharacters() and totalLength() to make
434         the interface cleaner.
435         
436         (WebCore::SVGTextChunk::totalAnchorShift):
437         (WebCore::SVGTextChunk::calculateTextAnchorShift): Deleted.
438         Rename the function name.
439         
440         (WebCore::SVGTextChunk::layout):
441         (WebCore::SVGTextChunk::processTextLengthSpacingCorrection):
442         (WebCore::SVGTextChunk::buildBoxTransformations):
443         (WebCore::SVGTextChunk::boxSpacingAndGlyphsTransform):
444         (WebCore::SVGTextChunk::processTextAnchorCorrection):
445         Move the chunk layout code from SVGTextChunkBuilder::layoutTextChunks()
446         to the SVGTextChunk::layout(). Move all the helper functions as well.
447         
448         * rendering/svg/SVGTextChunk.h:
449         (WebCore::SVGTextChunk::hasTextAnchor):
450         (WebCore::SVGTextChunk::boxes): Deleted.
451         Add the new methods and change most of the public methods to be private.
452         
453         * rendering/svg/SVGTextChunkBuilder.cpp:
454         (WebCore::SVGTextChunkBuilder::totalCharacters):
455         (WebCore::SVGTextChunkBuilder::totalLength):
456         (WebCore::SVGTextChunkBuilder::totalAnchorShift): This code is moved from
457         SVGTextLayoutEngine. It scans the boxes stored in the SVGTextChunkBuilder
458         and sums up the total values.
459         
460         (WebCore::SVGTextChunkBuilder::transformationForTextBox):
461         (WebCore::SVGTextChunkBuilder::buildTextChunks):
462         (WebCore::SVGTextChunkBuilder::layoutTextChunks): Code clean up.
463         
464         (WebCore::SVGTextChunkBuilder::addTextChunk): Deleted.
465         (WebCore::SVGTextChunkBuilder::processTextChunk): Deleted.
466         (WebCore::SVGTextChunkBuilder::processTextLengthSpacingCorrection): Deleted.
467         (WebCore::SVGTextChunkBuilder::processTextAnchorCorrection): Deleted.
468         (WebCore::SVGTextChunkBuilder::buildSpacingAndGlyphsTransform): Deleted.
469         This code now lives in SVGTextChunk.
470         
471         * rendering/svg/SVGTextChunkBuilder.h: Add new methods for code which was
472         moved from SVGTextLayoutEngine and remove methods for code which was removed
473         to SVGTextChunk.
474         
475         * rendering/svg/SVGTextLayoutEngine.cpp:
476         (WebCore::SVGTextLayoutEngine::beginTextPathLayout): Use the sum up methods
477         from SVGTextChunkBuilder instead of looping through the chunks. Also get a
478         clean order for defining variables and doing the calculations.
479         
480         (WebCore::SVGTextLayoutEngine::finalizeTransformMatrices): Code clean up.
481         
482         (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): Do a single path
483         traversal to get the position and the angle for a length on a path.
484         
485         * svg/SVGAnimateMotionElement.cpp:
486         (WebCore::SVGAnimateMotionElement::buildTransformForProgress): Do a single
487         path traversal to get the position and the angle at a length on a path.
488         
489         * svg/SVGPathTraversalStateBuilder.cpp:
490         (WebCore::SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder):
491         (WebCore::SVGPathTraversalStateBuilder::moveTo):
492         (WebCore::SVGPathTraversalStateBuilder::lineTo):
493         (WebCore::SVGPathTraversalStateBuilder::curveToCubic):
494         (WebCore::SVGPathTraversalStateBuilder::closePath):
495         (WebCore::SVGPathTraversalStateBuilder::setDesiredLength):
496         (WebCore::SVGPathTraversalStateBuilder::continueConsuming):
497         (WebCore::SVGPathTraversalStateBuilder::totalLength):
498         (WebCore::SVGPathTraversalStateBuilder::currentPoint):
499         (WebCore::SVGPathTraversalStateBuilder::incrementPathSegmentCount): Deleted.
500         (WebCore::SVGPathTraversalStateBuilder::pathSegmentIndex): Deleted.
501         * svg/SVGPathTraversalStateBuilder.h:
502         (WebCore::SVGPathTraversalStateBuilder::pathSegmentIndex):
503         Code clean up.
504         
505         * svg/SVGPathUtilities.cpp:
506         (WebCore::getSVGPathSegAtLengthFromSVGPathByteStream):
507         (WebCore::getTotalLengthOfSVGPathByteStream):
508         (WebCore::getPointAtLengthOfSVGPathByteStream): Use new TraversalState::Action
509         enum values.
510
511 2015-04-14  Simon Fraser  <simon.fraser@apple.com>
512
513         Re-enable custom dilation for antialiased fonts
514         https://bugs.webkit.org/show_bug.cgi?id=143738
515
516         Reviewed by Tim Horton.
517         
518         Enabling custom dilation for antialised fonts broke layout tests, so re-land it,
519         but disable in WebKitTestRunner and DumpRenderTree. The latter requires adding
520         a private WebKit pref. This pref defaults to YES, enabling the feature by default
521         in WK1 as we do for WK2.
522
523         * platform/graphics/cocoa/FontCascadeCocoa.mm:
524         (WebCore::dilationSizeForTextColor):
525         (WebCore::FontCascade::drawGlyphs):
526
527 2015-04-14  Andy Estes  <aestes@apple.com>
528
529         [Content Filtering] Use ASSERT_WITH_SECURITY_IMPLICATION for verifying types from NEFilterSource
530         https://bugs.webkit.org/show_bug.cgi?id=143742
531
532         Reviewed by David Kilzer.
533
534         * platform/cocoa/NetworkExtensionContentFilter.mm:
535         (replacementDataFromDecisionInfo): ASSERT_WITH_SECURITY_IMPLICATION that decisionInfo is really a NSDictionary.
536         (WebCore::NetworkExtensionContentFilter::handleDecision): ASSERT_WITH_SECURITY_IMPLICATION that replacementData is really a NSData.
537
538 2015-04-14  Brent Fulgham  <bfulgham@apple.com>
539
540         Correct layering violation in DumpRenderTree Build
541         https://bugs.webkit.org/show_bug.cgi?id=143732
542
543         Reviewed by Simon Fraser.
544
545         * testing/js/WebCoreTestSupport.cpp:
546         (WebCoreTestSupport::monitorWheelEvents): Added. Provides a wrapper around
547         the internal WebCore objects needed to implement this function.
548         (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Ditto.
549         * testing/js/WebCoreTestSupport.h:
550
551 2015-04-14  Brady Eidson  <beidson@apple.com>
552
553         Make sure media element loads hit content filter extensions.
554         <rdar://problem/20014012> and https://bugs.webkit.org/show_bug.cgi?id=143731
555
556         Reviewed by Jer Noble.
557
558         Tests: http/tests/contentextensions/media-filtered.html
559                http/tests/contentextensions/text-track-blocked.html
560
561         * html/HTMLMediaElement.cpp:
562         (WebCore::HTMLMediaElement::parseAttribute): Skip loads that are filtered.
563
564 2015-04-14  Brian Weinstein  <bweinstein@apple.com>
565
566         Add SPI to clear HSTS hosts added since a date.
567         https://bugs.webkit.org/show_bug.cgi?id=143726
568         and
569         rdar://problem/16664597
570
571         Declare _CFNetworkResetHSTSHostsSinceDate in CFNetworkSPI.h.
572
573         Reviewed by Anders Carlsson.
574
575         * platform/spi/cf/CFNetworkSPI.h:
576
577 2015-04-14  Roger Fong  <roger_fong@apple.com>
578
579         Unreviewed. Time numbers on media controls move as they update on OSX.
580         <rdar://problem/20141790>.
581
582         * Modules/mediacontrols/mediaControlsApple.css:
583         (audio::-webkit-media-controls-current-time-display):
584         (audio::-webkit-media-controls-time-remaining-display):
585         Don't bother justifying content to end. We size the box to fit the time displays exactly anyways.
586
587 2015-04-14  Roger Fong  <roger_fong@apple.com>
588
589         Insert volume control in correct place after exiting wireless play.
590         https://bugs.webkit.org/show_bug.cgi?id=143721.
591         <rdar://problem/20526106>
592
593         Reviewed by Darin Adler.
594
595         * Modules/mediacontrols/mediaControlsApple.js:
596         (Controller.prototype.updateWirelessPlaybackStatus):
597
598 2015-04-14  Brady Eidson  <beidson@apple.com>
599
600         Media elements not in a page shouldn't load.
601         https://bugs.webkit.org/show_bug.cgi?id=143720
602
603         Reviewed by Jer Noble.
604
605         No new tests (Theoretical problem noticed in code review).
606
607         * html/HTMLMediaElement.cpp:
608         (WebCore::HTMLMediaElement::loadResource): Make sure the frame is in a page.
609
610 2015-04-14  Simon Fraser  <simon.fraser@apple.com>
611
612         [iOS] Clean up registration of layers with the ScrollingCoordinator
613         https://bugs.webkit.org/show_bug.cgi?id=143725
614
615         Reviewed by Tim Horton.
616
617         Simplify a couple of bits of code related to the registration of layers with
618         the ScrollingCoordinator in RenderLayerCompositor.
619
620         First, RenderLayerBacking was using ScrollingNodeTypes to choose which scrolling
621         roles a layer has, which let to ambiguous code where we hardcoded a ScrollingNodeType
622         with knowledge of what RenderLayerBacking did with it. Clean up by using LayerScrollCoordinationRole,
623         which is moved to RenderLayer.h so that RenderLayerCompositor.h and RenderLayerBacking.h
624         both see it.
625
626         Secondly, avoid having both detachFromScrollingCoordinator() and detachFromScrollingCoordinatorForRole()
627         by passing in the bitmask of roles.
628
629         * page/FrameView.cpp:
630         (WebCore::FrameView::scrollLayerID):
631         * rendering/RenderLayer.h:
632         * rendering/RenderLayerBacking.cpp:
633         (WebCore::RenderLayerBacking::~RenderLayerBacking):
634         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
635         (WebCore::RenderLayerBacking::detachFromScrollingCoordinatorForRole): Deleted.
636         * rendering/RenderLayerBacking.h:
637         * rendering/RenderLayerCompositor.cpp:
638         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
639         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
640         (WebCore::scrollCoordinationRoleForNodeType):
641         (WebCore::RenderLayerCompositor::attachScrollingNode):
642         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
643         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
644         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
645         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerForRole): Deleted.
646         * rendering/RenderLayerCompositor.h:
647
648 2015-04-14  Benjamin Poulain  <benjamin@webkit.org>
649
650         Add a conservative DFA minimizer for the content extension matcher
651         https://bugs.webkit.org/show_bug.cgi?id=143501
652
653         Reviewed by Alex Christensen.
654
655         This patch adds a simple minimizer for DFA graphs. It is not a perfect minimizer:
656         some indistinguishable are not merged, but no two distinguishable are merged.
657
658         The general idea of the algorithm is to put all the state into a single set
659         and partition iteratively until it is impossible to split any subset by using
660         a transition to distinguish two states.
661
662         Let's ignore fallback transition for now, and I'll explain later how they fit in
663         the big picture.
664
665
666         The first thing we do is create a partition of the transition by grouping every
667         transition by the same character in the same subset. This partition of transitions
668         is the base by which we will partition the states.
669
670         Each subset in the transition partition is a "distinguisher" by which we can
671         separate the state partition.
672
673         We also create a second partition, the state partition. This is where we keep
674         all the subsets of states that have been split so far.
675
676         Let say we have the following graph.
677
678             1 --a--> 2
679             1 --b--> 3
680             2 --c--> 4 (final)
681             3 --c--> 4 (final)
682
683         The partition of transition would start with:
684         Set 0:
685             1 --a--> 2
686         Set 1:
687             1 --b--> 3
688         Set 2:
689             2 --c--> 4
690             3 --c--> 4
691
692         The state partition would have a single set with { 1, 2, 3, 4 }.
693
694
695         Next, we split the state partition by distinguishable final states. In this case,
696         we would split it into { 1, 2, 3 }, { 4 }.
697
698         We then refine the transition partition by splitting it by the states that have
699         been distinguished. Here, the only transitions to 4 are both is the same set (set 2),
700         so the transition partition remains the same.
701
702
703         We can now execute the main loop of the algorithm:
704         1) Split the states by the transitions.
705         2) Split the transitions that are now reaching two different sets of the state partition.
706         3) Add any newly discovered "distinguisher" (the ones we split) to the list of "distinguisher"
707            to process.
708
709         In this case, we just iterate over the partition set in order, and add newly split transitions
710         to the end of the list.
711
712         In the example, we would first visit set 0. We have that state 1 is distinguishable
713         by "a", and the state partition would become { 1 }, { 2, 3 }, { 4 }.
714
715         We then visit transition set 1, it distinguishes state 1 which is already alone -> nothing to do.
716
717         Finally, we process the transition set 2, it distinguishes 2 and 3, they are already in the same
718         set -> nothing to do.
719
720         There is no more transition to process, we have 3 unique subsets and we should merge 2 and 3.
721
722         ---
723
724         Okay, now how to we fit fallback transition in this model. In this patch, I take the conservative
725         approach: we split everything assuming fallback transition do not exist, then we refine
726         by the fallback transitions.
727
728         Let's take the following example:
729             1 --a--> 3
730             2 --a--> 3
731             1 -[f]-> 4
732             2 -[f]-> 5
733
734         and at this stage in the algorithm, we have the sets { 1, 2 }, { 3 }, { 4 }, { 5 }.
735         The states 1 and 2 are together because they cannot be distinguished by 'a', but
736         the fallback transition distinguishes them.
737
738         Since we have done every other split, we have one useful property: we know that every
739         state in every set transition with the exact set of characters within that set.
740         If that was not true, there would be one "distinguisher" 'x' that could spit the set
741         into two subsets: the one with the transition 'x' and the ones without.
742
743         Since all the transitions are the same, there is no overlap between the defined transition
744         and the fallback transition. Consequently, we can use the fallback transition as a whole
745         transition and use it to distinguish the states.
746
747         The fallback transitions are handled like any other transition, we have a partition of such
748         transitions and split by each of them. BUT, we can only use them after every unique transition
749         has been covered.
750
751         This trick is also what makes the minimization imperfect: it should be possible to merge
752         states with overlap in their fallback transitions but we would split them.
753
754         ---
755
756         Antti Valmari, Petri Lehtinen, Marie-Pierre Béal and Maxime Crochemore deserve credit for their indirect
757         work on this patch. Thanks for your wonderful papers about DFA minimization.
758
759         * WebCore.xcodeproj/project.pbxproj:
760         * contentextensions/ContentExtensionCompiler.cpp:
761         (WebCore::ContentExtensions::compileRuleList):
762         * contentextensions/DFA.cpp:
763         (WebCore::ContentExtensions::DFA::minimize):
764         (WebCore::ContentExtensions::DFA::debugPrintDot):
765         * contentextensions/DFA.h:
766         * contentextensions/DFABytecodeCompiler.cpp:
767         (WebCore::ContentExtensions::DFABytecodeCompiler::compileNode):
768         * contentextensions/DFAMinimizer.cpp: Added.
769         (WebCore::ContentExtensions::DFAMinimizer::simplifyTransitions):
770         (WebCore::ContentExtensions::DFAMinimizer::Partition::initialize):
771         (WebCore::ContentExtensions::DFAMinimizer::Partition::markElementInCurrentGeneration):
772         (WebCore::ContentExtensions::DFAMinimizer::Partition::refineGeneration):
773         (WebCore::ContentExtensions::DFAMinimizer::Partition::iterateSet):
774         (WebCore::ContentExtensions::DFAMinimizer::Partition::setIndex):
775         (WebCore::ContentExtensions::DFAMinimizer::Partition::firstElementInSet):
776         (WebCore::ContentExtensions::DFAMinimizer::Partition::size):
777         (WebCore::ContentExtensions::DFAMinimizer::Partition::SetDescriptor::indexAfterMarkedElements):
778         (WebCore::ContentExtensions::DFAMinimizer::Partition::SetDescriptor::end):
779         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::FullGraphPartition):
780         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::markNode):
781         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::refinePartitions):
782         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::splitByUniqueTransitions):
783         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::splitByFallbackTransitions):
784         (WebCore::ContentExtensions::DFAMinimizer::FullGraphPartition::nodeReplacement):
785         (WebCore::ContentExtensions::DFAMinimizer::ActionKey::ActionKey):
786         (WebCore::ContentExtensions::DFAMinimizer::ActionKey::isEmptyValue):
787         (WebCore::ContentExtensions::DFAMinimizer::ActionKey::isDeletedValue):
788         (WebCore::ContentExtensions::DFAMinimizer::ActionKeyHash::hash):
789         (WebCore::ContentExtensions::DFAMinimizer::ActionKeyHash::equal):
790         (WebCore::ContentExtensions::DFAMinimizer::minimize):
791         * contentextensions/DFAMinimizer.h: Copied from Source/WebCore/contentextensions/DFA.h.
792         * contentextensions/DFANode.h:
793         * contentextensions/NFAToDFA.cpp:
794         (WebCore::ContentExtensions::NFAToDFA::convert):
795         (WebCore::ContentExtensions::simplifyTransitions): Deleted.
796
797 2015-04-14  Chris Dumez  <cdumez@apple.com>
798
799         ASSERT(frame().view() == this) assertion hit in FrameView::windowClipRect() on Windows bots
800         https://bugs.webkit.org/show_bug.cgi?id=143723
801
802         Reviewed by Brent Fulgham.
803
804         ASSERT(frame().view() == this) in FrameView::windowClipRect() can be hit
805         if the post layout timer timer fires after the page has entered page
806         cache. Upon entering page cache, we call FrameView::unscheduleRelayout()
807         to stop the layout timer if it is active, however, we don't stop the
808         post-layout timer. Therefore, there was nothing preventing the
809         post-layout timer from firing after entering page cache.
810
811         In this patch, we unschedule the post-layout timer in
812         FrameView::unscheduleRelayout() to protect ourselves against this.
813
814         I think we were only seeing the assertion hit on Windows because this
815         timer probably gets scheduled more frequently on Windows. On Mac, I
816         rarely see it getting scheduled.
817
818         No new tests, should fix crashing tests on the bots.
819
820         * page/FrameView.cpp:
821         (WebCore::FrameView::unscheduleRelayout):
822
823 2015-04-14  Chris Dumez  <cdumez@apple.com>
824
825         FrameView::m_frame should be a Ref<Frame>
826         https://bugs.webkit.org/show_bug.cgi?id=143716
827
828         Reviewed by Andreas Kling.
829
830         FrameView::m_frame should be a Ref<Frame> instead of a RefPtr<Frame> as
831         it can never be null.
832
833         * page/FrameView.cpp:
834         (WebCore::FrameView::FrameView):
835         (WebCore::FrameView::flushCompositingStateForThisFrame):
836         (WebCore::FrameView::hasCompositedContentIncludingDescendants):
837         (WebCore::FrameView::flushCompositingStateIncludingSubframes):
838         (WebCore::FrameView::updateCanBlitOnScrollRecursively):
839         (WebCore::FrameView::setIsOverlapped):
840         (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling):
841         (WebCore::FrameView::renderedCharactersExceed):
842         (WebCore::FrameView::updateLayerFlushThrottling):
843         (WebCore::FrameView::serviceScriptedAnimations):
844         (WebCore::FrameView::updateBackgroundRecursively):
845         (WebCore::FrameView::adjustScrollStepForFixedContent):
846         (WebCore::FrameView::paintContentsForSnapshot):
847         (WebCore::FrameView::notifyWidgetsInAllFrames):
848         (WebCore::FrameView::setExposedRect):
849         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
850         * page/FrameView.h:
851
852 2015-04-13  Simon Fraser  <simon.fraser@apple.com>
853
854         [iOS WK2] Interactive elements of developer.apple.com are broken
855         https://bugs.webkit.org/show_bug.cgi?id=143692
856         rdar://problem/19320087
857
858         Reviewed by Sam Weinig.
859         
860         When a composited RenderLayer had nodes in the scrolling tree by virtue of
861         both position and overflow:scroll, and one of those reasons disappeared,
862         we'd fail to remove the corresponding node from the scrolling tree. This
863         could leave an overflow:scroll element behaving as if it were position:fixed.
864         
865         Fix by having RenderLayerCompositor::updateScrollCoordinationForThisFrame()
866         detach the layer on a per-role basis.
867
868         Test: platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html
869
870         * rendering/RenderLayerBacking.cpp:
871         (WebCore::RenderLayerBacking::detachFromScrollingCoordinatorForRole):
872         * rendering/RenderLayerBacking.h:
873         * rendering/RenderLayerCompositor.cpp:
874         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerForRole):
875         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer): Just moved.
876         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Call detachScrollCoordinatedLayerForRole()
877         if the layer doesn't have the relevant scrolling reasons.
878         * rendering/RenderLayerCompositor.h:
879
880 2015-04-14  Commit Queue  <commit-queue@webkit.org>
881
882         Unreviewed, rolling out r182794.
883         https://bugs.webkit.org/show_bug.cgi?id=143714
884
885         readable-stream-templated.html fails on Debug bots (Requested
886         by youenn on #webkit).
887
888         Reverted changeset:
889
890         "[Streams API] ReadableStream constructor start function
891         should be able to close the stream"
892         https://bugs.webkit.org/show_bug.cgi?id=143363
893         http://trac.webkit.org/changeset/182794
894
895 2015-04-14  Per Arne Vollan  <peavo@outlook.com>
896
897         [WinCairo] Unreviewed build fix after r182707.
898
899         * platform/network/curl/MultipartHandle.cpp:
900         (WebCore::MultipartHandle::didReceiveResponse):
901
902 2015-04-14  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
903
904         [Streams API] ReadableStream constructor start function should be able to close the stream
905         https://bugs.webkit.org/show_bug.cgi?id=143363
906
907         Reviewed by Benjamin Poulain.
908
909         Implements https://streams.spec.whatwg.org/#close-readable-stream.
910         When the "close" JS function is called, the stream is getting closed.
911         The stream state is changed to close and if it has a reader, the reader gets closed as well:
912         The reader resolves the closed promise and release the stream.
913
914         Enabled the possibility to resolve a promise with any JS value.
915         This is used to resolve closed promise with jsUndefined and will be used for read promises.
916
917         Covered by reference tests that are now passing.
918
919         * Modules/streams/ReadableStream.cpp:
920         (WebCore::ReadableStream::changeStateToClosed): Called by the JS function 'close'.
921         * Modules/streams/ReadableStream.h:
922         * Modules/streams/ReadableStreamReader.cpp:
923         (WebCore::ReadableStreamReader::ReadableStreamReader):
924         (WebCore::ReadableStreamReader::initialize): Added to handle state change at constructor time (in particular closed/errored state).
925         (WebCore::ReadableStreamReader::releaseStream):
926         (WebCore::ReadableStreamReader::closed): Storing the closed promise callbacks.
927         (WebCore::ReadableStreamReader::changeStateToClosed): Resolution of closed promise.
928         * Modules/streams/ReadableStreamReader.h:
929         * bindings/js/JSDOMPromise.h:
930         (WebCore::DeferredWrapper::resolve<JSC::JSValue>):
931         * bindings/js/JSReadableStreamReaderCustom.cpp:
932         (WebCore::JSReadableStreamReader::closed):
933         * bindings/js/ReadableStreamJSSource.cpp:
934         (WebCore::readableStreamSlotName):
935         (WebCore::getReadableJSStream): Helper function to retrieve the stream from the exec state.
936         (WebCore::closeReadableStreamFunction):
937         (WebCore::createReadableStreamCloseFunction):
938         (WebCore::createReadableStreamController):
939         (WebCore::ReadableStreamJSSource::start):
940         (WebCore::ReadableJSStreamReader::ReadableJSStreamReader): Deleted.
941
942 2015-04-13  Joonghun Park  <jh718.park@samsung.com>
943
944         Use modern for-loops in Document
945         https://bugs.webkit.org/show_bug.cgi?id=143600
946
947         Reviewed by Darin Adler.
948
949         No new tests, no behavior changes.
950
951         * dom/Document.cpp:
952         (WebCore::Document::visibilityStateChanged):
953         (WebCore::Document::processBaseElement):
954         (WebCore::Document::moveNodeIteratorsToNewDocument):
955         (WebCore::Document::updateRangesAfterChildrenChanged):
956         (WebCore::Document::nodeChildrenWillBeRemoved):
957         (WebCore::Document::nodeWillBeRemoved):
958         (WebCore::Document::textInserted):
959         (WebCore::Document::textRemoved):
960         (WebCore::Document::textNodesMerged):
961         (WebCore::Document::textNodeSplit):
962         (WebCore::Document::documentWillSuspendForPageCache):
963         (WebCore::Document::documentDidResumeFromPageCache):
964         (WebCore::Document::mediaVolumeDidChange):
965         (WebCore::Document::privateBrowsingStateDidChange):
966         (WebCore::Document::captionPreferencesChanged):
967         (WebCore::Document::validateAutoSizingNodes):
968         (WebCore::Document::resetAutoSizingNodes):
969         (WebCore::Document::webkitExitFullscreen):
970         (WebCore::Document::absoluteRegionForEventTargets):
971
972 2015-04-13  Manuel Rego Casasnovas  <rego@igalia.com>
973
974         [CSS Grid Layout] Columns set in percentages collapse to auto width
975         https://bugs.webkit.org/show_bug.cgi?id=141435
976
977         Reviewed by David Hyatt.
978
979         Based on a patch by Sergio Villar Senin  <svillar@igalia.com>.
980
981         This patch adds 2 new new methods in RenderBox to determine if the grid
982         has a definite size or not.
983
984         RenderGrid::gridTrackSize() was not checking properly if the grid has or
985         not an indefinite size.
986         The condition was including auto which is not indefinite per se. For
987         example, auto is definite if the containing block is definite.
988         As the new method is more expensive, we just call it when it's really
989         needed to avoid performance regressions.
990
991         Finally we were setting the override logical width/height to -1 (no
992         possible resolution) for all the items regardless if they've a relative
993         width/height or a fixed one.
994         Added the condition, including not only items with percentage logical
995         width/height but also relative, to avoid overriding the value for items
996         with fixed width/height as it's not needed.
997
998         Tests: fast/css-grid-layout/grid-item-with-percent-height-in-auto-height-grid-resolution.html
999                fast/css-grid-layout/percent-intrinsic-track-breadth.html
1000                fast/css-grid-layout/percent-track-breadths-regarding-container-size.html
1001
1002         * rendering/RenderBox.cpp:
1003         (WebCore::logicalWidthIsResolvable):
1004         (WebCore::RenderBox::hasDefiniteLogicalWidth):
1005         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
1006         (WebCore::RenderBox::hasRelativeLogicalWidth):
1007         * rendering/RenderBox.h:
1008         * rendering/RenderGrid.cpp:
1009         (WebCore::RenderGrid::hasDefiniteLogicalSize):
1010         (WebCore::RenderGrid::gridTrackSize):
1011         (WebCore::RenderGrid::logicalContentHeightForChild):
1012         (WebCore::RenderGrid::minContentForChild):
1013         (WebCore::RenderGrid::maxContentForChild):
1014         * rendering/RenderGrid.h:
1015
1016 2015-04-13  Chris Dumez  <cdumez@apple.com>
1017
1018         Regression: Scrolling on popsci.com spends too much time in FrameView::viewportsContentsChanged()
1019         https://bugs.webkit.org/show_bug.cgi?id=143675
1020
1021         Reviewed by Simon Fraser.
1022
1023         Optimize resumeVisibleImageAnimationsIncludingSubframes() so that the FrameViews'
1024         windowClipRect gets computed less often:
1025         - Cache the FrameView's windowClipRect before resuming image animations in subframes
1026           as calling windowClipRect() on those subframes' view is going to call windowClipRect()
1027           on their ancestors. This avoids a lot of unnecessary windowClipRect recomputations
1028           in deep frame trees.
1029         - Stop traversing the Frame tree if the current frame does not have a content
1030           renderer, as this means the subframes won't have one either.
1031         - Stop traversing the Frame tree if the current frame's view has an empty
1032           windowClipRect() as this means the windowClipRect will be empty for those
1033           subframes as well.
1034
1035         On popsci.com, this cuts down the number of uncached windowClipRect() calls by
1036         approximately half. I see viewportsContentsChanged() at ~0.4% when scrolling
1037         on popsci.com after this change.
1038
1039         * page/FrameView.cpp:
1040         (WebCore::FrameView::resumeVisibleImageAnimationsIncludingSubframes):
1041         (WebCore::FrameView::windowClipRect):
1042         * page/FrameView.h:
1043         * rendering/RenderView.cpp:
1044         (WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
1045         * rendering/RenderView.h:
1046
1047 2015-04-13  Roger Fong  <roger_fong@apple.com>
1048
1049         Unreviewed. Set the title text of the placard added in r182631.
1050         https://bugs.webkit.org/show_bug.cgi?id=143585.
1051         <rdar://problem/12067439>
1052
1053         * Modules/mediacontrols/mediaControlsApple.js:
1054         (Controller.prototype.updateWirelessPlaybackStatus):
1055
1056 2015-04-10  Brent Fulgham  <bfulgham@apple.com>
1057
1058         Expand test infrastructure to support scrolling tests
1059         https://bugs.webkit.org/show_bug.cgi?id=143286
1060         <rdar://problem/20375516>
1061
1062         Reviewed by Simon Fraser.
1063
1064         No new functionality.
1065
1066         This series of changes adds a new singleton class, 'WheelEventTestTrigger', which encapsulates a
1067         function object to be fired when scroll events are finished. The object also keeps track of reasons
1068         why the test should not yet fire (e.g., 'rubberbanding' is active) so that tests do not incorrectly
1069         check rendering state in the middle of an animation.
1070
1071         This code is not yet hooked up to the rendering system, and so does not have any effect on behavior.
1072
1073         * CMakeLists.txt: Add new WheelEventTestTrigger files.
1074         * WebCore.vcxproj/WebCore.vcxproj: Ditto.
1075         * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
1076         * WebCore.xcodeproj/project.pbxproj: Ditto.
1077         * page/MainFrame.cpp:
1078         (WebCore::MainFrame::MainFrame): Add new member to constructor.
1079         (WebCore::MainFrame::testTrigger): Added.
1080         (WebCore::MainFrame::ensureTestTrigger): Added.
1081         (WebCore::MainFrame::clearTrigger): Added.
1082         * page/MainFrame.h:
1083         * page/WheelEventTestTrigger.cpp: Added.
1084         (WebCore::WheelEventTestTrigger::WheelEventTestTrigger):
1085         (WebCore::WheelEventTestTrigger::createWeakPtr):
1086         (WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
1087         (WebCore::WheelEventTestTrigger::setTestNotificationCallback):
1088         (WebCore::WheelEventTestTrigger::deferTestsForReason):
1089         (WebCore::WheelEventTestTrigger::removeTestDeferralForReason):
1090         (WebCore::WheelEventTestTrigger::triggerTestTimerFired):
1091         * page/WheelEventTestTrigger.h: Added.
1092
1093 2015-04-13  Jer Noble  <jer.noble@apple.com>
1094
1095         [iOS] When entering optimized fullscreen, standard fullscreen view should exit.
1096         https://bugs.webkit.org/show_bug.cgi?id=143615
1097
1098         Reviewed by Simon Fraser.
1099
1100         When entering optimized fullscreen from standard fullscreen, the original fullscreen
1101         view should animate out.
1102
1103         The original method for entering optimized fullscreen is deprecated, so replace it with
1104         the new method (which doesn't take completion blocks) and use delegate methods to detect
1105         when the animation transition completes.
1106
1107         * platform/Logging.h:
1108         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1109         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1110         (boolString): Added; use for logging boolean parameters.
1111         (-[WebAVPlayerController playerViewControllerWillStartOptimizedFullscreen:]): Pass to WebVideoFullscreenInterfaceAVKit.
1112         (-[WebAVPlayerController playerViewControllerDidStartOptimizedFullscreen:]): Ditto.
1113         (-[WebAVPlayerController playerViewControllerWillStopOptimizedFullscreen:]): Ditto.
1114         (-[WebAVPlayerController playerViewControllerDidStopOptimizedFullscreen:]): Ditto.
1115         (-[WebAVPlayerController playerViewControllerWillCancelOptimizedFullscreen:]): Ditto.
1116         (-[WebAVPlayerController playerViewControllerDidCancelOptimizedFullscreen:]): Ditto.
1117         (-[WebAVPlayerController playerViewController:restoreUserInterfaceForOptimizedFullscreenStopWithCompletionHandler:]): Ditto.
1118         (-[WebAVVideoLayer setPlayerViewController:]): Remove the KVO registration; now handled by above delegate methods.
1119         (WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal): Add logging.
1120         (WebVideoFullscreenInterfaceAVKit::enterFullscreen): Ditto.
1121         (WebVideoFullscreenInterfaceAVKit::enterFullscreenOptimized): Use new -startOptimizedFullscreen method.
1122         (WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard): Add logging.
1123         (WebVideoFullscreenInterfaceAVKit::exitFullscreenInternal): Ditto.
1124         (WebVideoFullscreenInterfaceAVKit::cleanupFullscreenInternal): Use hasMode() & isMode() rather than checking m_mode directly.
1125         (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): Ditto.
1126         (WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline): Callback now stored on this object rather than the WebAVPlayerController.
1127         (WebVideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoOptimized): Moved.
1128         (WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline): Added; store the passed callback.
1129         (WebVideoFullscreenInterfaceAVKit::willStartOptimizedFullscreen): Exit out of standard fullscreen mode if necessary.
1130         (WebVideoFullscreenInterfaceAVKit::didStartOptimizedFullscreen): Moved from the start lambda in enterFullscreenOptimized().
1131         (WebVideoFullscreenInterfaceAVKit::willStopOptimizedFullscreen): Call the model's requestExitFullscreen() method.
1132         (WebVideoFullscreenInterfaceAVKit::didStopOptimizedFullscreen): Moved from the stop lambda in enterFullscreenOptimized().
1133         (WebVideoFullscreenInterfaceAVKit::willCancelOptimizedFullscreen): Call the model's requestExitFullscreen() method.
1134         (WebVideoFullscreenInterfaceAVKit::didCancelOptimizedFullscreen): Moved from the stop lambda in enterFullscreenOptimized().
1135         (WebVideoFullscreenInterfaceAVKit::prepareForOptimizedFullscreenStopWithCompletionHandler): Moved from -playerViewController:shouldExitFullScreenWithReason:.
1136         (WebVideoFullscreenInterfaceAVKit::setMode): Added; Call fullscreenModeChanged() if necessary.
1137         (WebVideoFullscreenInterfaceAVKit::clearMode): Ditto.
1138         (-[WebAVVideoLayer observeValueForKeyPath:ofObject:change:context:]): Deleted.
1139         (WebVideoFullscreenInterfaceAVKit::setIsOptimized): Deleted.
1140
1141 2015-04-13  Brent Fulgham  <bfulgham@apple.com>
1142
1143         [Win] Unreviewed fix after r182757.
1144
1145         * platform/win/FileSystemWin.cpp:
1146         (WebCore::renameFile): Checked in wrong version.
1147
1148 2015-04-13  Brent Fulgham  <bfulgham@apple.com>
1149
1150         [Win] Unreviewed fix after r182161.
1151
1152         The change caused Windows to lose Media UI, since the new 'getFileSize'
1153         signature was being improperly used for a 'UInt8'-based string.
1154
1155         Fix was to provide implementations for the two new methods, and to make
1156         sure RenderThemeWin was using the proper signature.
1157
1158         This should actually be a little more efficient, since we have the file
1159         handle when we call this new method. Previously, a Windows 'find file' was
1160         being done with the requested path, which was unnecessary work.
1161
1162         * platform/win/FileSystemWin.cpp:
1163         (WebCore::getFileSizeFromByHandleFileInformationStructure): Added helper function.
1164         (WebCore::getFileSize): Provide implementation.
1165         (WebCore::renameFile):
1166         * rendering/RenderThemeWin.cpp:
1167         (WebCore::RenderThemeWin::stringWithContentsOfFile): Use the file handle to
1168         get the file size, rather than using the path-based size lookup (which involves
1169         performing an unnecessary file search.
1170
1171 2015-04-13  Brady Eidson  <beidson@apple.com>
1172
1173         Share sheets from Share menus appear outside the browser window.
1174         <rdar://problem/20455592> and https://bugs.webkit.org/show_bug.cgi?id=143620
1175
1176         Reviewed by Darin Adler.
1177
1178         * page/ContextMenuController.h:
1179         (WebCore::ContextMenuController::client):
1180
1181 2015-04-13  Andreas Kling  <akling@apple.com>
1182
1183         Rebaseline bindings tests.
1184
1185         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1186         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1187         * bindings/scripts/test/JS/JSTestEventTarget.h:
1188         * bindings/scripts/test/JS/JSTestException.h:
1189         * bindings/scripts/test/JS/JSTestInterface.h:
1190         * bindings/scripts/test/JS/JSTestObj.h:
1191         * bindings/scripts/test/JS/JSTestTypedefs.h:
1192
1193 2015-04-13  Jer Noble  <jer.noble@apple.com>
1194
1195         [iOS] Treat a 'not found' media option index as the 'off' track.
1196         https://bugs.webkit.org/show_bug.cgi?id=143672
1197
1198         Reviewed by Eric Carlson.
1199
1200         The UIProcess will pass in UINT64_MAX for the index of the legible option to select. Treat this
1201         as if the captionOffMenuItem() had been selected to avoid a null dereference.
1202
1203         * platform/ios/WebVideoFullscreenModelVideoElement.mm:
1204         (WebVideoFullscreenModelVideoElement::selectLegibleMediaOption):
1205
1206 2015-04-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1207
1208         list-style-image with SVG image renders at incorrect size.
1209         https://bugs.webkit.org/show_bug.cgi?id=141367.
1210
1211         Reviewed by Darin Adler.
1212         
1213         This patch imports https://codereview.chromium.org/197203003.
1214
1215         When using an SVG as list marker image, don't unconditionally set the
1216         dimensions to a square with the dimensions of ascent / 2, but rather
1217         determine a suitable size using intrinsic dimensions (and ratio).
1218
1219         Test: svg/as-list-image/svg-list-image-intrinsic-size-1.html
1220
1221         * rendering/RenderListMarker.cpp:
1222         (WebCore::RenderListMarker::updateContent):
1223
1224 2015-04-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1225
1226         Canvas drawImage() has a security hole when the image isn't yet fully loaded.
1227         https://bugs.webkit.org/show_bug.cgi?id=58681.
1228
1229         Reviewed by Darin Adler.
1230
1231         There is a race condition which may happen if an image from a different
1232         origin is drawn on a canvas before it finishes loading. The check to taint
1233         the canvas comes before drawing it. This check returns false if the image
1234         is not completely loaded because we check the URL of the resource response.
1235         If after this check and before the drawing, the image finishes loading, the
1236         canvas will not be tainted but the image will be drawn.
1237         
1238         The fix is to move the check to taint the canvas after drawing the image.
1239         The only problem with this solution is basically the opposite of this bug:
1240         we will become stricter than before with images which are from a different
1241         origin and before they finish loading. The image has not finished loading,
1242         so we do not draw it. Before we check for tainting, the image finishes
1243         loading. So we decide to taint the canvas even the image is not drawn.
1244         
1245         But this should not be a security issue anymore. I personally do not know
1246         if it is even a correctness issue or not.
1247
1248         Test: http/tests/canvas/canvas-tainted-after-draw-image.html
1249
1250         * html/canvas/CanvasRenderingContext2D.cpp:
1251         (WebCore::CanvasRenderingContext2D::drawImage):
1252
1253 2015-04-13  Beth Dakin  <bdakin@apple.com>
1254
1255         Add force property to MouseEvents
1256         https://bugs.webkit.org/show_bug.cgi?id=143569
1257         -and corresponding-
1258         rdar://problem/20472954
1259
1260         Reviewed by Darin Adler.
1261
1262         This patch removes WebKitMouseForceEvent and uses a MouseEvent everywhere that it 
1263         was used. That’s possible because this patch also adds a force property to all 
1264         MouseEvents and to PlatformMouseEvent.
1265
1266         Remove WebKitMouseForceEvent.
1267         * CMakeLists.txt:
1268         * DerivedSources.cpp:
1269         * DerivedSources.make:
1270         * WebCore.vcxproj/WebCore.vcxproj:
1271         * WebCore.vcxproj/WebCore.vcxproj.filters:
1272         * WebCore.xcodeproj/project.pbxproj:
1273         * dom/DOMAllInOne.cpp:
1274
1275         Create MouseEvents with the appropriate force instead of WebKitMouseForceEvents. 
1276         This patch also gets rid of the PlatformMouseEvent parameter for these events. 
1277         They were re-using the cached mousedown event before, which they never should have 
1278         done. Instead, we create PlatformMouseEvents inside these functions and then use 
1279         that to make MouseEvents.
1280         * dom/Element.cpp:
1281         (WebCore::Element::dispatchMouseForceWillBegin):
1282         (WebCore::Element::dispatchMouseForceChanged):
1283         (WebCore::Element::dispatchMouseForceDown):
1284         (WebCore::Element::dispatchMouseForceUp):
1285         (WebCore::Element::dispatchMouseForceClick):
1286         (WebCore::Element::dispatchMouseForceCancelled):
1287         * dom/Element.h:
1288
1289         No More WebKitMouseForceEvent.
1290         * dom/EventNames.in:
1291
1292         Add force to MouseEvent.
1293         * dom/MouseEvent.cpp:
1294         (WebCore::MouseEvent::create):
1295         (WebCore::MouseEvent::MouseEvent):
1296         (WebCore::MouseEvent::cloneFor):
1297         (WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
1298         * dom/MouseEvent.h:
1299         (WebCore::MouseEvent::force):
1300         (WebCore::MouseEvent::setForce):
1301         * dom/MouseEvent.idl:
1302
1303         No More WebKitMouseForceEvent.
1304         * dom/WebKitMouseForceEvent.cpp: Removed.
1305         * dom/WebKitMouseForceEvent.h: Removed.
1306         * dom/WebKitMouseForceEvent.idl: Removed.
1307
1308         PlatformMouseEvent now takes a force parameter.
1309         * dom/WheelEvent.cpp:
1310         (WebCore::WheelEvent::WheelEvent):
1311         * page/ContextMenuController.cpp:
1312         (WebCore::ContextMenuController::showContextMenuAt):
1313         * page/DragController.cpp:
1314         (WebCore::createMouseEvent):
1315         * page/EventHandler.cpp:
1316         (WebCore::EventHandler::dispatchDragEvent):
1317         (WebCore::EventHandler::sendContextMenuEventForKey):
1318         (WebCore::EventHandler::fakeMouseMoveEventTimerFired):
1319
1320         We don’t need lastMouseDownEvent() anymore. We were using it to avoid creating new 
1321         PlatformMouseEvents for the force events, but we fix that in this patch.
1322         (WebCore::EventHandler::lastMouseDownEvent): Deleted.
1323         * page/EventHandler.h:
1324
1325         At force to PlatformMouseEvent.
1326         * platform/PlatformMouseEvent.h:
1327         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
1328         (WebCore::PlatformMouseEvent::force):
1329         * replay/SerializationMethods.cpp:
1330         (JSC::EncodingTraits<PlatformMouseEvent>::encodeValue):
1331         (JSC::EncodingTraits<PlatformMouseEvent>::decodeValue):
1332
1333 2015-04-13  Andreas Kling  <akling@apple.com>
1334
1335         Don't segregate heap objects based on Structure immortality.
1336         <https://webkit.org/b/143638>
1337
1338         Reviewed by Darin Adler.
1339
1340         * bindings/js/JSDOMBinding.h:
1341         * bindings/scripts/CodeGeneratorJS.pm:
1342         (GenerateHeader):
1343         (GeneratePrototypeDeclaration):
1344         * bridge/objc/objc_runtime.h:
1345         * bridge/runtime_array.h:
1346         * bridge/runtime_method.h:
1347         * bridge/runtime_object.h:
1348
1349 2015-04-13  Simon Fraser  <simon.fraser@apple.com>
1350
1351         Fixed position element is truncated if moved onscreen by a transform
1352         https://bugs.webkit.org/show_bug.cgi?id=143655
1353         rdar://problem/15020044
1354
1355         Reviewed by Darin Adler.
1356         
1357         Our "don't do layout if transform changes" code was too aggressive.
1358         If an element changes between having a transform and not having one, we
1359         really need to do a layout since so much else depends on transforms. In
1360         this particular case, we clip position:fixed elements to the viewport if
1361         they are not transformed, and were failing to re-evaluate this when a
1362         transform was added. Doing a layout fixes this.
1363
1364         Test: compositing/geometry/fixed-transformed.html
1365
1366         * rendering/style/RenderStyle.cpp:
1367         (WebCore::RenderStyle::changeRequiresLayout):
1368         * rendering/style/StyleTransformData.h:
1369         (WebCore::StyleTransformData::hasTransform):
1370
1371 2015-04-12  Darin Adler  <darin@apple.com>
1372
1373         [Cocoa] Localizable strings are inconsistent and need to be regenerated
1374         https://bugs.webkit.org/show_bug.cgi?id=143661
1375         rdar://problem/19634388
1376
1377         Reviewed by Dan Bernstein.
1378
1379         * English.lproj/Localizable.strings: Updated by running the
1380         update-webkit-localizable-strings script.
1381
1382 2015-04-13  Darin Adler  <darin@apple.com>
1383
1384         Remove needless recreation of URL in NavigationScheduler::scheduleLocationChange
1385         https://bugs.webkit.org/show_bug.cgi?id=143662
1386
1387         Reviewed by Sam Weinig.
1388
1389         * loader/NavigationScheduler.cpp:
1390         (WebCore::NavigationScheduler::scheduleLocationChange): Removed unnecessary code
1391         to convert a URL to a String and then back into a URL.
1392
1393 2015-04-13  Csaba Osztrogonác  <ossy@webkit.org>
1394
1395         [cmake] Add ENABLE(ATTACHMENT_ELEMENT) to the build system
1396         https://bugs.webkit.org/show_bug.cgi?id=143664
1397
1398         Reviewed by Gyuyoung Kim.
1399
1400         * page/efl/DragControllerEfl.cpp:
1401         (WebCore::DragController::declareAndWriteAttachment): Added stub implementation to fix the build.
1402         * page/gtk/DragControllerGtk.cpp:
1403         (WebCore::DragController::declareAndWriteAttachment): Added stub implementation to fix the build.
1404
1405 2015-04-13  Sungmann Cho  <sungmann.cho@navercorp.com>
1406
1407         [Curl] Small improvements to CurlCacheEntry::parseResponseHeaders()
1408         https://bugs.webkit.org/show_bug.cgi?id=143597
1409
1410         Reviewed by Csaba Osztrogonác.
1411
1412         Most lines of code in CurlCacheEntry::parseResponseHeaders() don't need to be
1413         executed if the response has "no-cache" or "no-store" directive, but we are
1414         checking these conditions in the middle of the method. We can move this to the
1415         beginning of the method for efficiency.
1416
1417         No new tests, no behavior change.
1418
1419         * platform/network/curl/CurlCacheEntry.cpp:
1420         (WebCore::CurlCacheEntry::parseResponseHeaders):
1421
1422 2015-04-13  Sergio Villar Senin  <svillar@igalia.com>
1423
1424         Unreviewed, build fix after r182704.
1425
1426         * rendering/RenderGrid.cpp:
1427         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
1428
1429 2015-04-13  Joonghun Park  <jh718.park@samsung.com>
1430
1431         Use std::unique_ptr instead of PassOwnPtr|OwnPtr for ResourceResponse
1432         https://bugs.webkit.org/show_bug.cgi?id=143056
1433
1434         Reviewed by Gyuyoung Kim.
1435
1436         No new tests, no behavior changes.
1437
1438         * loader/WorkerThreadableLoader.cpp:
1439         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1440         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1441         * platform/CrossThreadCopier.h:
1442         * platform/network/ResourceResponseBase.cpp:
1443         (WebCore::ResourceResponseBase::adopt):
1444         (WebCore::ResourceResponseBase::copyData):
1445         * platform/network/ResourceResponseBase.h:
1446         * platform/network/cf/ResourceResponse.h:
1447         (WebCore::ResourceResponse::doPlatformCopyData):
1448         (WebCore::ResourceResponse::doPlatformAdopt):
1449         * platform/network/curl/ResourceResponse.h:
1450         (WebCore::ResourceResponse::doPlatformCopyData):
1451         (WebCore::ResourceResponse::doPlatformAdopt):
1452         * platform/network/soup/ResourceResponse.h:
1453         (WebCore::ResourceResponse::doPlatformCopyData):
1454         (WebCore::ResourceResponse::doPlatformAdopt):
1455
1456 2015-04-10  Sergio Villar Senin  <svillar@igalia.com>
1457
1458         [CSS Grid Layout] Support marking/unmarking tracks as infinitely growable
1459         https://bugs.webkit.org/show_bug.cgi?id=141431
1460
1461         Reviewed by Darin Adler.
1462
1463         As explained here
1464         http://lists.w3.org/Archives/Public/www-style/2014Mar/0512.html we
1465         sometimes need to consider that some tracks are infinitely
1466         growable even when they are really not, in order to produce more
1467         "natural" results.
1468
1469         For example the following case:
1470           grid-template-columns: auto auto;
1471           item 1 in column 1 with min-content = max-content = 10px;
1472           item 2 in columns 1-2 with min-content = 30, max-content = 100px;
1473
1474         will produce (45px, 55px) without this patch. But considering the
1475         second column as infinitely growable the result is (10px, 90px), a
1476         more "natural" result because column 1 just needs to be 10px to
1477         accommodate item 1. From now on we can flag GridTracks so that
1478         they can infinitely grow even when the growth limit is finite.
1479
1480         Apart from that distributeSpaceToTracks() is now unconditionally
1481         called even though the extra space is 0. That's because it
1482         computes the plannedSize value.
1483
1484         Test: fast/css-grid-layout/mark-as-infinitely-growable.html
1485
1486         * rendering/RenderGrid.cpp:
1487         (WebCore::GridTrack::infiniteGrowthPotential):
1488         (WebCore::GridTrack::infinitelyGrowable):
1489         (WebCore::GridTrack::setInfinitelyGrowable):
1490         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
1491         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Updated with new phase.
1492         (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Ditto.
1493         (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Ditto.
1494         (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Ditto.
1495         (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Ditto.
1496         (WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase):
1497         New helper method which does the mark/unmark just for growth limits.
1498         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
1499         (WebCore::sortByGridTrackGrowthPotential): Use
1500         infiniteGrowthPotential() for sorting.
1501         (WebCore::RenderGrid::distributeSpaceToTracks):
1502         * rendering/RenderGrid.h:
1503
1504 2015-04-12  Benjamin Poulain  <benjamin@webkit.org>
1505
1506         Legacy scroll behavior on HTMLBodyElement should only apply to the first body element of a document
1507         https://bugs.webkit.org/show_bug.cgi?id=143651
1508
1509         Reviewed by Sam Weinig.
1510
1511         WebKit has some very weird behaviors for the scroll methods on body. This patch
1512         address the first bug: only the first body element should have the legacy behavior.
1513
1514         The relevant text in spec:
1515         -http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
1516         -http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
1517         -http://dev.w3.org/csswg/cssom-view/#dom-element-scrollwidth
1518         -http://dev.w3.org/csswg/cssom-view/#dom-element-scrollheight
1519
1520         Tests: fast/dom/Element/body-scrollHeight-basics-quirks.html
1521                fast/dom/Element/body-scrollLeft-basics-quirks.html
1522                fast/dom/Element/body-scrollTop-basics-quirks.html
1523                fast/dom/Element/body-scrollWidth-basics-quirks.html
1524                fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollLeft.html
1525                fast/dom/Element/detached-body-element-does-not-scroll-main-frame-with-scrollTop.html
1526
1527         * html/HTMLBodyElement.cpp:
1528         (WebCore::HTMLBodyElement::isFirstBodyElementOfDocument):
1529         (WebCore::HTMLBodyElement::scrollLeft):
1530         (WebCore::HTMLBodyElement::setScrollLeft):
1531         (WebCore::HTMLBodyElement::scrollTop):
1532         (WebCore::HTMLBodyElement::setScrollTop):
1533         (WebCore::HTMLBodyElement::scrollHeight):
1534         (WebCore::HTMLBodyElement::scrollWidth):
1535         * html/HTMLBodyElement.h:
1536
1537 2015-04-12  Sungmann Cho  <sungmann.cho@navercorp.com>
1538
1539         Fix trival typos related to the word "coordinate".
1540         https://bugs.webkit.org/show_bug.cgi?id=143644
1541
1542         Reviewed by Alexey Proskuryakov.
1543
1544         No new tests, no behavior change.
1545
1546         * rendering/RenderBox.cpp:
1547         (WebCore::RenderBox::layoutOverflowRectForPropagation):
1548
1549 2015-04-12  Simon Fraser  <simon.fraser@apple.com>
1550
1551         Scrollbars in composited overflow and iframes fail to render on Mac
1552         https://bugs.webkit.org/show_bug.cgi?id=143647
1553         rdar://problem/20340544
1554
1555         Reviewed by Darin Adler.
1556
1557         When adding support for drawing scrollbars on the scrolling thread, we inadvertently
1558         disabled scrollbar drawing in other composited, main-thread scrolling configurations.
1559         
1560         Fix by having Scrollbar::supportsUpdateOnSecondaryThread() only return true if
1561         the scrollable area is using async scrolling.
1562         
1563         Sadly, we can't layout-test this.
1564
1565         * platform/Scrollbar.cpp:
1566         (WebCore::Scrollbar::supportsUpdateOnSecondaryThread):
1567
1568 2015-04-12  Simon Fraser  <simon.fraser@apple.com>
1569
1570         Selects don't scroll at some aspect ratios
1571         https://bugs.webkit.org/show_bug.cgi?id=143649
1572         rdar://problem/19365694
1573
1574         Reviewed by Darin Adler.
1575         
1576         Fix width/height flip in RenderListBox which caused us to fail to scroll when
1577         the list was wider than the scroll height.
1578         
1579         We're generally confused about RenderListBox scroll offsets (webkit.org/b/143648)
1580         but this fixes the immediate problem.
1581
1582         Test: fast/forms/listbox-visible-size.html
1583
1584         * rendering/RenderListBox.h:
1585
1586 2015-04-12  Simon Fraser  <simon.fraser@apple.com>
1587
1588         Too much repainting on scrolling with fixed backgrounds
1589         https://bugs.webkit.org/show_bug.cgi?id=143637
1590         rdar://problem/20245243
1591
1592         Reviewed by Darin Adler.
1593         
1594         FrameView::scrollContentsSlowPath() would repaint the entire viewport if there were
1595         any slow-repaint objects (those with background-attachment: fixed) and the contents
1596         were using compositing for scrolling.
1597         
1598         This is wrong; we only need to issue repaint for the slow-repaint renderers,
1599         and, if the frame is hosted in a compositing layer and not using compositing for scrolling,
1600         repaint that hosting layer.
1601
1602         Tests: compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html
1603                compositing/repaint/iframes/compositing-iframe-scroll-repaint.html
1604                compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html
1605                platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html
1606
1607         * page/FrameView.cpp:
1608         (WebCore::FrameView::scrollContentsSlowPath):
1609
1610 2015-04-11  Matt Baker  <mattbaker@apple.com>
1611
1612         Web Inspector: create content view and details sidebar for Frames timeline
1613         https://bugs.webkit.org/show_bug.cgi?id=143533
1614
1615         Reviewed by Timothy Hatcher.
1616
1617         Refactoring: RunLoop prefix changed to RenderingFrame.
1618
1619         * inspector/InspectorTimelineAgent.cpp:
1620         (WebCore::InspectorTimelineAgent::internalStart):
1621         (WebCore::toProtocol):
1622         * inspector/InspectorTimelineAgent.h:
1623
1624 2015-04-11  Chris Dumez  <cdumez@apple.com>
1625
1626         Stop referring to outdated RFC2616 in CacheValidation.cpp
1627         https://bugs.webkit.org/show_bug.cgi?id=143619
1628
1629         Reviewed by Darin Adler.
1630
1631         Stop referring to outdated RFC2616 in CacheValidation.cpp and refer to
1632         the newer RFC7230 & RFC7234. Also update some variables to match the
1633         naming in the RFC for clarity.
1634
1635         No behavior change.
1636
1637         * platform/network/CacheValidation.cpp:
1638         (WebCore::updateResponseHeadersAfterRevalidation):
1639         (WebCore::computeCurrentAge):
1640         (WebCore::computeFreshnessLifetimeForHTTPFamily):
1641         (WebCore::isCacheHeaderSeparator):
1642         (WebCore::parseCacheControlDirectives):
1643
1644 2015-04-11  Ryosuke Niwa  <rniwa@webkit.org>
1645
1646         WebKit places caret in front of pasted Numbers cells instead of behind
1647         https://bugs.webkit.org/show_bug.cgi?id=143627
1648
1649         Reviewed by Darin Adler.
1650
1651         The bug was caused by Position::downstream not respecting modern position types inside a table.
1652         Fixed it by using Position::atStartOfNode which respects before/after positions.
1653
1654         This bug doesn't reproduce when there is no whitespace after td element in the pasted content
1655         because positionAtEndOfInsertedContent() will be inside the last pasted cell inside
1656         ReplaceSelectionCommand::completeHTMLReplacement in those cases. This related but separate bug
1657         is tracked in https://webkit.org/b/143628.
1658
1659         Tests: editing/pasteboard/paste-table-with-unrendered-text-nodes.html
1660
1661         * dom/Position.cpp:
1662         (WebCore::Position::downstream):
1663
1664 2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1665
1666         [ES6] Enable Symbol in web pages
1667         https://bugs.webkit.org/show_bug.cgi?id=143375
1668
1669         Reviewed by Ryosuke Niwa.
1670
1671         * inspector/InspectorFrontendClientLocal.cpp:
1672         (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
1673
1674 2015-04-10  Roger Fong  <roger_fong@apple.com>
1675
1676         Hide volume controls when playing wirelessly.
1677         https://bugs.webkit.org/show_bug.cgi?id=143621.
1678         <rdar://problem/20490673>
1679
1680         Reviewed by Darin Adler.
1681
1682         * Modules/mediacontrols/mediaControlsApple.js:
1683         (Controller.prototype.updateWirelessPlaybackStatus):
1684
1685 2015-04-10  Alexey Proskuryakov  <ap@apple.com>
1686
1687         Build fix.
1688
1689         * WebCore.xcodeproj/project.pbxproj: Make LaunchServicesSPI.h a private header
1690         instead of project, as it's used in WebKit.
1691
1692 2015-04-08  Sam Weinig  <sam@webkit.org>
1693
1694         Allow LaunchServices to handle URLs on link navigations
1695         <rdar://problem/19446826>
1696         https://bugs.webkit.org/show_bug.cgi?id=143544
1697
1698         Reviewed by Anders Carlsson.
1699
1700         * WebCore.xcodeproj/project.pbxproj:
1701         * platform/spi/ios/LaunchServicesSPI.h: Added.
1702         Add new SPI header.
1703
1704 2015-04-10  Bem Jones-Bey  <bjonesbe@adobe.com>
1705
1706         Unreviewed, added CSS Shapes to features.json file.
1707
1708         * features.json:
1709
1710 2015-04-10  Andy Estes  <aestes@apple.com>
1711
1712         [Content Filtering] Support modifying request URLs
1713         https://bugs.webkit.org/show_bug.cgi?id=143599
1714         rdar://problem/20442560
1715
1716         Reviewed by Darin Adler.
1717
1718         Tests: contentfiltering/modify-request-url.html
1719                http/tests/contentfiltering/modify-redirect-request-url.html
1720
1721         Allow NEFilterSource to modifiy request URLs. Also teach MockContentFilter to do the same for testing.
1722
1723         * platform/cocoa/NetworkExtensionContentFilter.mm:
1724         (WebCore::NetworkExtensionContentFilter::willSendRequest): If NEFilterSource provided a string representing a
1725         valid URL in decisionInfo[NEFilterSourceOptionsRedirectURL], then used that as the request URL.
1726         * platform/spi/cocoa/NEFilterSourceSPI.h: Temporarily defined NEFilterSourceOptionsRedirectURL.
1727         * testing/MockContentFilter.cpp:
1728         (WebCore::MockContentFilter::willSendRequest): If settings() has a valid modifiedRequestURL, use it as the
1729         request URL. Only do so once MockContentFilter has reached its decision point so that both initial requests and
1730         redirect requests can be tested.
1731         * testing/MockContentFilterSettings.h: Added modifiedRequestURL.
1732         (WebCore::MockContentFilterSettings::modifiedRequestURL): Ditto.
1733         (WebCore::MockContentFilterSettings::setModifiedRequestURL): Ditto.
1734         * testing/MockContentFilterSettings.idl: Ditto.
1735
1736 2015-04-10  Zalan Bujtas  <zalan@apple.com>
1737
1738         showRenderTree: Include the render object to the inlinebox output.
1739         https://bugs.webkit.org/show_bug.cgi?id=143610
1740
1741         This helps to match the inlinebox and its renderer.
1742
1743         Reviewed by Antti Koivisto.
1744
1745         * rendering/InlineBox.cpp:
1746         (WebCore::InlineBox::showLineBox):
1747
1748 2015-04-09  Roger Fong  <roger_fong@apple.com>
1749
1750         Update wireless player placard for OSX.
1751         https://bugs.webkit.org/show_bug.cgi?id=143585.
1752         <rdar://problem/12067439>
1753
1754         Reviewed by Eric Carlson.
1755
1756         * Modules/mediacontrols/mediaControlsApple.css:
1757         Adjust button positioning and svg.
1758         (audio::-webkit-media-controls-wireless-playback-picker-button):
1759         (audio::-webkit-media-controls-wireless-playback-picker-button.playing):
1760         Style the wireless playback status placard, small and big versions.
1761         (audio::-webkit-media-controls-wireless-playback-status):
1762         (audio::-webkit-media-controls-wireless-playback-text):
1763         (audio::-webkit-media-controls-wireless-playback-text-top):
1764         (audio::-webkit-media-controls-wireless-playback-text-bottom):
1765         (audio::-webkit-media-controls-wireless-playback-status.small):
1766         (audio::-webkit-media-controls-wireless-playback-text-top.small):
1767         (audio::-webkit-media-controls-wireless-playback-text-bottom.small):
1768         * Modules/mediacontrols/mediaControlsApple.js:
1769         Add new wireless player placard elements.
1770         (Controller.prototype.createControls):
1771         (Controller.prototype.configureInlineControls):
1772         Make sure to switch between small and big placards when switching between fullscreen and small videos.
1773         (Controller.prototype.configureFullScreenControls):
1774         (Controller.prototype.handleFullscreenChange):
1775         (Controller.prototype.updateWirelessPlaybackStatus):
1776
1777 2015-04-10  Eric Carlson  <eric.carlson@apple.com>
1778
1779         [Mac] Refactor MediaPlaybackTarget
1780         https://bugs.webkit.org/show_bug.cgi?id=143571
1781
1782         Reviewed by Jer Noble.
1783
1784         * WebCore.xcodeproj/project.pbxproj:
1785         * dom/Document.cpp:
1786         (WebCore::Document::addPlaybackTargetPickerClient): Don't call client if page playback target
1787             is NULL.
1788         (WebCore::Document::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
1789         * dom/Document.h:
1790
1791         * html/HTMLMediaElement.cpp:
1792         (WebCore::HTMLMediaElement::setWirelessPlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
1793         * html/HTMLMediaElement.h:
1794
1795         * html/HTMLMediaSession.cpp:
1796         (WebCore::HTMLMediaSession::HTMLMediaSession): Don't initialize m_playbackTarget.
1797         (WebCore::HTMLMediaSession::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
1798         * html/HTMLMediaSession.h:
1799
1800         * page/Page.cpp:
1801         (WebCore::Page::Page):
1802         (WebCore::Page::playbackTarget): m_playbackTarget is a RefPtr<MediaPlaybackTarget>
1803         (WebCore::Page::didChoosePlaybackTarget): Ditto.
1804         * page/Page.h:
1805
1806         * platform/audio/MediaSession.h:
1807         (WebCore::MediaSessionClient::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.
1808
1809         Make MediaPlaybackTarget RefCounted, and don't require it to be serializable so it can be
1810         subclassed to keep port-specific iformation out of the base class.
1811         * platform/graphics/MediaPlaybackTarget.h: 
1812         (WebCore::MediaPlaybackTarget::targetType):
1813         (WebCore::MediaPlaybackTarget::targetContext):
1814         (WebCore::MediaPlaybackTarget::hasActiveRoute):
1815         (WebCore::MediaPlaybackTarget::MediaPlaybackTarget):
1816         (WebCore::MediaPlaybackTarget::setDevicePickerContext): Deleted.
1817         (WebCore::MediaPlaybackTarget::devicePickerContext): Deleted.
1818
1819         MediaPlaybackTargetContext is the struct that is serialized to pass across the process boudary.
1820         It has union to hold port-specific data.
1821         * platform/graphics/MediaPlaybackTargetContext.h: Added.
1822
1823         * platform/graphics/MediaPlaybackTargetPicker.h: didChoosePlaybackTarget takes a Ref<MediaPlaybackTarget>&&
1824         * platform/graphics/MediaPlaybackTargetPickerClient.h: Ditto.
1825         * platform/graphics/MediaPlayer.cpp:
1826         (WebCore::MediaPlayer::setWirelessPlaybackTarget): Ditto.
1827         * platform/graphics/MediaPlayer.h:
1828
1829         * platform/graphics/MediaPlayerPrivate.h:
1830         (WebCore::MediaPlayerPrivateInterface::setWirelessPlaybackTarget):
1831
1832         * platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added.
1833         (WebCore::MediaPlaybackTargetMac::targetType):
1834         (WebCore::MediaPlaybackTargetMac::outputContext):
1835         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
1836         (WebCore::MediaPlaybackTargetMac::create):
1837         (WebCore::MediaPlaybackTargetMac::MediaPlaybackTargetMac):
1838         (WebCore::MediaPlaybackTargetMac::~MediaPlaybackTargetMac):
1839         (WebCore::MediaPlaybackTargetMac::targetContext):
1840         (WebCore::MediaPlaybackTargetMac::hasActiveRoute):
1841         (WebCore::toMediaPlaybackTargetMac):
1842         (WebCore::MediaPlaybackTarget::encode): Deleted.
1843         (WebCore::MediaPlaybackTarget::decode): Deleted.
1844         (WebCore::MediaPlaybackTarget::hasActiveRoute): Deleted.
1845
1846         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1847         (WebCore::MediaPlaybackTargetPickerMac::currentDeviceDidChange): Allocate and pass a MediaPlaybackTargetMac
1848         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1849
1850         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1851         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget&&
1852
1853         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1854         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1855         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget): Ditto.
1856
1857         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1858         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1859         (WebCore::MediaPlayerPrivateQTKit::setWirelessPlaybackTarget): Ditto.
1860
1861 2015-04-09  Sergio Villar Senin  <svillar@igalia.com>
1862
1863         [CSS Grid Layout] Fix raw function pointer usages
1864         https://bugs.webkit.org/show_bug.cgi?id=143481
1865
1866         Reviewed by Antti Koivisto.
1867
1868         The argument list of
1869         resolveContentBasedTrackSizingFunctionsForItems() became too long
1870         and rather incomprehensible as it included up to 6 function
1871         pointers. This replaces all of them by an enum which describes the
1872         phase of the algorithm that is currently running. With that phase
1873         we have enough information to select the right function to call.
1874
1875         In order not to tangle up too much the method, the new explicit
1876         switch statements where moved to static helper functions.
1877
1878         No new tests as this is just a code refactoring.
1879
1880         * rendering/RenderGrid.cpp:
1881         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
1882         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
1883         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): New helper function.
1884         (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Ditto.
1885         (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Ditto.
1886         (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Ditto.
1887         (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Ditto.
1888         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
1889         (WebCore::RenderGrid::distributeSpaceToTracks):
1890         * rendering/RenderGrid.h:
1891
1892 2015-04-10  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1893
1894         WebRTC: Remove AudioStreamTrack and VideoStreamTrack (removed in spec)
1895         https://bugs.webkit.org/show_bug.cgi?id=143336
1896
1897         Reviewed by Philippe Normand.
1898
1899         The specific MediaStreamTrakc types (AudioStreamTrack and VideoStreamTrack) have been
1900         removed from the Media Capture and Streams [1] specification.
1901
1902         [1] http://w3c.github.io/mediacapture-main/archives/20150324/getusermedia.html
1903
1904         There are no test for this feature to remove.
1905
1906         * CMakeLists.txt:
1907         * DerivedSources.make:
1908         * Modules/mediastream/AudioStreamTrack.cpp: Removed.
1909         * Modules/mediastream/AudioStreamTrack.h: Removed.
1910         * Modules/mediastream/AudioStreamTrack.idl: Removed.
1911         * Modules/mediastream/MediaStream.cpp:
1912         (WebCore::MediaStream::MediaStream):
1913         (WebCore::MediaStream::addRemoteTrack):
1914         (WebCore::MediaStream::active): Deleted.
1915         * Modules/mediastream/MediaStreamTrack.cpp:
1916         (WebCore::MediaStreamTrack::create):
1917         (WebCore::MediaStreamTrack::MediaStreamTrack):
1918         (WebCore::MediaStreamTrack::kind):
1919         (WebCore::MediaStreamTrack::clone):
1920         (WebCore::MediaStreamTrack::trackEnded): Deleted.
1921         * Modules/mediastream/MediaStreamTrack.h:
1922         * Modules/mediastream/VideoStreamTrack.cpp: Removed.
1923         * Modules/mediastream/VideoStreamTrack.h: Removed.
1924         * Modules/mediastream/VideoStreamTrack.idl: Removed.
1925         * WebCore.xcodeproj/project.pbxproj:
1926
1927 2015-04-09  Andy Estes  <aestes@apple.com>
1928
1929         [Cocoa] Add a HAVE(AVKIT) and use it
1930         https://bugs.webkit.org/show_bug.cgi?id=143593
1931
1932         Reviewed by David Kilzer.
1933
1934         * page/Settings.h: Only defined setAVKitEnabled() if HAVE(AVKIT).
1935         * platform/ios/WebVideoFullscreenControllerAVKit.mm: Only compiled if HAVE(AVKIT).
1936         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Ditto.
1937
1938 2015-04-09  Simon Fraser  <simon.fraser@apple.com>
1939
1940         Some CSS3 filters tests crash under iOS testing
1941         https://bugs.webkit.org/show_bug.cgi?id=143594
1942         rdar://problem/20491140
1943
1944         Reviewed by David Kilzer.
1945
1946         Some tests disable accelerated compositing via testRunner.overridePreference(). In this case,
1947         we'd not create a root scrolling tree node, so null-check it in AsyncScrollingCoordinator::updateNonFastScrollableRegion().
1948
1949         * page/scrolling/AsyncScrollingCoordinator.cpp:
1950         (WebCore::AsyncScrollingCoordinator::updateNonFastScrollableRegion):
1951
1952 2015-04-09  Zalan Bujtas  <zalan@apple.com>
1953
1954         Simple line layout: Add <br> support.
1955         https://bugs.webkit.org/show_bug.cgi?id=139012
1956
1957         This patch enables RenderBlockFlows to use simple line layout on text content when <br> is present.
1958         Simple text with <br> is a fairly common pattern on discussion(forum)-like web pages. This patch reduces memory usage
1959         and speeds up layout for such content.
1960
1961         PerformanceTest/layout/line-layout-simple.html shows more than 2x speedup, when each paragraph is modified by appending <br> to the end.
1962         With <br> support enabled:
1963           mean: 70.02391461289068 runs/s
1964           median: 70.47986488932318 runs/s
1965
1966         While with <br> support disabled:
1967           mean: 30.417295049468184 runs/s
1968           median: 30.36517778760357 runs/s
1969
1970         Reviewed by Antti Koivisto.
1971
1972         Test: fast/text/simple-line-with-br.html
1973
1974         * editing/TextIterator.cpp:
1975         (WebCore::TextIterator::handleTextNode):
1976         * rendering/RenderBlock.h:
1977         * rendering/RenderBlockFlow.cpp:
1978         (WebCore::RenderBlockFlow::setSelectionState):
1979         (WebCore::RenderBlockFlow::deleteLineBoxesBeforeSimpleLineLayout):
1980         * rendering/RenderBlockFlow.h:
1981         * rendering/RenderLineBreak.cpp:
1982         (WebCore::simpleLineLayout):
1983         (WebCore::ensureLineBoxes):
1984         (WebCore::RenderLineBreak::deleteLineBoxesBeforeSimpleLineLayout):
1985         (WebCore::RenderLineBreak::positionForPoint):
1986         (WebCore::RenderLineBreak::setSelectionState):
1987         (WebCore::RenderLineBreak::linesBoundingBox):
1988         (WebCore::RenderLineBreak::absoluteRects):
1989         (WebCore::RenderLineBreak::absoluteQuads):
1990         (WebCore::RenderLineBreak::collectSelectionRects):
1991         * rendering/RenderLineBreak.h:
1992         * rendering/RenderText.cpp:
1993         (WebCore::RenderText::absoluteRects):
1994         (WebCore::RenderText::absoluteQuadsClippedToEllipsis):
1995         (WebCore::RenderText::absoluteQuads):
1996         (WebCore::RenderText::linesBoundingBox):
1997         (WebCore::RenderText::caretMinOffset):
1998         (WebCore::RenderText::caretMaxOffset):
1999         (WebCore::RenderText::containsCaretOffset):
2000         (WebCore::RenderText::hasRenderedText):
2001         * rendering/SimpleLineLayout.cpp:
2002         (WebCore::SimpleLineLayout::canUseFor):
2003         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
2004         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
2005         (WebCore::SimpleLineLayout::consumeLineBreakIfNeeded):
2006         (WebCore::SimpleLineLayout::skipWhitespaceIfNeeded):
2007         (WebCore::SimpleLineLayout::firstFragment):
2008         (WebCore::SimpleLineLayout::forceFragmentToLine):
2009         (WebCore::SimpleLineLayout::createLineRuns):
2010         (WebCore::SimpleLineLayout::create):
2011         * rendering/SimpleLineLayoutFlowContents.cpp:
2012         (WebCore::SimpleLineLayout::initializeSegments):
2013         (WebCore::SimpleLineLayout::FlowContents::segmentForRenderer): Deleted.
2014         * rendering/SimpleLineLayoutFlowContents.h:
2015         * rendering/SimpleLineLayoutFunctions.cpp:
2016         (WebCore::SimpleLineLayout::paintFlow):
2017         (WebCore::SimpleLineLayout::hitTestFlow):
2018         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
2019         * rendering/SimpleLineLayoutResolver.cpp:
2020         (WebCore::SimpleLineLayout::RunResolver::Run::rect):
2021         (WebCore::SimpleLineLayout::RunResolver::RunResolver):
2022         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
2023         * rendering/SimpleLineLayoutResolver.h:
2024         (WebCore::SimpleLineLayout::RunResolver::Iterator::inQuirksMode):
2025         (WebCore::SimpleLineLayout::RunResolver::Iterator::operator--):
2026         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2027         (WebCore::SimpleLineLayout::TextFragmentIterator::nextTextFragment):
2028         (WebCore::SimpleLineLayout::TextFragmentIterator::findNextTextFragment):
2029         (WebCore::SimpleLineLayout::TextFragmentIterator::revertToFragment):
2030         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
2031         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2032         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLastInRenderer):
2033         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLineBreak):
2034         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isEmpty):
2035         (WebCore::SimpleLineLayout::TextFragmentIterator::isSoftLineBreak):
2036         (WebCore::SimpleLineLayout::TextFragmentIterator::isHardLineBreak):
2037         (WebCore::SimpleLineLayout::TextFragmentIterator::isLineBreak): Deleted.
2038
2039 2015-04-09  Chris Dumez  <cdumez@apple.com>
2040
2041         Regression(r182603): editing/selection/selection-invalid-offset.html is crashing
2042         https://bugs.webkit.org/show_bug.cgi?id=143591
2043
2044         Reviewed by Ryosuke Niwa.
2045
2046         Add missing null-check for m_frame->editor().client() in
2047         FrameSelection::updateAndRevealSelection().
2048
2049         * editing/FrameSelection.cpp:
2050         (WebCore::FrameSelection::updateAndRevealSelection):
2051
2052 2015-04-09  Sungmann Cho  <sungmann.cho@navercorp.com>
2053
2054         Minor cleanups to WebCore/plugins
2055         https://bugs.webkit.org/show_bug.cgi?id=143509
2056
2057         Reviewed by Anders Carlsson.
2058
2059         1. Remove unnecessary #includes.
2060         2. Fix some wrong namespace comments for consistency.
2061
2062         No new tests, no behavior change.
2063
2064         * plugins/DOMMimeType.cpp:
2065         * plugins/DOMMimeType.h:
2066         * plugins/DOMMimeTypeArray.h:
2067         * plugins/DOMPlugin.h:
2068         * plugins/DOMPluginArray.h:
2069         * plugins/PluginData.cpp:
2070         * plugins/PluginData.h:
2071         * plugins/PluginMainThreadScheduler.cpp:
2072         * plugins/PluginViewBase.h:
2073
2074 2015-04-09  Javier Fernandez  <jfernandez@igalia.com>
2075
2076         [CSS Grid Layout] Implement justify-self and justify-item css properties.
2077         https://bugs.webkit.org/show_bug.cgi?id=133281
2078
2079         Reviewed by David Hyatt.
2080
2081         Implement the new property 'justify-items', defined in the CSS Box Alignment
2082         specification to describe the container's alignment behavior, in the same way
2083         the 'align-items' property does. The 'justify-self' 'auto' value of any relative
2084         positioned element will be resolved to its container's 'justify-items' value.
2085
2086         Test: fast/css/parse-justify-items.html
2087
2088         * css/CSSComputedStyleDeclaration.cpp:
2089         (WebCore::resolveContainerAlignmentAuto): Function to resolve 'auto' values for 'align-items' or 'justify-items'.
2090         (WebCore::resolveSelfAlignmentAuto): Function to resolve 'auto' values for 'align-self' or 'justify-self'.
2091         (WebCore::valueForItemPositionWithOverflowAlignment): Take into account the 'legacy' keyword.
2092         (WebCore::ComputedStyleExtractor::propertyValue):
2093         (WebCore::resolveAlignmentAuto): Deleted (renamed to resolveContainerAlignmentAuto).
2094         * css/CSSParser.cpp:
2095         (WebCore::CSSParser::parseValue): Refactoring to share logic between justify-xxx and align-xxx properties.
2096         (WebCore::CSSParser::parseLegacyPosition): Parsing logic of 'legacy' keyword,
2097         (WebCore::CSSParser::parseItemPositionOverflowPosition): Take into account the 'legacy' keyword.
2098         * css/CSSParser.h:
2099         * css/CSSPropertyNames.in:
2100         * css/CSSValueKeywords.in:
2101         * css/StyleBuilderCustom.h:
2102         (WebCore::StyleBuilderCustom::applyInheritJustifyItems): Added.
2103         (WebCore::StyleBuilderCustom::applyInitialJustifyItems): Added.
2104         (WebCore::StyleBuilderCustom::applyValueJustifyItems): Added.
2105         * css/StyleResolver.cpp:
2106         (WebCore::StyleResolver::adjustRenderStyle): Resolve 'auto' values for justify-items when parents have the 'legacy' keyword.
2107         * rendering/style/RenderStyle.h: Managing the new ItemPositionType fields.
2108         * rendering/style/RenderStyleConstants.h: Added the ItemPositionType enumeration for handling the 'legacy' keyword.
2109         * rendering/style/StyleRareNonInheritedData.cpp: Managing the new ItemPositionType fields.
2110         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2111         (WebCore::StyleRareNonInheritedData::operator==):
2112         * rendering/style/StyleRareNonInheritedData.h:
2113
2114 2015-04-09  Anders Carlsson  <andersca@apple.com>
2115
2116         Make it possible to create an application cache storage with custom directories
2117         https://bugs.webkit.org/show_bug.cgi?id=143588
2118
2119         Reviewed by Sam Weinig.
2120
2121         Add cache directory and flat file directory name parameters to ApplicationCacheStorage::create.
2122
2123         * loader/appcache/ApplicationCacheStorage.cpp:
2124         (WebCore::ApplicationCacheStorage::store):
2125         (WebCore::ApplicationCacheStorage::loadCache):
2126         (WebCore::ApplicationCacheStorage::checkForDeletedResources):
2127         (WebCore::ApplicationCacheStorage::flatFileAreaSize):
2128         (WebCore::ApplicationCacheStorage::ApplicationCacheStorage):
2129         (WebCore::ApplicationCacheStorage::create):
2130         (WebCore::ApplicationCacheStorage::singleton):
2131         * loader/appcache/ApplicationCacheStorage.h:
2132
2133 2015-04-09  Myles C. Maxfield  <mmaxfield@apple.com>
2134
2135         Text-combine erroneously draws vertically after non-layout-causing style change
2136         https://bugs.webkit.org/show_bug.cgi?id=143461
2137         <rdar://problem/19285490>
2138
2139         Reviewed by Darin Adler.
2140
2141         RenderCombineText::styleDidChange() unconditionally uncombines its text. Layout then
2142         recombines it. However, if there is a style change that does not cause layout, the
2143         RenderCombineText will be left uncombined until the next layout.
2144
2145         Test: fast/text/text-combine-style-change-no-layout.html
2146
2147         * rendering/RenderCombineText.cpp:
2148         (WebCore::RenderCombineText::styleDidChange):
2149
2150 2015-04-09  Simon Fraser  <simon.fraser@apple.com>
2151
2152         Revert part of 182516: it broke tests
2153         https://bugs.webkit.org/show_bug.cgi?id=143568
2154         rdar://problem/20484578
2155
2156         Reviewed by Myles Maxfield.
2157
2158         Revert the FontCascadeCocoa parts of r182516, since it broke some CSS shapes tests.
2159
2160         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2161         (WebCore::FontCascade::drawGlyphs):
2162         (WebCore::dilationSizeForTextColor): Deleted.
2163
2164 2015-04-09  Zalan Bujtas  <zalan@apple.com>
2165
2166         Simple line layout(regression): Calling innerText on RenderFlow with multiple children is slow.
2167         https://bugs.webkit.org/show_bug.cgi?id=143554
2168
2169         Reviewed by Antti Koivisto.
2170
2171         Initialize render flow's segments only when the render flow changes in TextIterator.
2172         The included performance test shows 6x speedup. (from ~10 runs/sec to ~60 runs/sec)
2173
2174         Test: PerformanceTests/Layout/simple-line-layout-innertext.html.
2175
2176         * editing/TextIterator.cpp:
2177         (WebCore::TextIterator::handleTextNode):
2178         * editing/TextIterator.h:
2179         * rendering/SimpleLineLayoutFlowContents.cpp: Instruments log shows that vector's expandCapacity could be expensive when flow has large amount of children.
2180         (WebCore::SimpleLineLayout::initializeSegments):
2181
2182 2015-04-09  Chris Dumez  <cdumez@apple.com>
2183
2184         [WK2][iOS] editorState() should not cause a synchronous layout
2185         https://bugs.webkit.org/show_bug.cgi?id=142536
2186         <rdar://problem/20041506>
2187
2188         Reviewed by Enrica Casucci.
2189
2190         Add didChangeSelectionAndUpdateLayout() callback to EditorClient
2191         that is called at the end of FrameSelection::updateAndRevealSelection().
2192
2193         * editing/FrameSelection.cpp:
2194         (WebCore::FrameSelection::updateAndRevealSelection):
2195         * loader/EmptyClients.h:
2196         * page/EditorClient.h:
2197
2198 2015-04-08  Anders Carlsson  <andersca@apple.com>
2199
2200         Give each cache group a storage and use it in place of the singleton
2201         https://bugs.webkit.org/show_bug.cgi?id=143540
2202
2203         Reviewed by Sam Weinig.
2204
2205         This is another step towards making the cache storage be per page.
2206
2207         * loader/appcache/ApplicationCacheGroup.cpp:
2208         (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
2209         (WebCore::ApplicationCacheGroup::~ApplicationCacheGroup):
2210         (WebCore::ApplicationCacheGroup::cacheForMainRequest):
2211         (WebCore::ApplicationCacheGroup::fallbackCacheForMainRequest):
2212         (WebCore::ApplicationCacheGroup::selectCache):
2213         (WebCore::ApplicationCacheGroup::makeObsolete):
2214         (WebCore::ApplicationCacheGroup::didReachMaxAppCacheSize):
2215         (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
2216         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2217         * loader/appcache/ApplicationCacheGroup.h:
2218         * loader/appcache/ApplicationCacheStorage.cpp:
2219         (WebCore::ApplicationCacheStorage::loadCacheGroup):
2220         (WebCore::ApplicationCacheStorage::findOrCreateCacheGroup):
2221         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
2222         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
2223
2224 2015-04-09  Andy Estes  <aestes@apple.com>
2225
2226         Try to fix the Mac build after r182596.
2227
2228         I was wrong to replace PLATFORM(IOS) with HAVE(PARENTAL_CONTROLS) in ContentFilterUnblockHandler.
2229         The conditional should be HAVE(PARENTAL_CONTROLS) && PLATFORM(IOS).
2230
2231         * platform/ContentFilterUnblockHandler.h:
2232         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
2233         (WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler):
2234         (WebCore::ContentFilterUnblockHandler::needsUIProcess):
2235         (WebCore::ContentFilterUnblockHandler::encode):
2236         (WebCore::ContentFilterUnblockHandler::decode):
2237         (WebCore::ContentFilterUnblockHandler::canHandleRequest):
2238         (WebCore::ContentFilterUnblockHandler::requestUnblockAsync):
2239
2240 2015-04-09  Andy Estes  <aestes@apple.com>
2241
2242         [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it
2243         https://bugs.webkit.org/show_bug.cgi?id=143559
2244
2245         Reviewed by David Kilzer.
2246
2247         * loader/ContentFilter.cpp:
2248         (WebCore::ContentFilter::types): Only registered ParentalControlsContentFilter if HAVE(PARENTAL_CONTROLS).
2249         * platform/ContentFilterUnblockHandler.h: Changed PLATFORM(IOS) to HAVE(PARENTAL_CONTROLS).
2250         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
2251         (WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler): Ditto.
2252         (WebCore::ContentFilterUnblockHandler::needsUIProcess): Ditto.
2253         (WebCore::ContentFilterUnblockHandler::encode): Ditto.
2254         (WebCore::ContentFilterUnblockHandler::decode): Ditto.
2255         (WebCore::ContentFilterUnblockHandler::canHandleRequest): Ditto.
2256         (WebCore::ContentFilterUnblockHandler::requestUnblockAsync): Ditto.
2257         * platform/cocoa/ParentalControlsContentFilter.mm: Wrapped the file with HAVE(PARENTAL_CONTROLS)
2258
2259 2015-04-09  Sergio Villar Senin  <svillar@igalia.com>
2260
2261         Unreviewed, added CSS Grid Layout to features.json file.
2262
2263         * features.json:
2264
2265 2015-04-08  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
2266
2267         [Streams API] Support the start function parameter in ReadableStream constructor
2268         https://bugs.webkit.org/show_bug.cgi?id=141160
2269
2270         Reviewed by Benjamin Poulain.
2271
2272         Stores the JS source object in ReadableStreamJSSource and calls its "start" function.
2273         This function takes a controller object that has three JS functions as members: close, enqueue and error.
2274         This controller is stored in ReadableStreamJSSource as it will be reused as "pull" parameter.
2275         All three JS functions do not currently do anything.
2276
2277         Test: streams/readablestream-start.html
2278
2279         * Modules/streams/ReadableStream.cpp:
2280         (WebCore::ReadableStream::start): Place holder for step 11 of https://streams.spec.whatwg.org/#rs-constructor.
2281         * Modules/streams/ReadableStream.h:
2282         * bindings/js/JSReadableStreamCustom.cpp:
2283         (WebCore::constructJSReadableStream):
2284         * bindings/js/ReadableStreamJSSource.cpp:
2285         (WebCore::getPropertyFromObject): Helper function to get a public property from an object.
2286         (WebCore::setPropertyToObject): Helper function to set a public property to an object.
2287         (WebCore::callFunction): Helper function to call a JS function from C++.
2288         (WebCore::ReadableStreamJSSource::ReadableStreamJSSource):
2289         (WebCore::notImplementedFunction):
2290         (WebCore::createReadableStreamEnqueueFunction): Creates the JS function for enqueue.
2291         (WebCore::createReadableStreamCloseFunction): Creates the JS function for close.
2292         (WebCore::createReadableStreamErrorFunction): Creates the JS function for error.
2293         (WebCore::startReadableStreamAsync): Equivalent of promise resolution for start.
2294         (WebCore::ReadableStreamJSSource::start): Calls the "start" function of the JS source with all three JS functions (enqueue, close, error) as parameters.
2295         * bindings/js/ReadableStreamJSSource.h:
2296
2297 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
2298
2299         [Mac] Unreviewed test fix after r182584
2300         https://bugs.webkit.org/show_bug.cgi?id=143452
2301
2302         Correct bit comparison to use the correct value for the Control-key
2303
2304         * platform/mac/PlatformEventFactoryMac.mm:
2305         (WebCore::typeForEvent):
2306
2307 2015-04-08  Simon Fraser  <simon.fraser@apple.com>
2308
2309         Add a debug assertion that will fire if we try to paint layer contents on a background thread
2310         https://bugs.webkit.org/show_bug.cgi?id=143547
2311
2312         Reviewed by Alexey Proskuryakov.
2313
2314         New assertion to catch cases where other frameworks erroneously trigger painting
2315         on a non-main (or non-Web) thread.
2316
2317         * platform/graphics/mac/WebLayer.mm:
2318         (-[WebSimpleLayer display]):
2319         (-[WebSimpleLayer drawInContext:]):
2320
2321 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
2322
2323         [Mac] WebKit is not honoring OS preferences for secondary click behaviors
2324         https://bugs.webkit.org/show_bug.cgi?id=143452
2325         <rdar://problem/20437483>
2326
2327         Reviewed by Tim Horton.
2328
2329         We cannot rely on the event's button number to decide behavior. The OS settings might have
2330         mapped middle button to context menu, etc. Instead, we should ask the OS (via NSMenu) what
2331         the proper button press behavior is.
2332
2333         * platform/mac/PlatformEventFactoryMac.mm:
2334         (WebCore::mouseButtonForEvent): Ask NSMenu what kind of button press we have received.
2335
2336 2015-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2337
2338         Fix -Wformat in AnimationBase.cpp
2339         https://bugs.webkit.org/show_bug.cgi?id=143541
2340
2341         Reviewed by Simon Fraser.
2342
2343         * page/animation/AnimationBase.cpp:
2344         (WebCore::nameForStateInput): Added. Converts an AnimationBase::AnimationStateInput to a
2345         string.
2346         (WebCore::AnimationBase::updateStateMachine): Print AnimationBase::AnimationStateInput as a
2347         string, instead of passing it to %d and assuming that works, to silence GCC's -Wformat.
2348
2349 2015-04-08  Brady Eidson  <beidson@apple.com>
2350
2351         Expose the "Share" menu for links, images, and media.
2352         <rdar://problem/20435340> and https://bugs.webkit.org/show_bug.cgi?id=143502
2353
2354         Reviewed by Tim Horton.
2355
2356         * loader/EmptyClients.h:
2357         * page/ContextMenuClient.h:
2358         (WebCore::ContextMenuClient::shareSelectedTextMenuItem): Deleted.
2359
2360         * page/ContextMenuController.cpp:
2361         (WebCore::ContextMenuController::populate):
2362         (WebCore::selectionContainsPossibleWord): Deleted.
2363         * page/ContextMenuController.h:
2364         (WebCore::ContextMenuController::page):
2365
2366         * platform/ContextMenuItem.cpp:
2367         (WebCore::ContextMenuItem::ContextMenuItem):
2368         (WebCore::ContextMenuItem::isNull):
2369         (WebCore::ContextMenuItem::shareMenuItem):
2370         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
2371         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
2372         * platform/ContextMenuItem.h:
2373
2374         * platform/gtk/ContextMenuItemGtk.cpp:
2375         (WebCore::ContextMenuItem::shareMenuItem): Return a null item.
2376         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
2377         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
2378
2379         * platform/mac/ContextMenuItemMac.mm:
2380         (WebCore::ContextMenuItem::shareMenuItem): Create a full-featured Share menu item instead of just for selected text.
2381         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
2382         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
2383
2384         * rendering/HitTestResult.cpp:
2385         (WebCore::HitTestResult::selectedText): Instead of calculating selected text outside the HitTestResult, let the
2386           HitTestResult do what it does best: Calculate things!
2387         * rendering/HitTestResult.h:
2388
2389 2015-04-08  Per Arne Vollan  <peavo@outlook.com>
2390
2391         [Curl] Compile error in CurlCacheEntry::parseResponseHeaders method.
2392         https://bugs.webkit.org/show_bug.cgi?id=143531
2393
2394         Reviewed by Alex Christensen.
2395
2396         Cache related methods in ResourceResponse have changed return type.
2397
2398         * platform/network/curl/CurlCacheEntry.cpp:
2399         (WebCore::CurlCacheEntry::parseResponseHeaders):
2400
2401 2015-04-08  Anders Carlsson  <andersca@apple.com>
2402
2403         Remove ApplicationCacheGroup::m_isCopy
2404         https://bugs.webkit.org/show_bug.cgi?id=143536
2405
2406         Reviewed by Tim Horton.
2407
2408         Code that used to set m_isCopy to true is long gone.
2409
2410         * loader/appcache/ApplicationCache.cpp:
2411         (WebCore::ApplicationCache::~ApplicationCache):
2412         * loader/appcache/ApplicationCacheGroup.cpp:
2413         (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
2414         (WebCore::ApplicationCacheGroup::~ApplicationCacheGroup):
2415         * loader/appcache/ApplicationCacheGroup.h:
2416         (WebCore::ApplicationCacheGroup::isCopy): Deleted.
2417
2418 2015-04-08  Anders Carlsson  <andersca@apple.com>
2419
2420         Delete ApplicationCache static member functions
2421         https://bugs.webkit.org/show_bug.cgi?id=143534
2422
2423         Reviewed by Tim Horton.
2424
2425         * loader/appcache/ApplicationCache.cpp:
2426         (WebCore::ApplicationCache::deleteCacheForOrigin): Deleted.
2427         (WebCore::ApplicationCache::deleteAllCaches): Deleted.
2428         (WebCore::ApplicationCache::diskUsageForOrigin): Deleted.
2429         * loader/appcache/ApplicationCache.h:
2430
2431 2015-04-08  Alex Christensen  <achristensen@webkit.org>
2432
2433         Block popups from content extensions.
2434         https://bugs.webkit.org/show_bug.cgi?id=143497
2435
2436         Reviewed by Brady Eidson.
2437
2438         Test: http/tests/contentextensions/popups.html
2439
2440         * loader/ResourceLoadInfo.cpp:
2441         (WebCore::readResourceType):
2442         * loader/ResourceLoadInfo.h:
2443         * page/DOMWindow.cpp:
2444         (WebCore::DOMWindow::open):
2445         * page/UserContentController.cpp:
2446         (WebCore::UserContentController::actionsForResourceLoad):
2447         * page/UserContentController.h:
2448         Check content extensions before opening a window.
2449
2450 2015-04-08  Bem Jones-Bey  <bjonesbe@adobe.com>
2451
2452         [CSS Shapes] Properly handle negative reference box widths and center coordinates
2453         https://bugs.webkit.org/show_bug.cgi?id=142610
2454
2455         Reviewed by Rob Buis.
2456
2457         Fix a few cases where values that should not be negative end up that
2458         way.
2459
2460         This patch is based on a couple of Blink patches by Rob Buis.
2461
2462         Tests: fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash.html
2463                fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash.html
2464
2465         * rendering/shapes/ShapeOutsideInfo.cpp:
2466         (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine): A
2467             negative margin box width means that the shape has no extent, so
2468             clamp to zero.
2469         * rendering/style/BasicShapes.cpp:
2470         (WebCore::BasicShapeCircle::floatValueForRadiusInBox): When computing
2471             the radii, take the absolute value, since the radii is based on
2472             the distance, which is always positive.
2473         (WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.
2474
2475 2015-04-08  Commit Queue  <commit-queue@webkit.org>
2476
2477         Unreviewed, rolling out r182522.
2478         https://bugs.webkit.org/show_bug.cgi?id=143529
2479
2480         Not needed any more (Requested by ap on #webkit).
2481
2482         Reverted changeset:
2483
2484         "Fix the build."
2485         http://trac.webkit.org/changeset/182522
2486
2487 2015-04-08  Beth Dakin  <bdakin@apple.com>
2488
2489         Force events should not require preventDefault in order to fire
2490         https://bugs.webkit.org/show_bug.cgi?id=143503
2491         -and corresponding-
2492         rdar://problem/20458916
2493
2494         Reviewed by Tim Horton.
2495
2496         Since these events will fire whether or not preventDefault was set on the 
2497         willBegin event, we should make sure we only send them when there are registered 
2498         event listeners. These are new events, so we don’t want to spam the vast majority 
2499         of web content that doesn’t use them yet.
2500         * dom/Document.cpp:
2501         (WebCore::Document::addListenerTypeIfNeeded):
2502         * dom/Document.h:
2503         * dom/Element.cpp:
2504         (WebCore::Element::dispatchMouseForceWillBegin):
2505         (WebCore::Element::dispatchMouseForceChanged):
2506         (WebCore::Element::dispatchMouseForceDown):
2507         (WebCore::Element::dispatchMouseForceUp):
2508         (WebCore::Element::dispatchMouseForceClick):
2509         (WebCore::Element::dispatchMouseForceCancelled):
2510
2511 2015-04-08  Jer Noble  <jer.noble@apple.com>
2512
2513         [Mac][WebAudio] Update the AVAudioMix in the AudioSourceProviderAVFObjC when the list of enabled audio tracks change.
2514         https://bugs.webkit.org/show_bug.cgi?id=143332
2515
2516         Reviewed by Eric Carlson.
2517
2518         Some media assets (notably, mp3s) will not have an enabled audio track when the AVAsset is
2519         first loaded, so the AVAudioMix will have no trackID in it's parameters. Whenever the list
2520         of enabled tracks change, recreate the AVAudioMix with the new first enabled audio trackID.
2521
2522         To facilitate this, add a new setter to AudioSourceProviderAVFObjC taking an AVAssetTrack to
2523         use with the AVAudioMix. Whenever this parameter changes, the AVAudioMix is destroyed and
2524         recreated.
2525
2526         * html/HTMLMediaElement.cpp:
2527         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated): Drive-by fix: when the media
2528             player switches engines, re-associate the audio source node with its provider.
2529         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
2530         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2531         (WebCore::AudioSourceProviderAVFObjC::setPlayerItem): Only create the mix if there is a valid AVPlayerItem and AVAssetTrack
2532         (WebCore::AudioSourceProviderAVFObjC::setAudioTrack): Ditto.
2533         (WebCore::AudioSourceProviderAVFObjC::createMix): Don't iterate over the AVPlayerItem's tracks,
2534             just use the one passed in through setAudioTrack().
2535         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2536         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Clear the provider's track.
2537         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Set the provider's track.
2538         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Ditto.
2539         (WebCore::MediaPlayerPrivateAVFoundationObjC::audioSourceProvider): Ditto.
2540
2541 2015-04-08  Anders Carlsson  <andersca@apple.com>
2542
2543         Move some ApplicationCache static member functions to ApplicationCacheStorage
2544         https://bugs.webkit.org/show_bug.cgi?id=143524
2545
2546         Reviewed by Antti Koivisto.
2547
2548         This is yet another step towards eliminating ApplicationCacheStorage::singleton() and making the storage be per page instead.
2549
2550         * loader/appcache/ApplicationCache.cpp:
2551         (WebCore::ApplicationCache::deleteCacheForOrigin):
2552         (WebCore::ApplicationCache::deleteAllCaches):
2553         (WebCore::ApplicationCache::diskUsageForOrigin):
2554         * loader/appcache/ApplicationCacheStorage.cpp:
2555         (WebCore::ApplicationCacheStorage::deleteAllCaches):
2556         (WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
2557         (WebCore::ApplicationCacheStorage::diskUsageForOrigin):
2558         * loader/appcache/ApplicationCacheStorage.h:
2559
2560 2015-04-08  ChangSeok Oh  <changseok.oh@collabora.com>
2561
2562         Fill list style background with same color with that of list background.
2563         https://bugs.webkit.org/show_bug.cgi?id=143483
2564
2565         Reviewed by Simon Fraser.
2566
2567         LayoutListMarker does not have a node so its selectionBackgroundColor alway returns
2568         the default theme color for selection. We can make it more natural by filling
2569         the same color with that of LayoutListItem into it.
2570
2571         Tests: fast/backgrounds/selection-background-color-of-image-list-style.html
2572                fast/backgrounds/selection-background-color-of-list-style.html
2573
2574         * rendering/RenderListMarker.cpp:
2575         (WebCore::RenderListMarker::paint):
2576
2577 2015-04-08  Alex Christensen  <achristensen@webkit.org> and Patrick Gansterer  <paroga@webkit.org>
2578
2579         Add CMake build system for WinCairo port.
2580         https://bugs.webkit.org/show_bug.cgi?id=115944
2581
2582         Reviewed by Chris Dumez.
2583
2584         * CMakeLists.txt:
2585         * PlatformWin.cmake:
2586         * PlatformWinCairo.cmake:
2587         * platform/graphics/texmap/TextureMapperGL.cpp:
2588         (WebCore::TextureMapperGL::TextureMapperGL):
2589
2590 2015-04-08  Chris Dumez  <cdumez@apple.com>
2591
2592         Rename ActiveDOMObject::canSuspend() to canSuspendForPageCache() for clarity
2593         https://bugs.webkit.org/show_bug.cgi?id=143513
2594
2595         Reviewed by Andreas Kling.
2596
2597         Rename ActiveDOMObject::canSuspend() to canSuspendForPageCache() for
2598         clarity as it is only used for the page cache. Also rename the
2599         'DocumentWillBecomeInactive' value of the ReasonForSuspension enum to
2600         'PageCache' as it is only used by CachedFrame for the page cache and it
2601         is a lot more understandable.
2602
2603 2015-04-08  Commit Queue  <commit-queue@webkit.org>
2604
2605         Unreviewed, rolling out r182536.
2606         https://bugs.webkit.org/show_bug.cgi?id=143523
2607
2608         Made accessibility/table-sections.html time out on debug bots
2609         (Requested by ap on #webkit).
2610
2611         Reverted changeset:
2612
2613         "Simple line layout: Add <br> support."
2614         https://bugs.webkit.org/show_bug.cgi?id=139012
2615         http://trac.webkit.org/changeset/182536
2616
2617 2015-04-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2618
2619         [GTK] Crash in DOMObjectCache when a wrapped object owned by the cache is unreffed by the user
2620         https://bugs.webkit.org/show_bug.cgi?id=143521
2621
2622         Reviewed by Martin Robinson.
2623
2624         This is a case we claim to support, but it only works if the
2625         object has only one reference. In that case, when the user unrefs
2626         it, the weak ref notify callback removes the object from the
2627         cache. However, if the object has more than one ref, the cache
2628         doesn't know the user unreffed it, and when clearing the cache we
2629         try to remove more references than what the object actually has,
2630         causing a crash in g_object_unref.
2631
2632         * bindings/gobject/DOMObjectCache.cpp:
2633         (WebKit::DOMObjectCacheData::clearObject):
2634
2635 2015-04-08  Zalan Bujtas  <zalan@apple.com>
2636
2637         Simple line layout: Add <br> support.
2638         https://bugs.webkit.org/show_bug.cgi?id=139012
2639
2640         This patch enables RenderBlockFlows to use simple line layout on text content when <br> is present.
2641         Simple text with <br> is a fairly common pattern on discussion(forum)-like web pages. This patch reduces memory usage
2642         and speeds up layout for such content.
2643
2644         PerformanceTest/layout/line-layout-simple.html shows more than 2x speedup, when each paragraph is modified by appending <br> to the end.
2645         With <br> support enabled:
2646           mean: 70.02391461289068 runs/s
2647           median: 70.47986488932318 runs/s
2648     
2649         While with <br> support disabled: 
2650           mean: 30.417295049468184 runs/s
2651           median: 30.36517778760357 runs/s
2652
2653         Reviewed by Antti Koivisto.
2654
2655         Test: fast/text/simple-line-with-br.html
2656
2657         * editing/TextIterator.cpp:
2658         (WebCore::TextIterator::handleTextNode):
2659         * rendering/RenderBlock.h:
2660         * rendering/RenderBlockFlow.cpp:
2661         (WebCore::RenderBlockFlow::setSelectionState):
2662         (WebCore::RenderBlockFlow::deleteLineBoxesBeforeSimpleLineLayout):
2663         * rendering/RenderBlockFlow.h:
2664         * rendering/RenderLineBreak.cpp:
2665         (WebCore::simpleLineLayout):
2666         (WebCore::ensureLineBoxes):
2667         (WebCore::RenderLineBreak::deleteLineBoxesBeforeSimpleLineLayout):
2668         (WebCore::RenderLineBreak::positionForPoint):
2669         (WebCore::RenderLineBreak::setSelectionState):
2670         (WebCore::RenderLineBreak::linesBoundingBox):
2671         (WebCore::RenderLineBreak::absoluteRects):
2672         (WebCore::RenderLineBreak::absoluteQuads):
2673         (WebCore::RenderLineBreak::collectSelectionRects):
2674         * rendering/RenderLineBreak.h:
2675         * rendering/SimpleLineLayout.cpp:
2676         (WebCore::SimpleLineLayout::canUseFor):
2677         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
2678         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
2679         (WebCore::SimpleLineLayout::consumeLineBreakIfNeeded):
2680         (WebCore::SimpleLineLayout::skipWhitespaceIfNeeded):
2681         (WebCore::SimpleLineLayout::firstFragment):
2682         (WebCore::SimpleLineLayout::forceFragmentToLine):
2683         (WebCore::SimpleLineLayout::createLineRuns):
2684         (WebCore::SimpleLineLayout::create):
2685         * rendering/SimpleLineLayoutFlowContents.cpp:
2686         (WebCore::SimpleLineLayout::initializeSegments):
2687         (WebCore::SimpleLineLayout::FlowContents::segmentForRenderer): Deleted.
2688         * rendering/SimpleLineLayoutFlowContents.h:
2689         * rendering/SimpleLineLayoutFunctions.cpp:
2690         (WebCore::SimpleLineLayout::paintFlow):
2691         (WebCore::SimpleLineLayout::hitTestFlow):
2692         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
2693         * rendering/SimpleLineLayoutResolver.cpp:
2694         (WebCore::SimpleLineLayout::RunResolver::Run::rect):
2695         (WebCore::SimpleLineLayout::RunResolver::RunResolver):
2696         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
2697         * rendering/SimpleLineLayoutResolver.h:
2698         (WebCore::SimpleLineLayout::RunResolver::Iterator::inQuirksMode):
2699         (WebCore::SimpleLineLayout::RunResolver::Iterator::operator--):
2700         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2701         (WebCore::SimpleLineLayout::EndOfSegmentSetter::EndOfSegmentSetter):
2702         (WebCore::SimpleLineLayout::EndOfSegmentSetter::~EndOfSegmentSetter):
2703         (WebCore::SimpleLineLayout::TextFragmentIterator::nextTextFragment):
2704         (WebCore::SimpleLineLayout::TextFragmentIterator::revertToFragment):
2705         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
2706         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2707         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLastInRenderer):
2708         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLineBreak):
2709         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isEmpty):
2710         (WebCore::SimpleLineLayout::TextFragmentIterator::isSoftLineBreak):
2711         (WebCore::SimpleLineLayout::TextFragmentIterator::isHardLineBreak):
2712         (WebCore::SimpleLineLayout::TextFragmentIterator::isLineBreak): Deleted.
2713
2714 2015-04-08  Philippe Normand  <pnormand@igalia.com>
2715
2716         [GStreamer] compress property for the HTTP source element
2717         https://bugs.webkit.org/show_bug.cgi?id=143518
2718
2719         Reviewed by Carlos Garcia Campos.
2720
2721         Added a compress property so the default behavior or not
2722         requesting content encoded to the server can be overridden if
2723         needed. This is useful for adaptive streaming playback.
2724
2725         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2726         (webKitWebSrcSetProperty):
2727         (webKitWebSrcGetProperty):
2728         (webKitWebSrcStart):
2729
2730 2015-04-08  Joonghun Park  <jh718.park@samsung.com>
2731
2732         Remove CSS functions min() and max() which had been dropped from specification
2733         https://bugs.webkit.org/show_bug.cgi?id=143440
2734
2735         Reviewed by Darin Adler.
2736
2737         No new tests, No Behavior changes.
2738
2739         * css/CSSCalculationValue.cpp:
2740         (WebCore::CSSCalcValue::create):
2741         * css/CSSParser.cpp:
2742         (WebCore::CSSParser::isCalculation):
2743
2744 2015-04-07  Philippe Normand  <pnormand@igalia.com>
2745
2746         [GStreamer] extra-headers and keep-alive properties for HTTP source element
2747         https://bugs.webkit.org/show_bug.cgi?id=143480
2748
2749         Reviewed by Carlos Garcia Campos.
2750
2751         Keep the resource loader around when persistent HTTP connection
2752         support is enabled. The keep-alive property is set to false by
2753         default. Also before sending the HTTP request we now check the
2754         contents of the extra-headers GstStructure and set additional
2755         headers based on the structure contents.
2756
2757         Patch inspired by GStreamer's souphttpsrc element.
2758
2759         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2760         (webkit_web_src_init):
2761         (webKitWebSrcFinalize):
2762         (webKitWebSrcSetProperty):
2763         (webKitWebSrcGetProperty):
2764         (webKitWebSrcStop): Clear resource loader only for non-persistent connections.
2765         (webKitWebSrcSetExtraHeader): Utility function to append headers
2766         to an existing request based on a GValue contents.
2767         (webKitWebSrcProcessExtraHeaders): Parse a GValue and set headers
2768         based on its contents.
2769         (webKitWebSrcStart): Extra headers and persistent connection
2770         support. The resource loader is now lazily initialized here.
2771
2772 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
2773
2774         Fix the build.
2775
2776         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2777         (WebCore::FontCascade::drawGlyphs):
2778         * platform/spi/cg/CoreGraphicsSPI.h:
2779
2780 2015-04-07  Chris Dumez  <cdumez@apple.com>
2781
2782         Unreviewed, another iOS build fix after r182516.
2783
2784         I missed another use of __MAC_OS_X_VERSION_MIN_REQUIRED without a
2785         PLATFORM(MAC) check.
2786
2787         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2788
2789 2015-04-07  Michael Peechatt  <mpeechatt@gmail.com>
2790
2791         Bug 142887 - role progress bar does not support indeterminate state
2792         https://bugs.webkit.org/show_bug.cgi?id=142887
2793
2794         Reviewed by Chris Fleizach.
2795
2796         Test: platform/mac/accessibility/progressbar-indeterminate.html
2797
2798         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2799         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2800         When getting min or max value of an indeterminate progress indicator, return 0.
2801         This is so VoiceOver will recognize it as indeterminate.
2802
2803 2015-04-07  Chris Dumez  <cdumez@apple.com>
2804
2805         Unreviewed, speculative iOS build fix after r182516.
2806
2807         Add #if PLATFORM(MAC) checks.
2808
2809         * platform/spi/cg/CoreGraphicsSPI.h:
2810
2811 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
2812
2813         Try to fix incremental builds by forcing *InternalSettings* to get
2814         regenerated.
2815
2816         * testing/InternalSettings.idl:
2817
2818 2015-04-07  Chris Dumez  <cdumez@apple.com>
2819
2820         Open WebSockets should not prevent a page from entering PageCache
2821         https://bugs.webkit.org/show_bug.cgi?id=143505
2822         <rdar://problem/19923085>
2823
2824         Reviewed by Alexey Proskuryakov.
2825
2826         Open WebSockets should not prevent a page from entering PageCache. This
2827         is currently causing mobile.nytimes.com to not be page-cacheable.
2828
2829         In this patch, We close open WebSockets when entering the page cache
2830         and fire the "close" events after resuming, similarly to what we did
2831         for XMLHttpRequest in r181480. This gives a chance for the content to
2832         handle the 'close' event (with wasClean being false and code being
2833         1006) in order to reopen the connection if necessary.
2834
2835         Test: http/tests/websocket/tests/hybi/closed-when-entering-page-cache.html
2836
2837         * Modules/websockets/WebSocket.cpp:
2838         (WebCore::WebSocket::WebSocket):
2839         (WebCore::WebSocket::canSuspend):
2840         (WebCore::WebSocket::suspend):
2841         (WebCore::WebSocket::resume):
2842         (WebCore::WebSocket::resumeTimerFired):
2843         (WebCore::WebSocket::didClose):
2844         * Modules/websockets/WebSocket.h:
2845
2846 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
2847
2848         Add experimental code to use custom font dilation when rendering into non-opaque contexts
2849         https://bugs.webkit.org/show_bug.cgi?id=143508
2850
2851         Reviewed by Sam Weinig.
2852
2853         Add GraphicsContext::setAntialiasedFontDilationEnabled(), and set it to true
2854         when rendering into a compositing layer which is not opaque (at the same location
2855         where we disable font smoothing).
2856
2857         If Settings::antialiasedFontDilationEnabled() is true, when rendering non-smoothed
2858         text (and if CSS hasn't opted into antialiased mode), use custom font dilation
2859         parameters, chosen using a light/medium/dark heuristic, to make this text
2860         match more closely with LCD-smoothed text.
2861
2862         * page/Settings.cpp:
2863         (WebCore::Settings::Settings):
2864         (WebCore::Settings::setAntialiasedFontDilationEnabled): Set global state
2865         in FontCascade (which can't easily get at Settings). This it not ideal,
2866         but is temporary.
2867         * page/Settings.h:
2868         (WebCore::Settings::antialiasedFontDilationEnabled):
2869         * page/Settings.in: Can't autogenerate this setting any more.
2870         * platform/graphics/FontCascade.cpp:
2871         (WebCore::FontCascade::setAntialiasedFontDilationEnabled): Set the global.
2872         (WebCore::FontCascade::antialiasedFontDilationEnabled):
2873         * platform/graphics/FontCascade.h:
2874         * platform/graphics/GraphicsContext.cpp:
2875         (WebCore::GraphicsContext::setAntialiasedFontDilationEnabled): Set graphics state
2876         to say that we should do dilation of antialiased text.
2877         * platform/graphics/GraphicsContext.h:
2878         (WebCore::GraphicsContextState::GraphicsContextState):
2879         (WebCore::GraphicsContext::antialiasedFontDilationEnabled):
2880         * platform/graphics/ca/mac/PlatformCALayerMac.mm:
2881         (PlatformCALayer::drawLayerContents): If the layer is not opaque, enable the
2882         dilated text code path.
2883         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2884         (WebCore::dilationSizeForTextColor): Heuristic (values chosen empirically) to
2885         computed custom dilation based on foreground color.
2886         (WebCore::FontCascade::drawGlyphs): Set the custom dilation parameters, and the
2887         antialiasing state if we're not doing smoothing, and CSS hasn't opted into the
2888         antialiased path.
2889         * platform/spi/cg/CoreGraphicsSPI.h: New SPI.
2890
2891 2015-04-07  Commit Queue  <commit-queue@webkit.org>
2892
2893         Unreviewed, rolling out r182511.
2894         https://bugs.webkit.org/show_bug.cgi?id=143507
2895
2896         caused debug test failures (Requested by alexchristensen on
2897         #webkit).
2898
2899         Reverted changeset:
2900
2901         "Block popups from content extensions."
2902         https://bugs.webkit.org/show_bug.cgi?id=143497
2903         http://trac.webkit.org/changeset/182511
2904
2905 2015-04-07  Myles C. Maxfield  <mmaxfield@apple.com>
2906
2907         [Cocoa] System fonts do not get correct tracking
2908         https://bugs.webkit.org/show_bug.cgi?id=143395
2909
2910         Reviewed by Ryosuke Niwa.
2911
2912         Inside FontPlatformData, we have two CTFonts. If the user has specified
2913         -webkit-system-font, we will pass in a CTFont, and the FontPlatformData
2914         will wrap it. However, we will then roundtrip through CGFont in order
2915         to create a second CTFont. We were basing our tracking and system
2916         font knowledge off of this round-tripped font instead of the original font.
2917
2918         Note that this design is terrible and needs to be overhauled.
2919         FontPlatformData should only have a single platform font inside it.
2920
2921         This patch also caches whether or not a font is a system font.
2922
2923         No new tests because it is impossible to test the tracking of the
2924         system font in a robust way.
2925
2926         * platform/graphics/Font.cpp:
2927         (WebCore::Font::Font): Rearrange member variables.
2928         * platform/graphics/Font.h: Move member variables around for better
2929         packing, and cache whether or not the font is a system font.
2930         * platform/graphics/FontData.h: Add comment
2931         * platform/graphics/cocoa/FontCocoa.mm:
2932         (WebCore::Font::platformInit): Cache whether or not the font is a system
2933         font.
2934         (WebCore::hasCustomTracking): Use cached value.
2935         (WebCore::canUseFastGlyphAdvanceGetter):
2936         (WebCore::Font::platformWidthForGlyph):
2937
2938 2015-04-07  Alex Christensen  <achristensen@webkit.org>
2939
2940         Block popups from content extensions.
2941         https://bugs.webkit.org/show_bug.cgi?id=143497
2942
2943         Reviewed by Brady Eidson.
2944
2945         Test: http/tests/contentextensions/popups.html
2946
2947         * loader/ResourceLoadInfo.cpp:
2948         (WebCore::readResourceType):
2949         * loader/ResourceLoadInfo.h:
2950         * page/DOMWindow.cpp:
2951         (WebCore::DOMWindow::open):
2952         * page/UserContentController.cpp:
2953         (WebCore::UserContentController::actionsForResourceLoad):
2954         * page/UserContentController.h:
2955         Check content extensions before opening a window.
2956
2957 2015-04-07  Benjamin Poulain  <benjamin@webkit.org>
2958
2959         Get the features.json files ready for open contributions
2960         https://bugs.webkit.org/show_bug.cgi?id=143436
2961
2962         Reviewed by Darin Adler.
2963
2964         * features.json:
2965
2966 2015-04-07  Alex Christensen  <achristensen@webkit.org>
2967
2968         More unreviewed fixing API tests.
2969
2970         * contentextensions/ContentExtensionsBackend.cpp:
2971         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
2972         Don't check for javascript protocol.
2973
2974 2015-04-07  Eric Carlson  <eric.carlson@apple.com>
2975
2976         [Mac] never update caption user style sheet during parsing
2977         https://bugs.webkit.org/show_bug.cgi?id=143499
2978
2979         Reviewed by Jer Noble.
2980
2981         * page/CaptionUserPreferencesMediaAF.cpp:
2982         (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
2983         (WebCore::CaptionUserPreferencesMediaAF::captionPreferencesChanged):  Ignore a
2984             "preferences changed" notification fired while registering for said notification, we 
2985             already create and insert the style sheet after a brief delay anyway.
2986         * page/CaptionUserPreferencesMediaAF.h:
2987
2988 2015-04-07  Alex Christensen  <achristensen@webkit.org>
2989
2990         [Win] Unreviewed build fix after r182494.
2991
2992         * platform/win/ContextMenuItemWin.cpp:
2993         (WebCore::ContextMenuItem::ContextMenuItem): Deleted.
2994
2995 2015-04-07  Alex Christensen  <achristensen@webkit.org>
2996
2997         Unreviewed fixing API tests.
2998
2999         * contentextensions/ContentExtensionsBackend.cpp:
3000         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
3001         * platform/URL.cpp:
3002         (WebCore::URL::init):
3003         * platform/URL.h:
3004         (WebCore::URL::protocolIsData):
3005         (WebCore::URL::protocolIsJavaScript): Deleted.
3006         Revert part of r182492 that changed URL.h.
3007
3008 2015-04-07  Anders Carlsson  <andersca@apple.com>
3009
3010         More work on making the application cache storage be per page
3011         https://bugs.webkit.org/show_bug.cgi?id=143498
3012
3013         Reviewed by Andreas Kling.
3014
3015         * loader/appcache/ApplicationCacheStorage.cpp:
3016         (WebCore::ApplicationCacheStorage::create):
3017         (WebCore::ApplicationCacheStorage::singleton):
3018         * loader/appcache/ApplicationCacheStorage.h:
3019         * page/Page.cpp:
3020         (WebCore::Page::Page):
3021         * page/Page.h:
3022         (WebCore::Page::applicationCacheStorage):
3023         * page/PageConfiguration.cpp:
3024         (WebCore::PageConfiguration::PageConfiguration): Deleted.
3025         * page/PageConfiguration.h:
3026
3027 2015-04-07  Matthew Mirman  <mmirman@apple.com>
3028
3029         Source and stack information should get appended only to native errors
3030         and should be added directly after construction rather than when thrown.
3031         This fixes frozen objects being unfrozen when thrown while conforming to 
3032         ecma script standard and other browser behavior.
3033         rdar://problem/19927293
3034         https://bugs.webkit.org/show_bug.cgi?id=141871
3035         
3036         Reviewed by Geoffrey Garen.
3037
3038         Covered by existing tests.
3039         
3040         Sets line, column, source and stack information for DOMExceptions as 
3041         expected by the webinspector for native errors.
3042         
3043         * bindings/js/JSDOMBinding.cpp:
3044         (WebCore::setDOMException):
3045
3046 2015-04-07  Brady Eidson  <beidson@apple.com>
3047
3048         ContextMenuItem refactoring
3049         https://bugs.webkit.org/show_bug.cgi?id=143485
3050
3051         Reviewed by Beth Dakin.
3052
3053         * platform/ContextMenuItem.h:
3054         (WebCore::ContextMenuItem::isNull):
3055
3056         * platform/gtk/ContextMenuItemGtk.cpp:
3057         (WebCore::ContextMenuItem::ContextMenuItem):
3058
3059         * platform/mac/ContextMenuItemMac.mm:
3060         (WebCore::ContextMenuItem::ContextMenuItem):
3061         (WebCore::ContextMenuItem::platformDescription):
3062         (WebCore::ContextMenuItem::setSubMenu):
3063         (WebCore::ContextMenuItem::releasePlatformDescription): Deleted.
3064         (WebCore::ContextMenuItem::getPlatformDescription): Deleted.
3065
3066         * platform/mac/ContextMenuMac.mm:
3067         (WebCore::ContextMenu::appendItem):
3068         (WebCore::ContextMenu::insertItem):
3069         (WebCore::platformMenuDescription):
3070
3071         * platform/win/ContextMenuItemWin.cpp:
3072         (WebCore::ContextMenuItem::ContextMenuItem):
3073
3074 2015-04-07  Alex Christensen  <achristensen@webkit.org>
3075
3076         Optimize content extensions interpreting speed.
3077         https://bugs.webkit.org/show_bug.cgi?id=143490
3078
3079         Reviewed by Brady Eidson.
3080
3081         * contentextensions/ContentExtensionCompiler.cpp:
3082         (WebCore::ContentExtensions::compileRuleList):
3083         * contentextensions/ContentExtensionsBackend.cpp:
3084         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
3085         Measure total time added by content extensions.
3086         * contentextensions/DFABytecodeCompiler.cpp:
3087         (WebCore::ContentExtensions::DFABytecodeCompiler::compileNode):
3088         (WebCore::ContentExtensions::DFABytecodeCompiler::compile):
3089         When jumping to the root, don't re-add all the actions.
3090         * contentextensions/DFABytecodeCompiler.h:
3091         * platform/URL.cpp:
3092         (WebCore::URL::init):
3093         * platform/URL.h:
3094         (WebCore::URL::protocolIsJavaScript): Added.
3095
3096 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
3097
3098         Add a new setting, AntialiasedFontDilationEnabled, exposed via WK2.
3099         https://bugs.webkit.org/show_bug.cgi?id=143495
3100
3101         Reviewed by Tim Horton.
3102
3103         Add a new Setting, antialiasedFontDilationEnabled, which defaults to true. This 
3104         will be used in an upcoming patch.
3105
3106         * page/Settings.in:
3107
3108 2015-04-07  Andy Estes  <aestes@apple.com>
3109
3110         [Content Filtering] Add logging
3111         https://bugs.webkit.org/show_bug.cgi?id=143470
3112
3113         Reviewed by Daniel Bates.
3114
3115         Added a new ContentFiltering logging channel, and started logging some useful diagnostic messages.
3116
3117         * loader/ContentFilter.cpp:
3118         (WebCore::ContentFilter::~ContentFilter):
3119         (WebCore::ContentFilter::willSendRequest):
3120         (WebCore::ContentFilter::startFilteringMainResource):
3121         (WebCore::ContentFilter::responseReceived):
3122         (WebCore::ContentFilter::dataReceived):
3123         (WebCore::ContentFilter::notifyFinished):
3124         (WebCore::ContentFilter::didDecide):
3125         * platform/Logging.h:
3126         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
3127         (WebCore::ContentFilterUnblockHandler::canHandleRequest):
3128         (WebCore::ContentFilterUnblockHandler::requestUnblockAsync):
3129         * platform/cocoa/NetworkExtensionContentFilter.mm:
3130         (WebCore::NetworkExtensionContentFilter::enabled):
3131         (WebCore::NetworkExtensionContentFilter::unblockHandler):
3132         (WebCore::NetworkExtensionContentFilter::handleDecision):
3133         * platform/cocoa/ParentalControlsContentFilter.mm:
3134         (WebCore::ParentalControlsContentFilter::enabled):
3135         (WebCore::ParentalControlsContentFilter::updateFilterState):
3136         * testing/MockContentFilter.cpp:
3137         (WebCore::MockContentFilter::enabled):
3138         (WebCore::MockContentFilter::unblockHandler):
3139         (WebCore::MockContentFilter::maybeDetermineStatus):
3140
3141 2015-04-07  Eric Carlson  <eric.carlson@apple.com>
3142
3143         [Mac] video playing to external device should not be interrupted
3144         https://bugs.webkit.org/show_bug.cgi?id=143492
3145
3146         Reviewed by Jer Noble.
3147
3148         * Modules/mediacontrols/mediaControlsApple.js:
3149         (Controller.prototype.handlePanelTransitionEnd):  Drive-by fix to make sure the controls are 
3150             not hidden if the opacity timer is primed before they go into a state where they should
3151             never be hidden.
3152
3153         * html/HTMLMediaElement.cpp:
3154         (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget): Make it const.
3155         (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget): New.
3156         * html/HTMLMediaElement.h:
3157
3158         * html/HTMLMediaSession.cpp:
3159         (WebCore::HTMLMediaSession::canPlayToWirelessPlaybackTarget): New. Short-circuit call to
3160             client when we already know the answer.
3161         (WebCore::HTMLMediaSession::isPlayingToWirelessPlaybackTarget): Ditto.
3162         (WebCore::HTMLMediaSession::startPlayingToPlaybackTarget): Ditto.
3163         (WebCore::HTMLMediaSession::stopPlayingToPlaybackTarget): Ditto.
3164         * html/HTMLMediaSession.h:
3165
3166         * platform/audio/MediaSession.cpp:
3167         (WebCore::MediaSession::canPlayToWirelessPlaybackTarget): Deleted, moved inline and neutered
3168             because only HTMLMediaSession needs to use them.
3169         (WebCore::MediaSession::startPlayingToPlaybackTarget): Ditto.
3170         (WebCore::MediaSession::stopPlayingToPlaybackTarget): Ditto.
3171         * platform/audio/MediaSession.h:
3172         (WebCore::MediaSession::canPlayToWirelessPlaybackTarget):
3173         (WebCore::MediaSession::isPlayingToWirelessPlaybackTarget):
3174         (WebCore::MediaSession::startPlayingToPlaybackTarget):
3175         (WebCore::MediaSession::stopPlayingToPlaybackTarget):
3176         (WebCore::MediaSessionClient::canPlayToWirelessPlaybackTarget):
3177         (WebCore::MediaSessionClient::isPlayingToWirelessPlaybackTarget):
3178
3179         * platform/audio/MediaSessionManager.cpp:
3180         (WebCore::MediaSessionManager::MediaSessionManager):
3181         (WebCore::MediaSessionManager::sessionShouldBeginPlayingToWirelessPlaybackTarget): New.
3182         (WebCore::MediaSessionManager::sessionWillBeginPlayback): Don't interrupt an active session
3183             playing to a target device.
3184         * platform/audio/MediaSessionManager.h:
3185
3186         * platform/graphics/MediaPlayer.cpp:
3187         (WebCore::MediaPlayer::isPlayingToWirelessPlaybackTarget): New, passthrough.
3188         * platform/graphics/MediaPlayer.h:
3189         * platform/graphics/MediaPlayerPrivate.h:
3190         (WebCore::MediaPlayerPrivateInterface::isPlayingToWirelessPlaybackTarget):
3191
3192         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3193         (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayToWirelessPlaybackTarget):
3194         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3195         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Explicitly call 
3196             when passed a nil or inactive target context.
3197         (WebCore::MediaPlayerPrivateAVFoundationObjC::startPlayingToPlaybackTarget): Add logging.
3198         (WebCore::MediaPlayerPrivateAVFoundationObjC::stopPlayingToPlaybackTarget): Ditto.
3199         (WebCore::MediaPlayerPrivateAVFoundationObjC::isPlayingToWirelessPlaybackTarget): New. Return
3200             true when playing with an active context.
3201         (WebCore::playerKVOProperties): "outputContext" is not observable.
3202
3203 2015-04-07  Sam Weinig  <sam@webkit.org>
3204
3205         Re-add JSReadableStream and JSReadableStreamReader the Xcode project to
3206         make Xcode happy.
3207
3208         * WebCore.xcodeproj/project.pbxproj:
3209
3210 2015-02-25  Sergio Villar Senin  <svillar@igalia.com>
3211
3212         [CSS Grid Layout] Update track sizes after distributing extra space
3213         https://bugs.webkit.org/show_bug.cgi?id=141422
3214
3215         Reviewed by Antti Koivisto.
3216
3217         Both old and new tracks sizing algorithms instruct us to update
3218         the sizes of the content sized tracks only after distributing the
3219         extra space for all the items in the same span group. So far we
3220         were doing it inside distributeSpaceToTracks(), i.e., once for
3221         every single item. That is wrong because it makes the algorithm
3222         order dependent.
3223
3224         Our old implementation looked something like this (pseudocode):
3225
3226         resolveContentBasedTrackSizingFunctions()
3227           foreach item
3228             resolveContentBasedTrackSizingFunctionsForItems() (x4)
3229               distributeSpaceToTracks()
3230                 updateTrackSizes()
3231
3232         Now it's done this way (pseudocode):
3233
3234         resolveContentBasedTrackSizingFunctions()
3235           foreach spanGroup
3236             resolveContentBasedTrackSizingFunctionsForItems() (x4)
3237               foreach item in spanGroup
3238                 distributeSpaceToTracks()
3239               updateTrackSizes()
3240
3241         As it can be seen the update of track sizes only happens after
3242         processing all the items of a given span group. In order to
3243         accomplish this a new field was added to GridTrack called
3244         tempIncrease which stores per-track increases while distributing
3245         the extra space among the items in the same span group. That
3246         temporal increase could eventually be used to update the
3247         plannedIncrease which is the one we use to finally set the new
3248         size of the track.
3249
3250         This change makes our implementation closer to the spec, removes
3251         the order dependency and ensures that every track satisfies their
3252         min track sizing functions before starting to consider the max
3253         track sizing functions.
3254
3255         Test: fast/css-grid-layout/grid-update-sizes-after-distributing-all.html
3256
3257         * rendering/RenderGrid.cpp:
3258         (WebCore::GridTrack::plannedSize):
3259         (WebCore::GridTrack::setPlannedSize): New setter.
3260         (WebCore::GridTrack::tempSize): New attribute.
3261         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
3262         RenderGrid::distributeSpaceToTracks() no longer updates the track
3263         sizes so we have to do it after the call returns.
3264         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
3265         Call RenderGrid::resolveContentBasedTrackSizingFunctionsForItems()
3266         passing a span group instead of a single item.
3267         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
3268         It now receives a span group instead of a single item. Apart from
3269         that we need an extra function to get the unaltered track size (as
3270         the current one returns the base size whenever the growth limit is
3271         infinity).
3272         (WebCore::RenderGrid::distributeSpaceToTracks): This no longer
3273         updates track sizes but only the track's planned size;
3274         * rendering/RenderGrid.h:
3275
3276 2015-04-06  Chris Dumez  <cdumez@apple.com>
3277
3278         Bing video search result pages are not PageCacheable
3279         https://bugs.webkit.org/show_bug.cgi?id=143463
3280         <rdar://problem/20440916>
3281
3282         Reviewed by Alexey Proskuryakov.
3283
3284         Bing video search result pages are not PageCacheable (tested on iOS).
3285         It both:
3286         - is bad for power usage as it causes a reload when clicking one of the
3287           results then navigating back in history.
3288         - degrades user experience because the results page uses infinite
3289           scrolling and the scroll position is not properly restored when
3290           navigating back, not to mention the user has to wait for the reload
3291           to complete.
3292
3293         The issue was that the bing search page was doing a ping load when
3294         clicking on one of the search results. The ping load was done by
3295         create an image and its 'src' attribute to the ping URL. This load
3296         usually did not have time to complete when navigating away so we would
3297         cancel it and the main document would end up with an error that would
3298         prevent the page from entering the page cache. We already have code
3299         making sure load cancellations do not prevent page caching as long as
3300         the loads are for XHR or images. However, the latter check was broken
3301         in the case where the ResourceRequest's cachePartition was non-empty.
3302         This is because the check was using the MemoryCache::ResourceForUrl()
3303         API which rarely does what we want because it will request a dummy
3304         ResourceRequest (without cachePartition) and then call
3305         MemoryCache::resourceForRequest(). This patch updates the check
3306         to use resourceForRequest() directly as we have the ResourceRequest
3307         at this point.
3308
3309         This patch also gets rid of the  MemoryCache::ResourceForUrl() API as
3310         it rarely does what we want and it is bug prone. It was only used in
3311         2 places, one of them causing this bug and the other in Internals.
3312
3313         Tests: http/tests/navigation/page-cache-pending-image-load-cache-partition.html
3314                http/tests/navigation/page-cache-pending-image-load.html
3315
3316         * loader/DocumentLoader.cpp:
3317         (WebCore::areAllLoadersPageCacheAcceptable):
3318         Use MemoryCache::resourceForRequest() instead of resourceForUrl() as
3319         we have the ResourceRequest and calling resourceForUrl() would loose
3320         the cachePartition.
3321
3322         * loader/cache/MemoryCache.cpp:
3323         (WebCore::MemoryCache::resourceForURL): Deleted.
3324         Drop this API as it is bug prone and rarely does what we want.
3325
3326         * testing/Internals.cpp:
3327         (WebCore::Internals::isLoadingFromMemoryCache):
3328         Update call to create a dummy ResourceRequest and call
3329         resourceForRequest() instead of resourceForUrl(), as this API no
3330         longer exists. The new code also set the cachePartition on the
3331         dummy request so that this function actually behaves as expected
3332         if the cachePartition in the memory cache is non-empty.
3333
3334
3335 2015-04-06  Jer Noble  <jer.noble@apple.com>
3336
3337         Synchronize fullscreen animation between processes.
3338         https://bugs.webkit.org/show_bug.cgi?id=143131
3339
3340         Reviewed by Simon Fraser.
3341
3342         Rather than attempt to synchcronize animations across the WebProcess / UIProcess boundary,
3343         do the bounds-change animation in-process by applying a sublayer transformation to the
3344         video layer. This gives the same visual effect as a synchronized bounds animation, but
3345         without needing a synchronization fence. Resolve the difference between the transformation
3346         and bounds by doing a fence-synchronized bounds change after the current animation is
3347         scheduled to complete.
3348
3349         To do this calculation correctly, WebAVPlayer needs to query both the effective
3350         videoLayerFrame and the videoLayerGravity. To that end, add getter methods for
3351         videoLayerFrame() and videoLayerGravity().
3352
3353         * html/HTMLMediaElement.h:
3354         (WebCore::HTMLMediaElement::videoFullscreenGravity):
3355         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3356         (-[WebAVVideoLayer dealloc]): Cancel outstanding performSelector requests.
3357         (-[WebAVVideoLayer setBounds:]): Add a scale transform to simulate a bonuds change.
3358         (-[WebAVVideoLayer resolveBounds]): Reset the scale transform and set the bounds.
3359         (WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal): Set the initial video frame bounds.
3360         (-[WebAVPlayerController layoutSublayersOfLayer:]): Deleted.
3361         * platform/ios/WebVideoFullscreenModel.h:
3362         * platform/ios/WebVideoFullscreenModelVideoElement.h:
3363         * platform/ios/WebVideoFullscreenModelVideoElement.mm:
3364         (WebVideoFullscreenModelVideoElement::videoLayerFrame): Added; simple getter.
3365         (WebVideoFullscreenModelVideoElement::videoLayerGravity): Ditto.
3366
3367 2015-04-06  Zalan Bujtas  <zalan@apple.com>
3368
3369         Simple line layout: RunResolver::Iterator class cleanup.
3370         https://bugs.webkit.org/show_bug.cgi?id=143445
3371
3372         Reviewed by Antti Koivisto.
3373
3374         1. SimpleLineLayout::Run is an intermediate structure and should not be publicly accessible through RunResolver::Iterator.
3375         RunResolver::Run is the class to use to access run properties.
3376         2. Also move advance()/advanceLine() to private. Callers should use LineResolver to advance on lines.
3377
3378         No change in functionality.
3379
3380         * rendering/SimpleLineLayoutResolver.h:
3381
3382 2015-04-06  Simon Fraser  <simon.fraser@apple.com>
3383
3384         Use a RenderObject bit for isRenderFlowThread()
3385         https://bugs.webkit.org/show_bug.cgi?id=143439
3386
3387         Reviewed by Darin Adler.
3388
3389         Turning isRenderFlowThread() into a bit in rare data rather than a virtual function reduces
3390         the time under RenderLayer::scrollTo() on a large overflow:scroll table from 56% to 44%.
3391
3392         * rendering/RenderFlowThread.cpp:
3393         (WebCore::RenderFlowThread::RenderFlowThread):
3394         * rendering/RenderFlowThread.h:
3395         * rendering/RenderObject.cpp:
3396         (WebCore::RenderObject::setIsRenderFlowThread):
3397         * rendering/RenderObject.h:
3398         (WebCore::RenderObject::isDragging):
3399         (WebCore::RenderObject::hasReflection):
3400         (WebCore::RenderObject::isRenderFlowThread):
3401         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
3402
3403 2015-04-06  Myles C. Maxfield  <mmaxfield@apple.com>
3404
3405         [Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter
3406         https://bugs.webkit.org/show_bug.cgi?id=143402
3407
3408         Reviewed by Darin Adler.
3409
3410         There are a few pieces to the converter that Windows requires that we haven't already
3411         implemented:
3412         1. Checksums were being calculated with the wrong endianness
3413         2. Windows requires a format 4 'cmap' subtable in addition to the format 12 one we already
3414         were using
3415         3. Windows requires a reference to a Private DICT inside the CFF table, even if the DICT
3416         is of 0 length.
3417
3418         Covered by all our existing SVG font tests.
3419
3420         * svg/SVGFontFaceElement.h: Add capHeight accessor.
3421         * svg/SVGFontFaceElement.cpp:
3422         (WebCore::SVGFontFaceElement::capHeight): Ditto.
3423         * svg/SVGToOTFConversion.cpp: Update the conversion process according to the above
3424         requirements.
3425         (WebCore::SVGToOTFFontConverter::appendFormat12CMAPTable):
3426         (WebCore::SVGToOTFFontConverter::appendFormat4CMAPTable):
3427         (WebCore::SVGToOTFFontConverter::appendCMAPTable): Use helpers.
3428         (WebCore::SVGToOTFFontConverter::appendHHEATable): Use member variables.
3429         (WebCore::SVGToOTFFontConverter::appendOS2Table): Update to version 2.
3430         (WebCore::SVGToOTFFontConverter::appendCFFTable): Create a reference to a
3431         zero-sized Private DICT
3432         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Populate member
3433         variables.
3434         (WebCore::SVGToOTFFontConverter::calculateChecksum): Flip endianness
3435
3436 2015-04-06  Yusuke Suzuki  <utatane.tea@gmail.com>
3437
3438         Return Optional<uint32_t> from PropertyName::asIndex
3439         https://bugs.webkit.org/show_bug.cgi?id=143422
3440
3441         Reviewed by Darin Adler.
3442
3443         * bindings/js/JSDOMWindowCustom.cpp:
3444         (WebCore::JSDOMWindow::getOwnPropertySlot):
3445         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
3446         * bindings/js/JSHTMLAllCollectionCustom.cpp:
3447         (WebCore::callHTMLAllCollection):
3448         (WebCore::JSHTMLAllCollection::item):
3449         * bindings/scripts/CodeGeneratorJS.pm:
3450         (GenerateGetOwnPropertySlotBody):
3451         (GenerateImplementation):
3452         * bindings/scripts/test/JS/JSFloat64Array.cpp:
3453         (WebCore::JSFloat64Array::getOwnPropertySlot):
3454         (WebCore::JSFloat64Array::getOwnPropertyDescriptor):
3455         (WebCore::JSFloat64Array::put):
3456         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3457         (WebCore::JSTestEventTarget::getOwnPropertySlot):
3458         * bridge/runtime_array.cpp:
3459         (JSC::RuntimeArray::getOwnPropertySlot):
3460         (JSC::RuntimeArray::put):
3461
3462 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
3463
3464         FileList constructor should move the passed-in Vector<> rvalue reference into the member variable
3465         https://bugs.webkit.org/show_bug.cgi?id=143412
3466
3467         Reviewed by Darin Adler.
3468
3469         * fileapi/FileList.h:
3470         (WebCore::FileList::FileList): An explicit move of the passed-in rvalue
3471         reference into the member variable is required, otherwise a copy is
3472         performed since an rvalue reference is just an lvalue.
3473
3474 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
3475
3476         UserScript, UserStyleSheet constructors should take in Vector<String> rvalue references
3477         https://bugs.webkit.org/show_bug.cgi?id=143411
3478
3479         Reviewed by Darin Adler.
3480
3481         Have the UserScript and UserStyleSheet constructors take in Vector<String>
3482         rvalue references for the whitelist and blacklist parameters. Both classes
3483         store these Vector<String> objects, so the referenced objects can simply be
3484         moved into the member variable.
3485
3486         Because the constructor is now demanding an rvalue, it's up to the caller
3487         to move in the desired object if possible, or create an explicit copy
3488         otherwise.
3489
3490         * page/UserScript.h:
3491         (WebCore::UserScript::UserScript):
3492         * page/UserStyleSheet.h:
3493         (WebCore::UserStyleSheet::UserStyleSheet):
3494
3495 2015-04-05  Andy Estes  <aestes@apple.com>
3496
3497         [Content Filtering] Only pass http(s) requests to -[NEFilterSource willSendRequest:...]
3498         https://bugs.webkit.org/show_bug.cgi?id=143437
3499
3500         Reviewed by Dan Bernstein.
3501
3502         No new tests. We can't test NEFilterSource directly.
3503
3504         * platform/cocoa/NetworkExtensionContentFilter.mm:
3505         (WebCore::NetworkExtensionContentFilter::willSendRequest): Immediately allow requests with url schemes other than http and https.
3506
3507 2015-04-05  Darin Adler  <darin@apple.com>
3508
3509         FrameView code uses page() without null checking
3510         https://bugs.webkit.org/show_bug.cgi?id=143425
3511         rdar://problem/18920601
3512
3513         Reviewed by Anders Carlsson.
3514
3515         While we don't have tests that cover this, we are seeing crashes coming in
3516         that indicate the shouldEnableSpeculativeTilingDuringLoading function is
3517         being called when the page is null. This patch adds null checks to all the
3518         places in FrameView that use page() without doing null checking.
3519
3520         * page/FrameView.cpp:
3521         (WebCore::FrameView::layout): If page is null, don't try to do the
3522         auto-sizing logic that involves the textAutosizingWidth value from the page.
3523         (WebCore::FrameView::setFixedVisibleContentRect): Get settings from the
3524         frame rather than the page to avoid possible null-dereference.
3525         (WebCore::FrameView::scrollPositionChanged): Check the page for null when
3526         getting the event throttling delay.
3527         (WebCore::FrameView::updateLayerFlushThrottling): Check the page for null,
3528         and return early if it is null.
3529         (WebCore::shouldEnableSpeculativeTilingDuringLoading): Check the page for
3530         null, and return false if it is null.
3531         (WebCore::FrameView::performPostLayoutTasks): Guard the code that calls
3532         didLayout on the page client by a check if the page is null.
3533         (WebCore::FrameView::pagination): Don't call Page::pagination on a null
3534         page here.
3535         (WebCore::FrameView::visibleContentScaleFactor): Use a scale factor of 1
3536         if the page is null.
3537         (WebCore::FrameView::setVisibleScrollerThumbRect): Don't call through to
3538         the page client if the page is null.
3539         (WebCore::FrameView::scrollbarStyleChanged): Ditto.
3540         (WebCore::FrameView::setScrollPinningBehavior): Check the page for null
3541         before asking it for the scrolling coordinator.
3542
3543 2015-04-05  Simon Fraser  <simon.fraser@apple.com>
3544
3545         Free up some bits in RenderObject by moving rarely used bits into a side table
3546         https://bugs.webkit.org/show_bug.cgi?id=143432
3547
3548         Reviewed by Darin Adler.
3549         
3550         Add a side table (global hash) on RenderObject to store data that is rarely
3551         used. Move the "isDragging" and "hasReflection" bits there. Re-use one of
3552         those bits for "hasRareData", and leave the other unused (I have plans for it).
3553         
3554         * rendering/RenderBlock.cpp:
3555         (WebCore::getBlockRareData): Renamed for consistency.
3556         (WebCore::ensureBlockRareData): Renamed to avoid conflict with RenderObject::ensureRareData().
3557         (WebCore::RenderBlock::cachedFlowThreadContainingBlock):
3558         (WebCore::RenderBlock::cachedFlowThreadContainingBlockNeedsUpdate):
3559         (WebCore::RenderBlock::setCachedFlowThreadContainingBlockNeedsUpdate):
3560         (WebCore::RenderBlock::updateCachedFlowThreadContainingBlock):
3561         (WebCore::RenderBlock::locateFlowThreadContainingBlock):
3562         (WebCore::RenderBlock::paginationStrut):
3563         (WebCore::RenderBlock::pageLogicalOffset):
3564         (WebCore::RenderBlock::setPaginationStrut):
3565         (WebCore::RenderBlock::setPageLogicalOffset):
3566         (WebCore::getRareData): Deleted.
3567         (WebCore::ensureRareData): Deleted.
3568         * rendering/RenderObject.cpp:
3569         (WebCore::RenderObject::~RenderObject): Assert that rare data hasn't been resurrected
3570         since willBeDestroyed().
3571         (WebCore::RenderObject::willBeDestroyed): Clear the rare data.
3572         (WebCore::RenderObject::setIsDragging): If setting, ensure that we have rare data and
3573         set the bit. Otherwise, only clear the bit of we have rare data.
3574         (WebCore::RenderObject::setHasReflection): Ditto.
3575         (WebCore::RenderObject::rareDataMap):
3576         (WebCore::RenderObject::rareData):
3577         (WebCore::RenderObject::ensureRareData):
3578         (WebCore::RenderObject::clearRareData):
3579         * rendering/RenderObject.h:
3580         (WebCore::RenderObject::isDragging): Fast-fail on the hasRareData() bit, then do the
3581         slower lookup in rare data.
3582         (WebCore::RenderObject::hasReflection): Ditto.
3583         (WebCore::RenderObject::setEverHadLayout): Moved up to group with other bit setters.
3584         (WebCore::RenderObject::hasRareData):
3585         (WebCore::RenderObject::setHasRareData):
3586         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
3587         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
3588         (WebCore::RenderObject::setHasReflection): Deleted. Out of line now.
3589         (WebCore::RenderObject::setIsDragging): Deleted. Ditto.
3590
3591 2015-04-05  Darin Adler  <darin@apple.com>
3592
3593         REGRESSION (r181778): Crash after scrolling Google search result page
3594         https://bugs.webkit.org/show_bug.cgi?id=143431
3595
3596         Reviewed by Simon Fraser.
3597
3598         I can't reproduce this crash, nor was I able to make a regression test,
3599         but the crash data makes it clear this is a null dereference.
3600
3601         * page/animation/AnimationController.cpp:
3602         (WebCore::AnimationControllerPrivate::scrollWasUpdated): Check the result
3603         of Frame::view for null. We know this is only called when there is a
3604         valid FrameView, but it can be called after Frame::m_view is already null.
3605
3606 2015-04-05  Andy Estes  <aestes@apple.com>
3607
3608         [Content Filtering] Tell the filter about requests and redirects
3609         https://bugs.webkit.org/show_bug.cgi?id=143414
3610         rdar://problem/19239549
3611
3612         Reviewed by Darin Adler.
3613
3614         Tests: contentfiltering/allow-after-will-send-request.html
3615                contentfiltering/block-after-will-send-request.html
3616                http/tests/contentfiltering/allow-after-redirect.html
3617                http/tests/contentfiltering/block-after-redirect.html
3618
3619         NEFilterSource supports making filter decisions based on NSURLRequests, so this patch adds support for telling
3620         ContentFilter about the original main resource request as well as redirect requests.
3621
3622         * bindings/js/JSMockContentFilterSettingsCustom.cpp: Updated decisionPoint values to include AfterWillSendRequest and AfterRedirect.
3623         (WebCore::JSMockContentFilterSettings::decisionPoint):
3624         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
3625         * loader/ContentFilter.cpp:
3626         (WebCore::ContentFilter::willSendRequest): Called willSendRequest() on each filter using forEachContentFilterUntilBlocked().
3627         (WebCore::ContentFilter::redirectReceived): Called willSendRequest().
3628         * loader/ContentFilter.h:
3629         * loader/DocumentLoader.cpp:
3630         (WebCore::DocumentLoader::willSendRequest): Called ContentFilter::willSendRequest() if there is a content filter.
3631         Asserted that this is not a redirect, and that ContentFilter does not set the request to null.
3632         * loader/SubresourceLoader.cpp:
3633         (WebCore::SubresourceLoader::willSendRequest): Called redirectReceived() instead of willSendRequest().
3634         * loader/cache/CachedRawResource.cpp:
3635         (WebCore::CachedRawResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects.
3636         (WebCore::CachedRawResource::willSendRequest): Deleted.
3637         * loader/cache/CachedRawResource.h:
3638         * loader/cache/CachedResource.cpp:
3639         (WebCore::CachedResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects.
3640         (WebCore::CachedResource::willSendRequest): Deleted.
3641         * loader/cache/CachedResource.h:
3642         * platform/PlatformContentFilter.h:
3643         * platform/cocoa/NetworkExtensionContentFilter.h:
3644         * platform/cocoa/NetworkExtensionContentFilter.mm:
3645         (WebCore::NetworkExtensionContentFilter::willSendRequest): Called responseReceived() if there was a redirectResponse.
3646         Then called -[NEFilterSource willSendRequest:decisionHandler:].
3647         * platform/cocoa/ParentalControlsContentFilter.h:
3648         * platform/spi/cocoa/NEFilterSourceSPI.h: Added a #define for NEFilterSourceOptionsPageData.
3649         * testing/MockContentFilter.cpp:
3650         (WebCore::MockContentFilter::willSendRequest): Added support for willSendRequest.
3651         * testing/MockContentFilter.h: Added decision points for AfterWillSendRequest and AfterRedirect.
3652         * testing/MockContentFilterSettings.h:
3653         * testing/MockContentFilterSettings.idl:
3654
3655 2015-04-05  Sungmann Cho  <sungmann.cho@navercorp.com>
3656
3657         Remove DocumentLoader::requestURL().
3658         https://bugs.webkit.org/show_bug.cgi?id=140001
3659
3660         Reviewed by Darin Adler.
3661
3662         No new tests, no behavior change.
3663
3664         * loader/DocumentLoader.cpp:
3665         (WebCore::DocumentLoader::documentURL):
3666         (WebCore::DocumentLoader::requestURL): Deleted.
3667         * loader/DocumentLoader.h:
3668         * loader/ResourceLoadNotifier.cpp:
3669         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
3670
3671 2015-04-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3672
3673         Use constants of sqlite3 directly for status of SQL result in webdatabase
3674         https://bugs.webkit.org/show_bug.cgi?id=143329
3675
3676         Reviewed by Darin Adler.
3677
3678         In webdatabase, it has used own constant vairables as well as using sqlite3 constants directly.
3679         It causes to use if~else statement which consumes more cpu cycles compared to switch~case. This
3680         patch makes to use constants of sqlite3. Additionally if~else statment is changed to switch~case
3681         to save cpu cycles.
3682
3683         No new tests, no behavior changes.
3684
3685         * Modules/webdatabase/Database.cpp:
3686         (WebCore::Database::performGetTableNames):
3687         * Modules/webdatabase/DatabaseBackendBase.cpp:
3688         (WebCore::retrieveTextResultFromDatabase):
3689         (WebCore::setTextValueInDatabase):
3690         (WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded):
3691         * Modules/webdatabase/DatabaseTracker.cpp:
3692         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
3693         (WebCore::DatabaseTracker::hasEntryForDatabase):
3694         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
3695         (WebCore::DatabaseTracker::origins):
3696         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
3697         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
3698         (WebCore::DatabaseTracker::setDatabaseDetails):
3699         (WebCore::DatabaseTracker::quotaForOriginNoLock):
3700         (WebCore::DatabaseTracker::setQuota):
3701         (WebCore::DatabaseTracker::addDatabase):
3702         (WebCore::DatabaseTracker::deleteOrigin):
3703         (WebCore::DatabaseTracker::deleteDatabase):
3704         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
3705         (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
3706         * Modules/webdatabase/SQLStatementBackend.cpp:
3707         (WebCore::SQLStatementBackend::execute):
3708         * Modules/webdatabase/SQLStatementBackend.h:
3709         * Modules/webdatabase/SQLTransactionBackend.cpp:
3710         (WebCore::SQLTransactionBackend::runCurrentStatementAndGetNextState):
3711         Change to use a reference instead of a pointer in arguemnt of execute().
3712         * loader/appcache/ApplicationCacheStorage.cpp:
3713         (WebCore::ApplicationCacheStorage::loadCacheGroup):
3714         (WebCore::ApplicationCacheStorage::loadManifestHostHashes):
3715         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
3716         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
3717         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
3718         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
3719         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
3720         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
3721         (WebCore::ApplicationCacheStorage::verifySchemaVersion):
3722         (WebCore::ApplicationCacheStorage::store):
3723         (WebCore::ApplicationCacheStorage::storeUpdatedType):
3724         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
3725         (WebCore::ApplicationCacheStorage::storeNewestCache):
3726         (WebCore::ApplicationCacheStorage::loadCache):
3727         (WebCore::ApplicationCacheStorage::remove):
3728         (WebCore::ApplicationCacheStorage::getManifestURLs):
3729         (WebCore::ApplicationCacheStorage::cacheGroupSize):
3730         (WebCore::ApplicationCacheStorage::deleteCacheGroupRecord):
3731         (WebCore::ApplicationCacheStorage::checkForMaxSizeReached):
3732         (WebCore::ApplicationCacheStorage::checkForDeletedResources):
3733         (WebCore::ApplicationCacheStorage::flatFileAreaSize):
3734         * loader/icon/IconDatabase.cpp:
3735         (WebCore::IconDatabase::checkIntegrity):
3736         (WebCore::IconDatabase::performURLImport):
3737         (WebCore::IconDatabase::pruneUnretainedIcons):
3738         (WebCore::readySQLiteStatement):
3739         (WebCore::IconDatabase::setIconIDForPageURLInSQLDatabase):
3740         (WebCore::IconDatabase::removePageURLFromSQLDatabase):
3741         (WebCore::IconDatabase::getIconIDForIconURLFromSQLDatabase):
3742         (WebCore::IconDatabase::addIconURLToSQLDatabase):
3743         (WebCore::IconDatabase::getImageDataForIconURLFromSQLDatabase):
3744         (WebCore::IconDatabase::removeIconFromSQLDatabase):
3745         (WebCore::IconDatabase::writeIconSnapshotToSQLDatabase):
3746         * platform/sql/SQLiteDatabase.cpp:
3747         (WebCore::SQLiteDatabase::setMaximumSize):
3748         * platform/sql/SQLiteDatabase.h:
3749         * platform/sql/SQLiteFileSystem.cpp:
3750         (WebCore::SQLiteFileSystem::getFileNameForNewDatabase):
3751         * platform/sql/SQLiteStatement.cpp:
3752         (WebCore::SQLiteStatement::step):
3753         (WebCore::SQLiteStatement::returnIntResults):
3754         (WebCore::SQLiteStatement::returnInt64Results):
3755
3756 2015-04-05  Simon Fraser  <simon.fraser@apple.com>
3757
3758         Remove "go ahead and" from comments
3759         https://bugs.webkit.org/show_bug.cgi?id=143421
3760
3761         Reviewed by Darin Adler, Benjamin Poulain.
3762
3763         Remove the phrase "go ahead and" from comments where it doesn't add
3764         anything (which is almost all of them).
3765
3766         * Modules/webdatabase/DatabaseTracker.cpp:
3767         (WebCore::DatabaseTracker::deleteOriginLockFor):
3768         * css/CSSFontFaceSrcValue.cpp:
3769         (WebCore::CSSFontFaceSrcValue::isSupportedFormat):
3770         * css/CSSPrimitiveValue.h:
3771         * css/StyleResolver.cpp:
3772         (WebCore::StyleResolver::styleForKeyframe):
3773         (WebCore::StyleResolver::styleForPage):
3774         (WebCore::StyleResolver::applyMatchedProperties):
3775         * editing/ApplyStyleCommand.cpp:
3776         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
3777         * loader/DocumentLoader.cpp:
3778         (WebCore::DocumentLoader::detachFromFrame):
3779         * loader/cache/CachedImage.cpp:
3780         (WebCore::CachedImage::addIncrementalDataBuffer):
3781         * loader/icon/IconDatabase.cpp:
3782         (WebCore::IconDatabase::performURLImport):
3783         * page/PageOverlay.cpp:
3784         (WebCore::PageOverlay::fadeAnimationTimerFired):
3785         * platform/ScrollView.cpp:
3786         (WebCore::ScrollView::updateScrollbars):
3787         (WebCore::ScrollView::scrollContents):
3788         * platform/graphics/DisplayRefreshMonitor.cpp:
3789         (WebCore::DisplayRefreshMonitor::create):
3790         * platform/graphics/GraphicsContext.cpp:
3791         * platform/graphics/mac/ComplexTextController.cpp:
3792         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3793         * platform/network/HTTPParsers.cpp:
3794         (WebCore::parseHTTPRefresh):
3795         * rendering/RenderBlock.cpp:
3796         (WebCore::RenderBlock::removeChild):
3797         (WebCore::RenderBlock::layoutPositionedObjects):
3798         (WebCore::RenderBlock::selectionGaps):
3799         (WebCore::RenderBlock::blockSelectionGaps):
3800         (WebCore::RenderBlock::absoluteRects):
3801         (WebCore::RenderBlock::absoluteQuads):
3802         (WebCore::RenderBlock::addFocusRingRects):
3803         * rendering/RenderBlockFlow.cpp:
3804         (WebCore::RenderBlockFlow::layoutBlockChild):
3805         (WebCore::RenderBlockFlow::handleAfterSideOfBlock):
3806         (WebCore::RenderBlockFlow::adjustBlockChildForPagination):
3807         (WebCore::RenderBlockFlow::insertFloatingObject):
3808         (WebCore::RenderBlockFlow::addOverhangingFloats):
3809         (WebCore::RenderBlockFlow::inlineSelectionGaps):
3810         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
3811         * rendering/RenderBlockLineLayout.cpp:
3812         (WebCore::RenderBlockFlow::appendRunsForObject):
3813         * rendering/RenderBox.cpp:
3814         (WebCore::RenderBox::positionLineBox):
3815         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
3816         * rendering/RenderBoxModelObject.cpp:
3817         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3818         * rendering/RenderLayer.cpp:
3819         (WebCore::RenderLayer::updateLayerPositions):
3820         (WebCore::RenderLayer::hitTestLayer):
3821         (WebCore::RenderLayer::calculateClipRects):
3822         * rendering/RenderLayerModelObject.cpp:
3823         (WebCore::RenderLayerModelObject::styleWillChange):
3824         * rendering/RenderLineBoxList.cpp:
3825         (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
3826         * rendering/RenderTextLineBoxes.cpp:
3827         (WebCore::RenderTextLineBoxes::dirtyRange):
3828         * rendering/line/BreakingContext.h:
3829         (WebCore::BreakingContext::handleOutOfFlowPositioned):
3830         (WebCore::BreakingContext::handleText):
3831         * rendering/line/LineBreaker.cpp:
3832         (WebCore::LineBreaker::nextLineBreak):
3833         * style/StyleResolveTree.cpp:
3834         (WebCore::Style::resolveLocal):
3835         * xml/XMLHttpRequestProgressEventThrottle.cpp:
3836         (WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent):
3837         * xml/parser/XMLDocumentParser.cpp:
3838         (WebCore::XMLDocumentParser::append):
3839
3840 2015-04-04  Andy Estes  <aestes@apple.com>
3841
3842         [Content Filtering] Blocked page is not always displayed when it should be
3843         https://bugs.webkit.org/show_bug.cgi?id=143410
3844         rdar://problem/20211099
3845
3846         Reviewed by Andreas Kling.
3847
3848         These tests now pass: contentfiltering/block-after-add-data.html
3849                               contentfiltering/block-after-response.html
3850
3851         There were several problems with how ContentFilter loaded replacement data:
3852         (1) Replacement data was delivered to DocumentLoader as if it were the original document's data. This assumes
3853             that the original data was a UTF-8 encoded HTML document, which is not always true. We had a way to reset
3854             the encoding, but not the content type.
3855         (2) Replacement data was never delivered when the filter blocks in DocumentLoader::responseReceived().
3856         (3) The main resource load was cancelled before the replacement data could be rendered when the filter blocks
3857             in DocumentLoader::dataReceived().
3858         The result was that only when the load was blocked after DocumentLoader::notifyFinished() would the replacement
3859         data be shown properly, and only when problem (1) wasn't occurring.
3860
3861         This patch addresses these issues by using the substitute data mechanism to deliver replacement data. By using
3862         substitute data, we can ensure that the original load is cancelled at the earliest opportunity and that the
3863         replacement data is loaded with the proper content type and encoding.
3864
3865         Accomplishing this required changing the way ContentFilter interacts with DocumentLoader. Instead of placing
3866         ContentFilter hooks throughout DocumentLoader, this patch makes ContentFilter itself the client of the
3867         CachedRawResource for the duration of the filtering. If the filter decides to allow the load, DocumentLoader
3868         adds itself as a client causing CachedRawResource to deliver to it the response and buffered data. If the
3869         filter decides to block the load, DocumentLoader schedules a substitute data load. An added benefit of this
3870         approach is that ContentFilter can reuse CachedRawResource's original data buffer instead of keeping its own.
3871
3872         * loader/ContentFilter.cpp:
3873         (WebCore::ContentFilter::createIfNeeded): Changed to take a DecisionFunction rather than a ResourceResponse and DocumentLoader.
3874         (WebCore::ContentFilter::ContentFilter): Ditto.
3875         (WebCore::ContentFilter::~ContentFilter): Removed ourself as a CachedRawResource client if needed.
3876         (WebCore::ContentFilter::startFilteringMainResource): Became the client of the CachedRawResource in order to start the filtering process.
3877         (WebCore::ContentFilter::unblockHandler): Returned the unblock handler.
3878         (WebCore::ContentFilter::replacementData): Returned the replacement data.
3879         (WebCore::ContentFilter::unblockRequestDeniedScript): Returned the unblock request denied script.
3880         (WebCore::ContentFilter::responseReceived): Called responseReceived() on each filter using forEachContentFilterUntilBlocked().
3881         (WebCore::ContentFilter::dataReceived): Ditto for dataReceived().
3882         (WebCore::ContentFilter::notifyFinished): Ditto for finishedLoading().
3883         (WebCore::ContentFilter::forEachContentFilterUntilBlocked): For each filter that needs more data, called the function.
3884         If the filter blocked the load, called didDecide() with State::Blocked.
3885         If all filters allowed the load, called didDecide() with State::Allowed.
3886         (WebCore::ContentFilter::didDecide): Set m_state and called m_decisionFunction().
3887         (WebCore::ContentFilter::addData): Deleted.
3888         (WebCore::ContentFilter::finishedAddingData): Deleted.
3889         (WebCore::ContentFilter::needsMoreData): Deleted.
3890         (WebCore::ContentFilter::didBlockData): Deleted.
3891         (WebCore::ContentFilter::getReplacementData): Deleted.
3892         * loader/ContentFilter.h:
3893         (WebCore::ContentFilter::type):
3894         * loader/DocumentLoader.cpp:
3895         (WebCore::DocumentLoader::DocumentLoader): Called ContentFilter::createIfNeeded() if not loading substitute data.
3896         (WebCore::DocumentLoader::finishedLoading): Removed old ContentFilter code.
3897         (WebCore::DocumentLoader::responseReceived): Ditto.
3898         (WebCore::DocumentLoader::commitData): Ditto.
3899         (WebCore::DocumentLoader::dataReceived): Ditto.
3900         (WebCore::DocumentLoader::detachFromFrame): Set m_contentFilter to nullptr.
3901         (WebCore::DocumentLoader::startLoadingMainResource): Called becomeMainResourceClientIfFilterAllows() instead of
3902         becoming m_mainResource's client.
3903         (WebCore::DocumentLoader::clearMainResource): Set m_contentFilter to nullptr.
3904         (WebCore::DocumentLoader::becomeMainResourceClientIfFilterAllows): If ContentFilter is initialized, called
3905         ContentFilter::startFilteringMainResource(). Otherwise added ourself as a client of m_mainResource.
3906         (WebCore::DocumentLoader::installContentFilterUnblockHandler): Added a helper for creating and notifying
3907         FrameLoaderClient of the unblock handler.
3908         (WebCore::DocumentLoader::contentFilterDidDecide): Set m_contentFilter to nullptr. If the content filter
3909         allowed the load, then added ourself as the CachedRawResource's client. Otherwise, installed the unblock handler
3910         and scheduled a substitute data load with the replacement data.
3911         * loader/DocumentLoader.h:
3912         * loader/FrameLoader.cpp:
3913         (WebCore::FrameLoader::prepareForLoadStart): Removed call to PolicyChecker::prepareForLoadStart().
3914         * loader/NavigationScheduler.cpp:
3915         (WebCore::ScheduledSubstituteDataLoad::ScheduledSubstituteDataLoad): Added a ScheduledNavigation subclass that
3916         calls FrameLoader::load() with a FrameLoadRequest containing substitute data.
3917         (WebCore::NavigationScheduler::scheduleSubstituteDataLoad): Scheduled a substitute data load.
3918         * loader/NavigationScheduler.h:
3919         * loader/PolicyChecker.cpp:
3920         (WebCore::PolicyChecker::checkNavigationPolicy): Reset m_contentFilterUnblockHandler if it couldn't handle the request.
3921         (WebCore::PolicyChecker::prepareForLoadStart): Deleted.
3922         * loader/PolicyChecker.h:
3923         * platform/ContentFilterUnblockHandler.h:
3924         (WebCore::ContentFilterUnblockHandler::unreachableURL):
3925         (WebCore::ContentFilterUnblockHandler::setUnreachableURL):
3926         (WebCore::ContentFilterUnblockHandler::unblockURLScheme): Renamed to ContentFilter::urlScheme().
3927         * platform/PlatformContentFilter.h:
3928         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
3929         (WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler): Added a helper to wrap the unblock handler with an outer DecisionHandlerFunction.
3930         (WebCore::ContentFilterUnblockHandler::encode): Added m_unreachableURL to the encoding.
3931         (WebCore::ContentFilterUnblockHandler::decode): Ditto for the decoding.
3932         (WebCore::ContentFilterUnblockHandler::canHandleRequest): Changed to call ContentFilter::urlScheme().
3933         * platform/cocoa/NetworkExtensionContentFilter.h:
3934         * platform/cocoa/NetworkExtensionContentFilter.mm:
3935         (replacementDataFromDecisionInfo): Added a helper to extract replacement data from the decisionInfo dictionary.
3936         (WebCore::NetworkExtensionContentFilter::enabled): Renamed from canHandleReponse(); only checks if the filter is enabled.
3937         (WebCore::NetworkExtensionContentFilter::create): Created a new object.
3938         (WebCore::NetworkExtensionContentFilter::NetworkExtensionContentFilter): Created a NEFilterSource immediately when using the modern API.
3939         (WebCore::NetworkExtensionContentFilter::responseReceived): Created a NEFilterSource when using the legacy API.
3940         Called -[NEFilterSource receivedResponse:decisionHandler:] when using the modern API.
3941         (WebCore::NetworkExtensionContentFilter::addData): Stopped buffering the original data.
3942         (WebCore::NetworkExtensionContentFilter::replacementData): Returned a SharedBuffer instead of a char* and int&.
3943         (WebCore::NetworkExtensionContentFilter::canHandleResponse): Deleted.
3944         (WebCore::createNEFilterSource): Deleted.
3945         (WebCore::NetworkExtensionContentFilter::getReplacementData): Deleted.
3946         * platform/cocoa/ParentalControlsContentFilter.h: