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