2015-08-06 Carlos Garcia Campos Unreviewed. Fix the build with RESOURCE_TIMING disabled. * loader/ThreadableLoader.h: 2015-08-05 Chris Dumez Crash when removing children of a MathMLSelectElement https://bugs.webkit.org/show_bug.cgi?id=147704 Reviewed by Ryosuke Niwa. When MathMLSelectElement::childrenChanged() is called after its children have been removed, MathMLSelectElement calls updateSelectedChild() which accesses m_selectedChild. However, in this case, m_selectedChild is the previously selected child and it may be destroyed as this point if it was removed. To avoid this problem, MathMLSelectElement now keep a strong ref to the currently selected element. Test: mathml/maction-removeChild.html * mathml/MathMLSelectElement.h: 2015-08-03 Brady Eidson Crash when signing into twitter calling WebCore::DocumentLoader::responseReceived(WebCore::CachedResource*, WebCore::ResourceResponse const&). and https://bugs.webkit.org/show_bug.cgi?id=147560 Reviewed by Alexey Proskuryakov. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Only grab identifierForLoadWithoutResourceLoader() if there's no ResourceLoader. 2015-07-31 Zan Dobersek [GTK] Have DataObjectGtk::unknownTypes() return a reference to the HashMap object https://bugs.webkit.org/show_bug.cgi?id=147401 Reviewed by Carlos Garcia Campos. Don't copy the DataObjectGtk::m_unknownTypes HashMap on every retrieval through DataObjectGtk::unknownTypes(). The range-based for-loops that iterate over the map in PasteboardGtk.cpp and PasteboardHelper.cpp are also cleaned up. * platform/gtk/DataObjectGtk.cpp: (WebCore::DataObjectGtk::unknownTypes): * platform/gtk/DataObjectGtk.h: * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::writePasteboard): (WebCore::Pasteboard::types): * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::fillSelectionData): 2015-07-30 Michael Catanzaro [GTK] Crashes when SoupSession is destroyed in exit handler https://bugs.webkit.org/show_bug.cgi?id=145347 Reviewed by Carlos Garcia Campos. Leak the default SoupSession with NeverDestroyed to avoid races at program exit. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::defaultSession): * platform/network/soup/SoupNetworkSession.h: 2015-07-29 Brady Eidson Review feedback followup to: Crash in WebCore::DocumentLoader::stopLoadingForPolicyChange. https://bugs.webkit.org/show_bug.cgi?id=147418 * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded): 2015-07-29 Brady Eidson RELEASE_ASSERT followup to: Crash in WebCore::DocumentLoader::stopLoadingForPolicyChange. https://bugs.webkit.org/show_bug.cgi?id=147418 Reviewed by Chris Dumez. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded): RELEASE_ASSERT we have a FrameLoader here. We want to know if we ever get here without one. 2015-07-29 Brady Eidson Crash in WebCore::DocumentLoader::stopLoadingForPolicyChange. and https://bugs.webkit.org/show_bug.cgi?id=147418 Reviewed by Chris Dumez. No new tests (No known reproducibility) * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): When setting to m_waitingForContentPolicy true, make sure we have a FrameLoader. (WebCore::DocumentLoader::detachFromFrame): Always explicitly call cancelPolicyCheckIfNeeded(). (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded): Cancel the policy check if there is one. (WebCore::DocumentLoader::cancelMainResourceLoad): Use cancelPolicyCheckIfNeeded(). * loader/DocumentLoader.h: 2015-07-28 Simon Fraser Animations sometimes fail to start https://bugs.webkit.org/show_bug.cgi?id=147394 rdar://problem/21852603 Reviewed by Dean Jackson. When an accelerated animation or transition was started at the same time as a non-accelerated one, and then the node for the former was removed, we could never kick off the non-accelerated animation. AnimationControllerPrivate has logic to synchronize the two types of animation when they start in the same animation update, which involves setting the m_waitingForAsyncStartNotification flag, and waiting for a notifyAnimationStarted() to come in from the graphics system. However, it failed to handle the case where the accelerated animation was removed before the callback was received, which left the m_waitingForAsyncStartNotification flag set to true, preventing the non-accelerated animation from running. Test: animations/remove-syncing-animation.html * page/animation/AnimationBase.h: (WebCore::AnimationBase::isAccelerated): Make this public. * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::clear): Add logging. (WebCore::AnimationControllerPrivate::receivedStartTimeResponse): Add logging. (WebCore::AnimationControllerPrivate::animationWillBeRemoved): Add logging. After removing animations from the maps, check to see if we expect any of the remaining animations are waiting for a notifyAnimationStarted(). If not, clear the m_waitingForAsyncStartNotification flag. (WebCore::AnimationController::notifyAnimationStarted): Log the renderer. (WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Remove unneeded initializations of HashMaps. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): Log renderers. (WebCore::CompositeAnimation::updateKeyframeAnimations): Ditto. 2015-07-28 Michael Catanzaro [Freetype] Always allow font matching for strong aliases https://bugs.webkit.org/show_bug.cgi?id=147057 Reviewed by Martin Robinson. Tests: platform/gtk/fonts/font-family-fallback-ignores-weak-aliases.html platform/gtk/fonts/font-family-fallback-respects-strong-aliases.html Treat fonts that are strongly-aliased to each other as if they were identical for the purposes of CSS font fallback. This improves the layout of many web pages by allowing fontconfig to replace fonts with metric-compatible equivalents (e.g. Arial -> Liberation Sans) instead of rejecting the metric-compatible font as unsuitable. * platform/graphics/cairo/RefPtrCairo.cpp: (WTF::refIfNotNull): (WTF::derefIfNotNull): * platform/graphics/cairo/RefPtrCairo.h: * platform/graphics/freetype/FcUniquePtr.h: Added. (WebCore::FcPtrDeleter::operator()): (WebCore::FcPtrDeleter::operator()): (WebCore::FcPtrDeleter::operator()): * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::strengthOfFirstAlias): (WebCore::strongAliasesForFamily): (WebCore::areStronglyAliased): (WebCore::FontCache::createFontPlatformData): 2015-07-28 Said Abou-Hallawa Crash happens when calling removeEventListener for an SVG element which has an instance inside a element of shadow tree https://bugs.webkit.org/show_bug.cgi?id=147290 Reviewed by Daniel Bates. When the shadow tree is built for a element, all the SVG elements are allowed to be cloned in the shadow tree but later some of the elements are disallowed and removed. Make sure, when disallowing an element in the shadow tree, to reset the correspondingElement relationship between all the disallowed descendant SVG elements and all their original elements. Test: svg/custom/remove-event-listener-shadow-disallowed-element.svg *svg/SVGElement.cpp: (WebCore::SVGElement::setCorrespondingElement) * svg/SVGUseElement.cpp: (WebCore::removeDisallowedElementsFromSubtree): 2015-07-27 David Hyatt ASSERTION FAILED: !currBox->needsLayout() loading bing maps (and apple.com/music and nytimes) https://bugs.webkit.org/show_bug.cgi?id=93891 Reviewed by Simon Fraser. Added new tests in fast/dynamic. Change tracking of positioned objects to always insert objects that need a layout in the end of the ListHashMap for RenderViews. This ensures that dependencies between nested positioned objects that both need a layout by the RenderView are resolved in the correct order. Don't cache the end object when walking the ListHashMap to do layouts of positioned objects, since that list is getting updated dynamically as earlier objects can mark and insert new objects into the list during their layouts. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::layoutPositionedObject): (WebCore::RenderBlock::layoutPositionedObjects): (WebCore::RenderBlock::insertIntoTrackedRendererMaps): (WebCore::RenderBlock::insertPositionedObject): (WebCore::RenderBlock::removePositionedObject): * rendering/RenderBlock.h: 2015-07-28 Carlos Garcia Campos [GTK] Use fastMalloc instead of g_slice https://bugs.webkit.org/show_bug.cgi?id=147357 Reviewed by Sergio Villar Senin. The use of g_slice is no longer encouraged by glib developers. * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::mapGstBuffer): (WebCore::unmapGstBuffer): 2015-07-27 Brady Eidson Crash in WebCore::DocumentLoader::willSendRequest() with ContentFilter and AppCache. and https://bugs.webkit.org/show_bug.cgi?id=147339 Reviewed by Alexey Proskuryakov. No new tests (Not yet proven to be possible to test this). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Grab the identifier from the CachedResource directly, not from the null ResourceLoader. (WebCore::DocumentLoader::continueAfterNavigationPolicy): Null check the ResourceLoader, as it can definitely be gone by this point. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::clearLoader): Save off the identifier for later use. * loader/cache/CachedResource.h: (WebCore::CachedResource::identifierForLoadWithoutResourceLoader): Expose the identifier that the ResourceLoader had when it went away. 2015-07-27 Carlos Garcia Campos [GTK] Pass a GstInstallPluginsContext to gst_install_plugins_async https://bugs.webkit.org/show_bug.cgi?id=147103 Reviewed by Philippe Normand. * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Allow to use GUniquePtr with GstInstallPluginsContext. 2015-07-24 Carlos Garcia Campos [GStreamer] Crashes during plugin installation https://bugs.webkit.org/show_bug.cgi?id=144099 Reviewed by Philippe Normand. Add new methods to MediaPlayerClient and ChromeClient to request the API layer to start the installer when there are missing media plugins. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::requestInstallMissingPlugins): Pass the request to the ChromeClient. * html/HTMLMediaElement.h: * page/ChromeClient.h: * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::requestInstallMissingPlugins): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Invalidate any pending request to install missing media plugins. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): In case of missing plugins message, start a request to install them if supported by GST. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create): (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback): (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::invalidate): (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete): 2015-07-22 Jinyoung Hur [WinCairo] SVG path not rendered with all-zero dasharray https://bugs.webkit.org/show_bug.cgi?id=146997 Reviewed by Martin Robinson. All-zero dash array should not be passed to cairo_set_dash() as an argument, because it will cause an internal Cairo error. Rather call cairo_set_dash() with num_dashes=0 to disable dash line. Tests: fast/canvas/canvas-lineDash.html svg/custom/zero-dasharray.html * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::setLineDash): 2015-07-22 Mark Dittmer Fix toJSDOMWindow() in the case of an object that has the actual JS DOM window in its prototype chain. https://bugs.webkit.org/show_bug.cgi?id=146785 Reviewed by Mark Lam. * bindings/js/JSDOMWindowBase.cpp: toJSDOMWindow(): Walk the prototype chain of the given JSValue until a JSDOMWindow or JSDOMWindowShell is found. 2015-07-21 Benjamin Poulain StyleSheetContents::wrapperInsertRule() can create rules that overflow RuleData's selector index https://bugs.webkit.org/show_bug.cgi?id=147144 Reviewed by Alex Christensen. RuleData identifies selectors by the index in a large array. The index only has 13 bits so rules with more than 8192 selectors should be split. One of the paths was not splitting the rule: StyleSheetContents::wrapperInsertRule(). When rules with too many selectors were added, the index would overflow and some RuleData would point to selectors in the middle of selector chains. The resulting behavior is random based on the selectors and the DOM. We cannot easily fix that because the CSS OM API do not expect to create several rules in response to calls to the API. In this patch, I don't do anything fancy and just let the calls fail if we cannot use the rules safely. Content Extensions were also running into this problem. Large Selector lists are pretty common, and ContentExtensionStyleSheet::addDisplayNoneSelector() was overflowing the RuleData, creating broken page. Unlike CSSOM, there is no problem with splitting rules coming from Content Extensions. Instead of creating new APIs for that case, I rely on the parser to extend the StyleSheetContents. That code already knows how to break rules correctly. Tests: fast/css/insert-rule-overflow-rule-data.html http/tests/contentextensions/css-display-none-overflows-rule-data-1.html http/tests/contentextensions/css-display-none-overflows-rule-data-2.html * contentextensions/ContentExtensionStyleSheet.cpp: (WebCore::ContentExtensions::ContentExtensionStyleSheet::addDisplayNoneSelector): * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::wrapperInsertRule): 2015-07-21 Tim Horton Placing video in fullscreen caused WebKit crash at WebCore::Range::textQuads https://bugs.webkit.org/show_bug.cgi?id=147166 Reviewed by Simon Fraser. * editing/FrameSelection.cpp: (WebCore::FrameSelection::getClippedVisibleTextRectangles): Check the Range, as always. 2015-07-21 Simon Fraser Safari mis-applies "animation-fill-mode: forwards" when using fractional iteration count https://bugs.webkit.org/show_bug.cgi?id=146996 Reviewed by Dean Jackson. animation-fill-mode: forwards with fractional iteration counts always snapped to 1 or 0, depending on direction. Fix to compute the fill-forward state from the correct keyframes. If filling forwards, AnimationBase::progress() sets the elapsed time to the duration, then uses fractionalTime() to handle animation direction mapping. If the fractionalTime is integral, we can return early, avoiding the cost of mapping through timing functions. Tested by existing tests. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::progress): (WebCore::AnimationBase::getElapsedTime): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): It was possible to end up with prevIndex == nextIndex with reverse animations, which resulted in divide-by-zero when computing scale. Fix by picking a nextIndex that is different from prevIndex. 2015-07-20 Ada Chan Follow-up to my earlier fix for r147085 https://bugs.webkit.org/show_bug.cgi?id=147085 Reviewed by Eric Carlson. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::isPlayingAudioDidChange): Null-check document() before dereferencing it in case the audio context's document is destroyed by the time the code block is called on the main thread. 2015-07-20 Tim Horton REGRESSION (r174287): Flash of black when opening a new web view or navigating to a new page https://bugs.webkit.org/show_bug.cgi?id=147127 Reviewed by Simon Fraser. * rendering/RenderView.cpp: (WebCore::RenderView::paintBoxDecorations): Avoid using an invalid documentBackgroundColor, fall back to baseBackgroundColor like we did before r174287. 2015-07-18 Ada Chan Fix deadlock between -[AVPlayerItem currentTime] and -[AVPlayer isExternalPlaybackActive] https://bugs.webkit.org/show_bug.cgi?id=147085 Reviewed by Jer Noble. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::isPlayingAudioDidChange): Call Document::updateIsPlayingMedia() on the main thread, since we could be on the audio I/O thread here and the Document::updateIsPlayingMedia() call could block, causing a deadlock. 2015-07-17 Zalan Bujtas REGRESSION (r169105): Do not assign a renderer to multiple selection subtrees. https://bugs.webkit.org/show_bug.cgi?id=147038 rdar://problem/21819351 Reviewed by David Kilzer. A renderer should never be assigned to multiple selection subtrees. (Currently RenderObject maintains the last selection state.) RenderView::applySubtreeSelection() loops from the start to the end of the selection to find renderers that are inside the selection. However, in case of regions (when multiple selection roots are present) traversing the renderer tree by calling RenderObject::nextInPreOrder() could end up going across selection roots. This patch ensures that we assign renderers to a specific selection only when the current selection root and the renderer's selection root match. Test: fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2.html * rendering/RenderView.cpp: (WebCore::SelectionIterator::SelectionIterator): (WebCore::SelectionIterator::current): (WebCore::SelectionIterator::checkForSpanner): (WebCore::RenderView::applySubtreeSelection): 2015-07-17 Zalan Bujtas (display: block)input range's thumb disappears when moved. https://bugs.webkit.org/show_bug.cgi?id=146896 Reviewed by Simon Fraser. Since the thumb is positioned after the layout for the input (shadow) subtree is finished, the repaint rects issued during the layout will not cover the re-positioned thumb. We need to issue a repaint soon after the thumb is re-positioned. Test: fast/repaint/block-inputrange-repaint.html * html/shadow/SliderThumbElement.cpp: (WebCore::RenderSliderContainer::layout): 2015-07-17 Myles C. Maxfield style.fontFamily accessor crashes on unstyled node created from DOMParser().parseFromString() https://bugs.webkit.org/show_bug.cgi?id=147026 Reviewed by Andreas Kling. Font CSS properties are a little special because they are used as indices into caches. Normally, StyleResolver gives all nodes a default font family, so our cache works correctly. However, if the document doesn't have a Settings object, StyleResolver wasn't doing this. Documents created from DOMParser().parseFromString() don't have a Settings object. Test: fast/text/crash-font-family-parsed.html * css/StyleResolver.cpp: (WebCore::StyleResolver::defaultStyleForElement): (WebCore::StyleResolver::initializeFontStyle): Set a font family even if we don't have a Settings object. 2015-07-29 Carlos Garcia Campos [GTK] Paste data is removed from clipboard when closing browser tab https://bugs.webkit.org/show_bug.cgi?id=144549 Reviewed by Martin Robinson. GTK+ stores all clipboards in gtk_main or gtk_application_shutdown when the main loop finishes. We don't use gtk_main() in the web process, so we need to do the same and store all clipboards on process shutdown. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::Pasteboard): Register the GtkClipboard. * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::singleton): Make it destructible. (WebCore::PasteboardHelper::~PasteboardHelper): Call gtk_clipboard_store for every registered GtkClipboard. (WebCore::PasteboardHelper::registerClipboard): Save the given GtkClipboard. * platform/gtk/PasteboardHelper.h: 2015-07-17 Carlos Garcia Campos [GTK] Cleanup PasteboardHelper https://bugs.webkit.org/show_bug.cgi?id=147035 Reviewed by Žan Doberšek. It's actually a singleton, but the API suggests you can create your own or use the default one, but the default one should be the only one. Rename PasteboardHelper::defaultPasteboardHelper() as PasteboardHelper::singleton() and make it non-copyable and never destroyed. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::writePlainText): Use PasteboardHelper::singleton(). (WebCore::Pasteboard::write): Ditto. (WebCore::Pasteboard::writePasteboard): Ditto. (WebCore::Pasteboard::clear): Ditto. (WebCore::Pasteboard::canSmartReplace): Ditto. (WebCore::Pasteboard::read): Ditto. (WebCore::Pasteboard::hasData): Ditto. (WebCore::Pasteboard::types): Ditto. (WebCore::Pasteboard::readString): Ditto. (WebCore::Pasteboard::readFilenames): Ditto. * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::singleton): Renamed as singleton, also use NeverDestroyed and return a reference instead of a pointer. (WebCore::PasteboardHelper::PasteboardHelper): Do all initializations here and remove the initialization static flag, since this is a real singleton now. Also use gdk_atom_intern_static_string() to initialize the atoms instead of gdk_atom_intern(). (WebCore::PasteboardHelper::targetList): (WebCore::PasteboardHelper::targetListForDataObject): (WebCore::getClipboardContentsCallback): * platform/gtk/PasteboardHelper.h: 2015-07-16 Simon Fraser Fix disappearing position:fixed elements in fixed layout mode https://bugs.webkit.org/show_bug.cgi?id=147019 Reviewed by Tim Horton. Test: compositing/fixed-with-fixed-layout.html When in fixed layout mode, and being scaled down, viewportConstrainedVisibleContentRect() is the wrong thing to use to determine if position:fixed elements are clipped out. In this case, use the simpler document bounds (before scaling). In the long term, there needs to be an equivalent of viewportConstrainedVisibleContentRect() that gives an appropriate rect that can be used here. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): 2015-07-14 Andreas Kling Don't persist history item tree for subframes across reloads. Reviewed by Brady Eidson. Throw away the subframe history items when reloading a page. This ensures that we don't accumulate outdated frame metadata when subframes change name across page loads. Since the history item tree is encoded in the UA session state and gets serialized to disk, it's important that we don't let it grow unbounded. * loader/HistoryController.cpp: (WebCore::HistoryController::updateForReload): 2015-07-10 Brady Eidson Crash in HistoryController::updateForCommit dereferencing a null HistoryItem. and https://bugs.webkit.org/show_bug.cgi?id=146842 Reviewed by Chris Dumez. No new tests (Unknown how to reproduce). This patch basically rolls back part of http://trac.webkit.org/changeset/179472. r179472 changed HistoryController::setCurrentItem() to take a reference instead of a pointer. Unfortunately, we sometimes call setCurrentItem(nullptr). We'd like to *not* do that, and there are assertions in place to try to catch when we do, but in the meantime it is not valid to dereference nullptr. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadSameDocumentItem): * loader/HistoryController.cpp: (WebCore::HistoryController::updateForCommit): (WebCore::HistoryController::recursiveUpdateForCommit): (WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation): (WebCore::HistoryController::setCurrentItem): Take a ptr instead of a ref. (WebCore::HistoryController::createItem): * loader/HistoryController.h: 2015-07-09 Zalan Bujtas Plugin create can end up destroying its renderer. https://bugs.webkit.org/show_bug.cgi?id=146824 rdar://problem/18921429 Reviewed by Andreas Kling. Plugins can run arbitrary code during initialization. If the plugin happens to destroy the associated node, its renderer becomes invalid. This patch checks whether the renderer survived the createPlugin() call. (This WeakPtr pattern is also used in RenderWidget to avoid dangling pointers.) Speculative fix. Not reproducible. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::loadPlugin): 2015-07-09 Daniel Bates Fetching Content Security Policy report URL should respect same origin policy https://bugs.webkit.org/show_bug.cgi?id=146754 Reviewed by Brady Eidson. Inspired by Blink r149791 (by Mike West ): As per , fetching the Content Security Policy report URL should include cookies if and only if the origin of the protected resource is equal to the origin of the report URL. Tests: http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.html http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled.html http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.html http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled.html http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled.html http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies.html * loader/PingLoader.cpp: (WebCore::PingLoader::sendViolationReport): 2015-07-10 Brady Eidson ASSERT restoring from page cache as DocumentLoader reattaches to its Frame. and https://bugs.webkit.org/show_bug.cgi?id=146786 Reviewed by NOBODY (Fixing obvious boneheaded mistake in r186642) No new tests (Covered by existing) * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::attachToFrame): Bail if reattaching to the current Frame, which happens when restoring from the page cache. 2015-07-09 Brady Eidson DocumentLoader::detachFromFrame() is being called with no current Frame set. and https://bugs.webkit.org/show_bug.cgi?id=146786 Reviewed by Sam Weinig. No new tests (Unknown how to reproduce). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): Null check m_frame before dereferencing it. (WebCore::DocumentLoader::setFrame): Deleted, renamed to attachToFrame(), and take's a Frame& instead of a Frame*. * loader/DocumentLoader.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::initForSynthesizedDocument): setFrame is now attachToFrame. (WebCore::FrameLoader::setPolicyDocumentLoader): Ditto. (WebCore::FrameLoader::transitionToCommitted): Ditto. 2015-07-09 Darin Adler REGRESSION (r182866): repeated prompts for password on internal Apple website using workers https://bugs.webkit.org/show_bug.cgi?id=146769 Reviewed by Sam Weinig. Not sure how to make a regression test for this. Sure would be nice to have one though. * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Added. Calls through to the base class copy constructor to copy data members of the base class (the lack of this was the bug). Also initializes all the data members of this class. (WebCore::ThreadableLoaderOptions::isolatedCopy): Changed to call the constructor above. * loader/ThreadableLoader.h: Added new constructor. 2015-07-08 Sungmann Cho [GTK] The "Missing Plug-in" buttons are not showing up on some flash contents. https://bugs.webkit.org/show_bug.cgi?id=146707 Reviewed by Martin Robinson. Currently, WebKitGTK+ doesn't show the "Missing Plug-in" buttons if the plugin-related tags don't have a "type" attribute. In such a case, WebCore tries to guess the MIME type from the extensions by using MIMETypeRegistry::getMIMETypeForExtension(). For WebKitGTK+, MIMETypeRegistry::getMIMETypeForExtension() goes through |extensionMap|, which is a simple array of , looking for the mime type for the given extension. But |extensionMap| in MIMETypeRegistryGtk.cpp doesn't have the information for ".swf", so WebCore fails to guess the MIME type and regard the content type as ObjectContentFrame, not ObjectContentNetscapePlugin. * platform/gtk/MIMETypeRegistryGtk.cpp: 2015-07-08 Said Abou-Hallawa Crash when appending an SVG element dynamically which has animated SVG element https://bugs.webkit.org/show_bug.cgi?id=146690 Reviewed by Dean Jackson. Test: svg/animations/insert-animate-use-path-while-animation.svg The crashing call stack shows that SVGAnimatedListPropertyTearOff::m_animVal is null when trying to access it in synchronizeWrappersIfNeeded(). This happens because animationStarted() was not called for this animatedType. SVGAnimateElementBase::resetAnimatedType() calls SVGAnimatedPathAnimator::startAnimValAnimation() at the beginning of the animation. For the target element and all its instances, this function calls SVGAnimatedPathSegListPropertyTearOff::animationStarted() which calls SVGAnimatedListPropertyTearOff::animationStarted(). This last function allocates the member m_animVal when calling SVGAnimatedListPropertyTearOff::animVal(). When adding a new instance of the same animating target element, SVGAnimateElementBase::resetAnimatedType() just keeps calling SVGAnimatedPathAnimator::animValDidChange() for all the instances of the targetElement without ensuring that all of them have started their animations. The fix is to make SVGAnimatedPathAnimator::resetAnimValToBaseVal() ensure that animationStarted() is called for the targetElement and all its instances. * svg/SVGAnimatedPath.cpp: (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation): Move resetting the animation value and starting the animatedTypes code to a new overriding function which is named resetAnimValToBaseVal(). (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal): Call the overriding function which calls buildSVGPathByteStreamFromSVGPathSegList() as before and ensure that all the animatedTypes have started their animations. * svg/SVGAnimatedPath.h: 2015-07-07 Zalan Bujtas Crash when parent iframe is set to display none and the child frame is mutated the same time. https://bugs.webkit.org/show_bug.cgi?id=146699 rdar://problem/16207881 Reviewed by Andreas Kling. When the parent iframe is set to display: none, we destroy the associated renderer (RenderIFrame). However if the child frame is mutated the same time, during layout we try to access this RenderIFrame to check whether it needs frame flattening. This patch checks whether the parent render widget is still valid. Test: fast/frames/crash-display-none-iframe-during-onbeforeload.html * page/FrameView.cpp: (WebCore::FrameView::isInChildFrameWithFrameFlattening): rearrange early returns. 2015-07-07 Andreas Kling REGRESSION(r183706): HTMLImageElement sometimes fails to register as document named item. Reviewed by Antti Koivisto. After r183706, Element::hasName() no longer returns outdated information when called inside a parseAttribute() override. HTMLImageElement was relying on this to check if it *used* to have a name attribute before the currently parsing one was set. Since parseAttribute() only shows subclasses the new attribute value, I'm adding a flag to HTMLImageElement that remembers whether we had a name attribute or not. Test: fast/dom/HTMLImageElement/remove-img-with-name-from-document-crash.html * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseAttribute): * html/HTMLImageElement.h: 2015-05-28 Carlos Alberto Lopez Perez [CMake] Improve detection and usage of GL/GLES/EGL libraries. https://bugs.webkit.org/show_bug.cgi?id=145408 Reviewed by Carlos Garcia Campos. No new tests, no behavior changes. * CMakeLists.txt: Ensure that we include the libraries and includes for the GL/GLESv2/EGL libraries before including the ANGLE directories. Define also any CFLAG that the system GL/GLESv2/EGL libraries may need. * PlatformEfl.cmake: Remove some includes that are now unneeded, because we are including now the EGL libraries on CMakeLists.txt * PlatformGTK.cmake: Remove unneeded include (We are including the EGL libraries now on CMakeLists.txt) 2015-05-07 Philip Chimento [GTK] DrawingBuffer.h used outside of include guard https://bugs.webkit.org/show_bug.cgi?id=144559 Reviewed by Carlos Garcia Campos. * platform/graphics/cairo/DrawingBufferCairo.cpp: A header was improperly included outside of an include guard, causing a build failure with a particular combination of options. 2015-07-06 Andreas Kling Crash when setting text direction via MakeTextWritingDirection* editing commands. Reviewed by Ryosuke Niwa. Fix two buggy clients of enclosingBlock(node) that would fail if the returned element is the same as the node passed in. Test: editing/style/change-text-direction-crash.html * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi): (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock): 2015-07-06 Dean Jackson Memory corruption in WebGLRenderingContext::simulateVertexAttrib0 https://bugs.webkit.org/show_bug.cgi?id=146652 Follow-up fix. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): 2015-07-06 Dean Jackson Memory corruption in WebGLRenderingContext::simulateVertexAttrib0 https://bugs.webkit.org/show_bug.cgi?id=146652 Reviewed by Brent Fulgham. The expression "(numVertex + 1) * 4 * sizeof(GC3Dfloat)" could potentially overflow. Make it use checked arithmetic. I couldn't make a test case that reliably exercised this. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Used Checked for calculating the size of the buffer. 2015-07-06 Zalan Bujtas Crash: LayoutState root's container is nullptr when the layout root is detached. https://bugs.webkit.org/show_bug.cgi?id=146646 rdar://problem/21371544 Reviewed by Simon Fraser. This is a speculative fix to ensure that when the root of the LayoutState is detached we don't try to access its container (nullptr). This is related to trac.webkit.org/r185484. Not reproducible. * rendering/LayoutState.cpp: (WebCore::LayoutState::LayoutState): * rendering/LayoutState.h: (WebCore::LayoutState::LayoutState): Deleted. 2015-07-05 Chris Dumez [WK2] WebBackForwardListItems' pageState is not kept up-to-date https://bugs.webkit.org/show_bug.cgi?id=146614 Reviewed by Gavin Barraclough. WebBackForwardListItems' pageState on UIProcess-side were not kept up-to-date when it was updated on WebContent process side. This meant that we were losing the scroll position (among other things) when transferring the session state over from one view to another. We now call notifyHistoryItemChanged(item) after saving the scroll position and the view state on the HistoryItem. As a result, the WebBackForwardListProxy will send the updated pageState to the UIProcess. * history/HistoryItem.cpp: (WebCore::HistoryItem::notifyChanged): * history/HistoryItem.h: * loader/HistoryController.cpp: (WebCore::HistoryController::saveScrollPositionAndViewStateToItem): 2015-07-03 Chris Dumez REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options https://bugs.webkit.org/show_bug.cgi?id=146566 Reviewed by Ryosuke Niwa. HTMLSelectElement.add(X, undefined) is supposed to be equivalent to HTMLSelectElement.add(X) which should *append* X. The same is true for HTMLOptionsCollection.add(X, undefined). However, due to a bug in our bindings generator for overloaded operations, the actual behavior was not the expected one. The second overload would be chosen: add(X, index) and undefined would be converted as 0-index, which would *prepend* X. This patch fixes the bindings generator so that undefined is allowed for optional parameters of an overload operation, when doing the overload resolution. Tests: - fast/dom/HTMLSelectElement/add.html - fast/dom/HTMLSelectElement/options-collection-add.html - http/tests/websocket/tests/hybi/undefined-protocol.html * bindings/scripts/CodeGeneratorJS.pm: (GenerateParametersCheckExpression): Allow undefined value for optional parameters when doing the overload resolution. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors): * bindings/scripts/test/TestObj.idl: Add bindings tests coverage and rebaseline. 2015-07-03 Kyounga Ra Memory leak for a protected Element having pending events in ImageLoader. https://bugs.webkit.org/show_bug.cgi?id=146538 Reviewed by Brady Eidson. If ImageLoader is destroyed before an active derefElementTimer is fired, protected element's refCount never be zero.. * loader/ImageLoader.cpp: (WebCore::ImageLoader::~ImageLoader): (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::updateRenderer): (WebCore::ImageLoader::updatedHasPendingEvent): (WebCore::ImageLoader::timerFired): * loader/ImageLoader.h: 2015-07-03 Daniel Bates REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo Mail https://bugs.webkit.org/show_bug.cgi?id=146515 Reviewed by Chris Dumez. Fixes an issue where extra arguments passed to a Web IDL overloaded function, whose implementation is generated by the bindings generator script, are not ignored as per the note in section "Interface object [[Call]] method" of the Web IDL spec, (19 April 2012). Currently for an overloaded function the JavaScript bindings generator script emits code to throw a TypeError when it cannot find a candidate function that takes the same number of arguments as passed by a caller. Prior to the change made in bug #139179 (r178097), the bindings code for HTMLSelectElement.add() was written by hand and ignored extra arguments that were passed to it. Following this change, the bindings code for HTMLSelectElement.add() is generated by the bindings generator script. Therefore, we throw a TypeError when Yahoo Mail calls HTMLSelectElement.add() with extra arguments because the code emitted by the bindings generator script does not ignore them. * bindings/scripts/CodeGeneratorJS.pm: (LengthOfLongestFunctionParameterList): Added. Computes the length of longest overload parameter list. (GenerateOverloadedFunction): Emit code that ignores more arguments than LengthOfLongestFunctionParameterList(). (GenerateOverloadedConstructorDefinition): Ditto. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): Added; expected result for an overloaded function that takes a variadic number of Blob elements. (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Update expected result. The added if-conditional expression for the IDL declaration overloadedMethod(Blob... blobArgs) is empty because we do not support overloading of functions with variadic arguments. (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5): Added; expected result for an overloaded constructors that takes a variadic number of long arguments. (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors): Update expected result. The added if-conditional expression for the IDL declaration Constructor(long... longArgs) is empty because we do not support overloading of constructors with variadic arguments. * bindings/scripts/test/TestObj.idl: Added declaration overloadedMethod(Blob...). Also fixed typo in license block text. * bindings/scripts/test/TestOverloadedConstructors.idl: Added declaration Constructor(long... longArgs). Also fixed typo in license block text. 2015-07-03 Mario Sanchez Prada Crash on xLarge memory allocation using bmalloc on 32bit systems https://bugs.webkit.org/show_bug.cgi?id=146440 Reviewed by Gustavo Noronha Silva. Disable the gcc's -ftree-sra optimization (automatically enabled with -O1 and higher levels) for WebCore and 32bit Intel architectures, as that causes the crash in bmalloc when allocating large amounts of memory from the texture mapper's tiled backing store implementation. * CMakeLists.txt: Pass -fno-free-sra to gcc on 32bit Intel architectures. 2015-06-30 Ryosuke Niwa REGRESSION (r179168): Characters overlap after resizing the font on the copy-pasted Japanese text https://bugs.webkit.org/show_bug.cgi?id=146492 Reviewed by Darin Adler. The bug was caused by WebKit serializing the used line-height size (e.g. 18px) in the copied content instead of string "normal" and removeStyleFromRulesAndContext failing to strip it down when text with a font that influences the line height got pasted. This is because the used value of line-height property of the context and the pasted content doesn't match when the context doesn't use the same font. Fixed the bug by not considering line-height as a list of editing properties we try to preserve. This is fine because we don't provide editing operations to directly manipulate line-height. Test: editing/pasteboard/cjk-line-height.html * editing/EditingStyle.cpp: (WebCore::editingProperties): Removed CSSPropertyLineHeight. 2015-07-01 Antti Koivisto PNG mask images are loaded with Accept:image/svg+xml https://bugs.webkit.org/show_bug.cgi?id=146509 rdar://problem/21584740 Reviewed by Simon Fraser. For some strange reason MaskImageOperation code loads all mask images, including non-SVG ones using CachedSVGDocument. Resulting bad accept header may cause server to reject the request. This is far from ideal but as a quick fix we can override the accept header for mask images to allow any image type. Test: http/tests/misc/mask-image-accept.html * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::acceptOverride): (WebCore::CachedResourceRequest::setAcceptOverride): * loader/cache/CachedSVGDocumentReference.cpp: (WebCore::CachedSVGDocumentReference::load): * loader/cache/CachedSVGDocumentReference.h: (WebCore::CachedSVGDocumentReference::loadRequested): (WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType): (WebCore::CachedSVGDocumentReference::document): * platform/graphics/MaskImageOperation.cpp: (WebCore::MaskImageOperation::ensureCachedSVGDocumentReference): 2015-06-30 Zalan Bujtas Frame flattening: Hit-testing an iframe could end up destroying the associated inline tree context. https://bugs.webkit.org/show_bug.cgi?id=146447 rdar://problem/20613501 Reviewed by Simon Fraser. This patch ensures that the render tree associated with the document on which the hit-test is initiated does not get laid out, unless it was directly mutated prior to the hittest. Hit-test requirements: 1. A clean the render tree before hit-testing gets propagated to the renderers. Document::updateLayout() ensures it by calling both updateStyleIfNeeded() and layout() not only on the current tree, but also on the ancestors if needed. 2. No render tree mutation while hit-testing the renderers. When an iframe is being hit-tested, this hit-test could bubble down to the child frame's render view. In order to ensure #1, we call Document::updateLayout() on the current (subframe) document. If updateStyleIfNeeded() mutates the render tree, we mark it dirty for layout(). However frame flattening also marks the parent renderer (RenderIFrame) dirty. While calling layout() to clean the current render tree, we end up laying out the parent tree too. Laying out the parent tree could end up destroying the inline tree context from where the hittest just bubbled down. (InlineFlowBox -> RenderWidget -> RenderView). This patch protects the render tree from such unintentional inline tree mutation during hittesting. After the initial layout we set a layout disallow flag on the frame view to defer subsequent layouts. This patch only changes behavior when frame flattening is enabled, but in future we may always want to enable this. Test: fast/frames/flattening/hittest-iframe-while-style-changes-crash.html * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded): Deleted. -> Assertion in no longer valid. * page/FrameView.h: * rendering/RenderView.cpp: (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): (WebCore::RenderView::hitTest): Protect the render tree from subsequent layouts. 2015-06-28 Chris Dumez Crash: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::CachedFrameBase::restore + 333 https://bugs.webkit.org/show_bug.cgi?id=146388 Reviewed by Darin Adler. Pages that are currently loading are not supposed to go into the PageCache. However, PageCache::canCache() only checks if the FrameLoader's documentLoader is loading. If the subframe is in provisional load stage, we would fail to detect that the frame is actually loading because the FrameLoader active documentLoader would be the provisional documentLoader, not the regular documentLoader. Therefore, the page would get added to the PageCache and the frame would keep loading while in the PageCache. On http://www.audiusa.com/models, this is what was happening. It was crashing because the subframe would finish loading while in the PageCache, in which case we would fire the 'load' event and the content 'load' event handler would then proceed to remove the iframe. Upon restoring the PageCache entry, we would run into trouble as we would have a CachedFrame whose Frame has been removed. The solution proposed is to prevent page-caching if a subframe is in provisional load stage. Test: http/tests/navigation/page-cache-iframe-provisional-load.html * history/PageCache.cpp: (WebCore::logCanCacheFrameDecision): (WebCore::PageCache::canCachePageContainingThisFrame): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::provisionalLoadKey): * page/DiagnosticLoggingKeys.h: 2015-06-25 Zalan Bujtas Do not send touch events to the slider's thumb when it does not have a renderer. https://bugs.webkit.org/show_bug.cgi?id=146307 rdar://problem/21539399 Reviewed by Simon Fraser. Bail out early if either the touch target or the renderer() is null. Test: fast/events/touch/input-range-with-thumb-display-none-crash.html * html/shadow/SliderThumbElement.cpp: (WebCore::findTouchWithIdentifier): (WebCore::SliderThumbElement::handleTouchStart): (WebCore::SliderThumbElement::handleTouchMove): (WebCore::SliderThumbElement::handleTouchEndAndCancel): 2015-06-25 Carlos Garcia Campos [GTK] Empty gtk-font-name setting causes WebProcess crash rendering pages https://bugs.webkit.org/show_bug.cgi?id=146246 Reviewed by Sergio Villar Senin. Return early if system font is empty. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::updateCachedSystemFontDescription): 2015-06-24 Chris Dumez Null dereference in DocumentLoader::areAllLoadersPageCacheAcceptable() https://bugs.webkit.org/show_bug.cgi?id=146286 Reviewed by Sam Weinig. Add null check for the Page in areAllLoadersPageCacheAcceptable() to fix this top crasher until I can investigate how this can happen. * loader/DocumentLoader.cpp: (WebCore::areAllLoadersPageCacheAcceptable): 2015-06-30 Zalan Bujtas Addressing post-review comments in r185916 * platform/LayoutUnit.h: (WebCore::roundToDevicePixel): 2015-06-24 Zalan Bujtas Subpixel rendering: roundToDevicePixel() snaps to wrong value. https://bugs.webkit.org/show_bug.cgi?id=146273 rdar://problem/18509840 Reviewed by Simon Fraser. Due to the floating point approximate representation, we can't always produce the correct snap value. This patch addresses the issue by removing redundant kFixedPointDenominator multiplication and by changing the rounding in roundToDevicePixel() from float to double. API test is added. * platform/LayoutUnit.h: (WebCore::roundToDevicePixel): 2015-06-22 Simon Fraser ASSERT(!m_zOrderListsDirty) when mousing over web view with incremental rendering suppressed https://bugs.webkit.org/show_bug.cgi?id=146225 Reviewed by Zalan Bujtas. Update RenderLayer's z-order lists when hit testing. There's no guarantee that they've been updated; this happens to work most of the time because painting updates them, but if incremental rendering is suppressed, we may not have painted yet. Easy to hit on webkit.org in MiniBrowser, but I wasn't able to make a reduced testcase. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::hitTest): (WebCore::RenderLayer::updateLayerListsIfNeeded): Flip the order of the tests, since checking dirty bits is cheaper than calling isStackingContext(). 2015-06-22 Zalan Bujtas REGRESSION(r169105) Dangling renderer pointer in SelectionSubtreeRoot::SelectionSubtreeData. https://bugs.webkit.org/show_bug.cgi?id=146116 rdar://problem/20959369 Reviewed by Brent Fulgham. This patch ensures that we don't adjust the selection unless the visual selection still matches this subtree root. When multiple selection roots are present we need to ensure that a RenderObject only shows up in one of them. RenderView::splitSelectionBetweenSubtrees(), as the name implies, splits the selection and sets the selection range (start/end) on each selection root. However, SelectionSubtreeRoot::adjustForVisibleSelection() later recomputes the range based on visible selection and that could end up collecting renderers as selection start/end from another selection subtree. RenderObject's holds the last selection state (RenderObject::setSelectionState). If we set a renderer first as "on selection border" and later "inside" using multiple selection roots, we can't clean up selections properly when this object gets destroyed. One of the roots ends up with a dangling RenderObject pointer. Test: fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees.html * rendering/SelectionSubtreeRoot.cpp: (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection): 2015-06-19 Joseph Pecoraro Crash under WebCore::PageConsoleClient::addMessage attempting to log insecure content message in ImageDocument https://bugs.webkit.org/show_bug.cgi?id=146096 Reviewed by Timothy Hatcher. Was able to reproduce this using a user stylesheet with an http css font on a pdf (ImageDocument) main document loaded over https. Was unable to create a reliable test for this scenario. * page/PageConsoleClient.cpp: (WebCore::getParserLocationForConsoleMessage): The scriptableDocumentParser could be null, such as in an ImageDocument. 2015-06-19 Andy Estes Various assertion failures occur when executing script in the midst of DOM insertion https://bugs.webkit.org/show_bug.cgi?id=132482 Reviewed by Darin Adler. Prior to this change, when an element containing a will cause that DocumentMarkerController still stores the markers for detached node. The same issue occurs when the text gets cleared, for example, No new tests. Internals marker APIs operate on text node attached to the element. To test it we could expose document().markers().hasMarkers() but there is no more useful cases where it could be used. Another obstacle is that we are in isInShadowTree() so that there is no possible to register on "DOMSubtreeModified" event. Test cases attached to the bug: 1. input.value = "" https://bug-140999-attachments.webkit.org/attachment.cgi?id=245704 2. elem.removeChild(textNode) https://bug-140999-attachments.webkit.org/attachment.cgi?id=246515 Remove markers when text nodes are about to remove. * dom/Document.cpp: (WebCore::Document::nodeChildrenWillBeRemoved): Fixes input.value = "" (WebCore::Document::nodeWillBeRemoved): Fixes elem.removeChild(textNode) 2015-02-15 David Kilzer REGRESSION (r180082): WebCore Debug builds fail on Mavericks due to weak export symbols This should fix the build, but leaves a FIXME list in WebCore.unexp. * Configurations/WebCore.unexp: Add weak externals with a FIXME statement so they can be removed later. It's more important to fix the build first. * Configurations/WebCore.xcconfig: Change XCODE_VERSION_MINOR to XCODE_VERSION_MAJOR since the internal bots use version 5.1.1 which still has the error. 2015-02-15 Brian J. Burg Web Inspector: remove unused XHR replay code https://bugs.webkit.org/show_bug.cgi?id=141622 Reviewed by Timothy Hatcher. XHR Replay functionality became unused with the last frontend rewrite. Remove instrumentation and data storage classes only used by this feature. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl): Deleted. (WebCore::InspectorInstrumentation::willLoadXHRImpl): Deleted. (WebCore::InspectorInstrumentation::didFailXHRLoadingImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorInstrumentation::willLoadXHR): Deleted. (WebCore::InspectorInstrumentation::didFailXHRLoading): Deleted. * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::didFinishXHRLoading): (WebCore::InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorResourceAgent::willLoadXHR): Deleted. (WebCore::InspectorResourceAgent::didFailXHRLoading): Deleted. (WebCore::InspectorResourceAgent::replayXHR): Deleted. * inspector/InspectorResourceAgent.h: * inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::clear): (WebCore::XHRReplayData::create): Deleted. (WebCore::XHRReplayData::XHRReplayData): Deleted. (WebCore::NetworkResourcesData::xhrReplayData): Deleted. (WebCore::NetworkResourcesData::setXHRReplayData): Deleted. (WebCore::NetworkResourcesData::reuseXHRReplayData): Deleted. * inspector/NetworkResourcesData.h: (WebCore::XHRReplayData::method): Deleted. (WebCore::XHRReplayData::url): Deleted. (WebCore::XHRReplayData::async): Deleted. (WebCore::XHRReplayData::formData): Deleted. (WebCore::XHRReplayData::headers): Deleted. (WebCore::XHRReplayData::includeCredentials): Deleted. (WebCore::NetworkResourcesData::ResourceData::xhrReplayData): Deleted. (WebCore::NetworkResourcesData::ResourceData::setXHRReplayData): Deleted. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): (WebCore::XMLHttpRequest::internalAbort): (WebCore::XMLHttpRequest::sendForInspectorXHRReplay): Deleted. * xml/XMLHttpRequest.h: 2015-02-15 Said Abou-Hallawa Crash when accessing an item in SVGTransformList and then removing a previous item from this list. https://bugs.webkit.org/show_bug.cgi?id=141550. Reviewed by David Kilzer. * svg/properties/SVGMatrixTearOff.h: (WebCore::SVGMatrixTearOff::create): Fix a compilation error on the release build. The ASSERT() here references a parameter which is not used anywhere else. We need to change it to ASSERT_UNUSED(). 2015-02-15 Said Abou-Hallawa Crash when accessing an item in SVGTransformList and then removing a previous item from this list. https://bugs.webkit.org/show_bug.cgi?id=141550. Reviewed by Darin Adler. Tests: LayoutTests/svg/dom/SVGTransformList-basics.xhtml: This test is modified to include a new test case. * svg/properties/SVGMatrixTearOff.h: m_value of SVGMatrixTearOff will be a null pointer. There is no point in having SVGMatrixTearOff points to the parent and the property of the parent at the same time. (WebCore::SVGMatrixTearOff::create): SVGMatrixTearOff will hold a pointer to the parent SVGPropertyTearOff. But it should overrides setValue() and propertyReference() so it can set and get the SVGMatrix from the SVGTransform parent. (WebCore::SVGMatrixTearOff::SVGMatrixTearOff): Pass a nullptr to the base class. SVGMatrixTearOff will act as a proxy of the parent. It does not hold any data by itself but it knows what property to set and get from the parent. * svg/properties/SVGPropertyTearOff.h: (WebCore::SVGPropertyTearOff::create): Add a create method which can take a pointer value. (WebCore::SVGPropertyTearOff::propertyReference): (WebCore::SVGPropertyTearOff::setValue): Make these functions virtual so concrete classes like SVGMatrixTearOff can override them. (WebCore::SVGPropertyTearOff::SVGPropertyTearOff): Add a new constructor. 2015-02-15 Said Abou-Hallawa Crash when accessing an item in SVGLengthList and then replacing it with a previous item in the list. https://bugs.webkit.org/show_bug.cgi?id=141552. Reviewed by Darin Adler. Tests: LayoutTests/svg/dom/SVGLengthList-basics.xhtml: This test is modified to include a new test case. * svg/properties/SVGListPropertyTearOff.h: Commit the removal of the replacing item before trying to detach the wrapper of the item which going to be replaced. 2015-02-15 David Kilzer CoreText only needs to be soft-linked on Windows More work towards the Maverick Debug build fix: REGRESSION (r180082): WebCore Debug builds fail on Mavericks due to weak export symbols * page/CaptionUserPreferencesMediaAF.cpp: 2015-02-15 Alexey Proskuryakov More build fixing. * platform/cocoa/TelephoneNumberDetectorCocoa.cpp: 2015-02-14 Alexey Proskuryakov More internal build fixing. DDDFACache.h is not an actual private header, so we were using open source redeclaration of DDDFACacheRef with an internal function prototype from DDDFAScanner.h. * platform/cocoa/TelephoneNumberDetectorCocoa.cpp: (WebCore::TelephoneNumberDetector::phoneNumbersScanner): 2015-02-14 Benjamin Poulain Add the initial matching implementation for attribute selectors with case-insensitive value https://bugs.webkit.org/show_bug.cgi?id=141615 Reviewed by Andreas Kling. Tests: fast/css/case-insensitive-attribute-selector-specificity.html fast/css/case-insensitive-attribute-selector-styling-html-1.html fast/css/case-insensitive-attribute-selector-styling-html-2.html fast/css/case-insensitive-attribute-selector-styling-html-3.html fast/css/case-insensitive-attribute-selector-styling-xhtml-1.xhtml fast/css/case-insensitive-attribute-selector-styling-xhtml-2.xhtml fast/css/case-insensitive-attribute-selector-styling-xhtml-3.xhtml fast/selectors/case-insensitive-attribute-bascis.html fast/selectors/case-insensitive-attribute-matching-style-attribute.html fast/selectors/case-insensitive-attribute-style-update.html fast/selectors/case-insensitive-attribute-with-case-sensitive-name.html * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): We already had case-insensitive value matching due to some legacy HTML behaviors where some attribute values would be matched case-insensitively depending on the attribute name. For this patch, I just re-use the same mechanism. I used branches to try to convey the idea that matching is case sensitive by default unless the selector has a flag or we are in the weird HTML exception. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::constructFragmentsInternal): Disable that case in the CSS JIT for now, I'll implement it later. 2015-02-14 David Kilzer Declare soft-linked functions with extern "C" linkage More work towards the Maverick Debug build fix: REGRESSION (r180082): WebCore Debug builds fail on Mavericks due to weak export symbols * platform/mac/SoftLinking.h: Try declaring soft-linked functions with extern "C" linkage to see if they stop appearing as weak externals. This has the added benefit that if the function signature changes, we'll get a build failure. 2015-02-14 Joseph Pecoraro [Mac] RetainPtr member cleanup, possible leaks https://bugs.webkit.org/show_bug.cgi?id=141616 Reviewed by Andreas Kling. * platform/mac/PlatformSpeechSynthesizerMac.mm: (-[WebSpeechSynthesisWrapper speakUtterance:]): Adopt the allocated object to avoid a possible leak. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::ScrollAnimatorMac): Adopt to avoid unnecessary retain/autorelease. 2015-02-14 Joseph Pecoraro IncompleteMetaDataCue leak seen on leaks bot https://bugs.webkit.org/show_bug.cgi?id=141611 Reviewed by Eric Carlson. * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h: (WebCore::IncompleteMetaDataCue::IncompleteMetaDataCue): Deleted. (WebCore::IncompleteMetaDataCue::~IncompleteMetaDataCue): Deleted. (WebCore::IncompleteMetaDataCue::cueData): Deleted. (WebCore::IncompleteMetaDataCue::startTime): Deleted. Convert to a struct and hold a list of structs instead of pointers. * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp: (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue): (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes): (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues): Update use of IncompleteMetaDataCue and modernize related code. 2015-02-09 Brian J. Burg Web Inspector: remove some unnecessary Inspector prefixes from class names in Inspector namespace https://bugs.webkit.org/show_bug.cgi?id=141372 Reviewed by Joseph Pecoraro. * WebCore.exp.in: * inspector/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::didCreateFrontendAndBackend): (WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend): * inspector/InspectorApplicationCacheAgent.h: * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::didCreateFrontendAndBackend): (WebCore::InspectorCSSAgent::willDestroyFrontendAndBackend): * inspector/InspectorCSSAgent.h: * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::inspectedPageDestroyed): (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::disconnectFrontend): (WebCore::InspectorController::show): (WebCore::InspectorController::close): (WebCore::InspectorController::dispatchMessageFromFrontend): * inspector/InspectorController.h: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend): * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::didCreateFrontendAndBackend): (WebCore::InspectorDOMDebuggerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::didCreateFrontendAndBackend): (WebCore::InspectorDOMStorageAgent::willDestroyFrontendAndBackend): * inspector/InspectorDOMStorageAgent.h: * inspector/InspectorDatabaseAgent.cpp: (WebCore::InspectorDatabaseAgent::didCreateFrontendAndBackend): (WebCore::InspectorDatabaseAgent::willDestroyFrontendAndBackend): * inspector/InspectorDatabaseAgent.h: * inspector/InspectorDatabaseResource.cpp: (WebCore::InspectorDatabaseResource::bind): * inspector/InspectorDatabaseResource.h: * inspector/InspectorForwarding.h: * inspector/InspectorIndexedDBAgent.cpp: (WebCore::InspectorIndexedDBAgent::didCreateFrontendAndBackend): (WebCore::InspectorIndexedDBAgent::willDestroyFrontendAndBackend): * inspector/InspectorIndexedDBAgent.h: * inspector/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::didCreateFrontendAndBackend): (WebCore::InspectorLayerTreeAgent::willDestroyFrontendAndBackend): * inspector/InspectorLayerTreeAgent.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::didCreateFrontendAndBackend): (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend): (WebCore::InspectorPageAgent::getScriptExecutionStatus): * inspector/InspectorPageAgent.h: * inspector/InspectorReplayAgent.cpp: (WebCore::InspectorReplayAgent::didCreateFrontendAndBackend): (WebCore::InspectorReplayAgent::willDestroyFrontendAndBackend): * inspector/InspectorReplayAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::didCreateFrontendAndBackend): (WebCore::InspectorResourceAgent::willDestroyFrontendAndBackend): * inspector/InspectorResourceAgent.h: * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyle::styleWithProperties): * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend): (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend): * inspector/InspectorTimelineAgent.h: * inspector/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::WorkerFrontendChannel): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): * inspector/InspectorWorkerAgent.h: * inspector/PageRuntimeAgent.cpp: (WebCore::PageRuntimeAgent::didCreateFrontendAndBackend): (WebCore::PageRuntimeAgent::willDestroyFrontendAndBackend): * inspector/PageRuntimeAgent.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): * inspector/WorkerInspectorController.h: * inspector/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend): (WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend): * inspector/WorkerRuntimeAgent.h: * loader/EmptyClients.h: * page/PageDebuggable.cpp: (WebCore::PageDebuggable::connect): (WebCore::PageDebuggable::disconnect): * page/PageDebuggable.h: * testing/Internals.cpp: (WebCore::Internals::closeDummyInspectorFrontend): * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::disconnectFromInspector): 2015-02-14 David Kilzer REGRESSION (r180082): WebCore Debug builds fail on Mavericks due to weak export symbols Work towards fixing the Mavericks Debug build. * dom/Document.h: (WebCore::Document::setAnnotatedRegionsDirty): * dom/Event.h: (WebCore::Event::create): * dom/Node.h: (WebCore::Node::hasEditableStyle): * dom/Position.h: (WebCore::Position::Position): * editing/FrameSelection.h: (WebCore::DragCaretController::clear): * loader/ResourceLoader.h: (WebCore::ResourceLoader::originalRequest): - Do not mark inline methods for export. 2015-02-14 Alexey Proskuryakov rel="noreferrer" should make window.opener null https://bugs.webkit.org/show_bug.cgi?id=141579 Reviewed by Darin Adler. Tests: http/tests/navigation/target-blank-opener-post.html http/tests/navigation/target-blank-opener.html We used to avoid passing window.opener policy by temporarily storing it in a FrameLoader member variable. This works for some clients - ones that invoke delegate callbacks synchronously - but not in the general case. So, changed to passing the policy explicitly. * WebCore.exp.in: * loader/FrameLoader.cpp: (WebCore::FrameLoader::FrameLoader): (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): * loader/FrameLoader.h: (WebCore::FrameLoader::suppressOpenerInNewFrame): Deleted. * loader/FrameLoaderTypes.h: * loader/NavigationScheduler.cpp: * page/ContextMenuController.cpp: (WebCore::openNewWindow): (WebCore::ContextMenuController::contextMenuItemSelected): 2015-02-14 David Kilzer REGRESSION (r180082): WebCore build on Mountain Lion fails due to weak export for i386 * Configurations/WebCore.unexp: Add missing symbol. 2015-02-13 Chris Dumez RenderListItem resets its marker's style on style change even if the diff is StyleDifferenceEqual https://bugs.webkit.org/show_bug.cgi?id=141572 Reviewed by Simon Fraser. Do not unnecessarily update the marker's style in RenderListItem::styleDidChange() if the RenderStyle diff is StyleDifferenceEqual. Doing so can cause unnecessary layouts. This was causing high cpu usage on http://www.nokogiri.org/tutorials/searching_a_xml_html_document.html because there is an animation that changes the style every second (but the diff is equal) and the RenderListItem keeps resetting its marker's margin, which triggers a layout and the RenderListMarker re-computes its margin during layout and updates its style again. With this change, CPU usage on the page goes from 150% to 20%. There is only a style recalc happening every second, no more relayouts and repaints. Test: fast/repaint/list-item-equal-style-change-no-repaint.html * rendering/RenderListItem.cpp: (WebCore::RenderListItem::styleDidChange): 2015-02-13 Timothy Horton Make WebCore::IOSurface have single ownership instead of refcounting https://bugs.webkit.org/show_bug.cgi?id=141578 Reviewed by Anders Carlsson. In the interests of making it harder to misuse and to make it more like ImageBuffer, our IOSurface wrapper should have single ownership. This will also allow future changes which depend on temporarily consuming an IOSurface to more easily enforce correct usage. * WebCore.exp.in: * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::insertSurfaceIntoPool): (WebCore::IOSurfacePool::tryEvictInUseSurface): (WebCore::IOSurfacePool::tryEvictOldestCachedSurface): (WebCore::IOSurfacePool::collectInUseSurfaces): * platform/graphics/cg/IOSurfacePool.h: * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: (IOSurface::create): (IOSurface::createFromSendRight): (IOSurface::createFromSurface): (IOSurface::createFromImage): Make IOSurface::create()s return a unique_ptr, and adjust everywhere. 2015-02-12 Enrica Casucci Additional emoji group support. https://bugs.webkit.org/show_bug.cgi?id=141539 rdar://problem/19727527 Reviewed by Sam Weinig. Adding some new emoji ligatures. Updated existing test to include the new sequences. * platform/text/TextBreakIterator.cpp: (WebCore::cursorMovementIterator): * rendering/RenderText.cpp: (WebCore::isEmojiGroupCandidate): 2015-02-13 Alex Christensen Really stop using export files. https://bugs.webkit.org/show_bug.cgi?id=141521 Reviewed by Mark Rowe. * Configurations/WebCore.xcconfig: Don't use exported symbols files. * Configurations/WebCore.unexp: Added list of symbols not to export (needed by Xcode 5.0.2). 2015-02-13 Zalan Bujtas Simplify ASSERT in lastRubyRun(). https://bugs.webkit.org/show_bug.cgi?id=141574 Reviewed by Daniel Bates. r180064 made some of the conditions in the ASSERT redundant. Covered by existing tests. * rendering/RenderRuby.cpp: (WebCore::lastRubyRun): 2015-02-13 Brent Fulgham [Mac, iOS] Adjust pagination behavior for Mail.app printing use https://bugs.webkit.org/show_bug.cgi?id=141569 Reviewed by Anders Carlsson. * page/Settings.in: Add new pagination setting flag. * rendering/RenderBlockFlow.cpp: (WebCore::messageContainerName): Added. (WebCore::needsPaginationQuirk): Added. (WebCore::RenderBlockFlow::adjustLinePositionForPagination): Don't move the message content div to a new page when using this special printing mode. 2015-02-13 Daniel Bates [iOS] DumpRenderTree.app fails to link due to undefined classes Following r179945, DumpRenderTree.app fails to link due to undefined symbols: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WebEvent", referenced from: objc-class-ref in libDumpRenderTree.a(EventSendingController.o) "_OBJC_CLASS_$_WebUndefined", referenced from: objc-class-ref in libDumpRenderTree.a(ObjCController.o) We need to export the classes WebScriptObject and WebEvent. * bindings/objc/WebScriptObject.h: * platform/ios/WebEvent.h: 2015-02-13 Andreas Kling CachedResource::clearLoader() should self-destruct if nothing else retains the CachedResource. Reviewed by Antti Koivisto. Anything that may cause CachedResource::canDelete() to return true must also make sure to call CachedResource::deleteIfPossible(), or we risk leaking the CachedResource. This is because CachedResource employs an extremely convoluted lifetime mechanism that depends on its presence in a number of collections, as well as internal counters and state. This is a speculative fix for a potential CachedResource leak that I'm not sure exists in practice, but let's be good citizens here. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::clearLoader): 2015-02-13 Jer Noble [MSE][Mac] Crash at WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset + 2357 https://bugs.webkit.org/show_bug.cgi?id=141566 rdar://problem/19826075 Reviewed by Andreas Kling. Null check m_mediaSource before dereferencing. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): 2015-02-13 Zalan Bujtas REGRESSION (r174761): Invalid cast in WebCore::lastRubyRun / WebCore::RenderRubyAsBlock::addChild https://bugs.webkit.org/show_bug.cgi?id=137929 rdar://problem/18723492 Reviewed by Chris Dumez. Ensure that the child renderer is a RenderRubyRun. Test: fast/ruby/crash-with-before-after-on-ruby.html * rendering/RenderRuby.cpp: (WebCore::lastRubyRun): 2015-02-13 Simon Fraser Crashes under RenderLayer::hitTestLayer under determinePrimarySnapshottedPlugIn() https://bugs.webkit.org/show_bug.cgi?id=141551 Reviewed by Zalan Bujtas. It's possible for a layout to dirty the parent frame's state, via the calls to ownerElement()->scheduleSetNeedsStyleRecalc() that RenderLayerCompositor does when iframes toggle their compositing mode. That could cause FrameView::updateLayoutAndStyleIfNeededRecursive() to fail to leave all the frames in a clean state. Later on, we could enter hit testing, which calls document().updateLayout() on each frame's document. Document::updateLayout() does layout on all ancestor documents, so in the middle of hit testing, we could layout a subframe (dirtying an ancestor frame), then layout another frame, which would forcing that ancestor to be laid out while we're hit testing it, thus corrupting the RenderLayer tree while it's being iterated over. Fix by having FrameView::updateLayoutAndStyleIfNeededRecursive() do a second layout after laying out subframes, which most of the time will be a no-op. Also add a stronger assertion, that this frame and all subframes are clean at the end of FrameView::updateLayoutAndStyleIfNeededRecursive() for the main frame. Various existing frames tests hit the new assertion if the code change is removed, so this is covered by existing tests. * page/FrameView.cpp: (WebCore::FrameView::needsStyleRecalcOrLayout): (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameView.h: * rendering/RenderWidget.cpp: (WebCore::RenderWidget::willBeDestroyed): 2015-02-12 Simon Fraser determinePrimarySnapshottedPlugIn() should only traverse visible Frames https://bugs.webkit.org/show_bug.cgi?id=141547 Part of rdar://problem/18445733. Reviewed by Anders Carlsson. There's an expectation from clients that FrameView::updateLayoutAndStyleIfNeededRecursive() updates layout in all frames, but it uses the widget tree, so only hits frames that are parented via renderers (i.e. not display:none frames or their descendants). Moving towards a future where we remove Widgets, fix by adding a FrameTree traversal function that only finds rendered frames (those with an ownerRenderer). Not testable. * page/FrameTree.cpp: (WebCore::FrameTree::firstRenderedChild): (WebCore::FrameTree::nextRenderedSibling): (WebCore::FrameTree::traverseNextRendered): (printFrames): * page/FrameTree.h: * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): 2015-02-13 Alexey Proskuryakov TimerBase::m_heapInsertionOrder calculation is racy https://bugs.webkit.org/show_bug.cgi?id=141554 Reviewed by Anders Carlsson. Use an atomic increment. * platform/Timer.cpp: (WebCore::TimerBase::setNextFireTime): 2015-02-13 Andreas Kling [iOS] Refine GC behavior in response to process suspension and memory pressure. Reviewed by Geoffrey Garen. Do an immediate full garbage collection when the web process is about to be suspended (when another tab is moving to the foreground on iOS.) This ensures that we make a best effort to reduce the process footprint before we lose the ability to execute code. When receiving a memory pressure warning, tell the garbage collector to accelerate its next collection (by calling garbageCollectSoon().) This gives us some confidence that a collection will happen within a reasonable timeframe, but doesn't risk dooming us to a loop of endless garbage collections. * platform/cocoa/MemoryPressureHandlerCocoa.mm: (WebCore::MemoryPressureHandler::platformReleaseMemory): 2015-02-13 Antti Koivisto Add some RELEASE_ASSERTs to try to catch crashes in StyleResolver::loadPendingImages https://bugs.webkit.org/show_bug.cgi?id=141561 Reviewed by Simon Fraser. One possibility is that loads triggered by loadPendingImages end up synchronously destroying or re-entering style resolver. Try to catch these in release builds. * css/StyleResolver.cpp: (WebCore::StyleResolver::~StyleResolver): (WebCore::StyleResolver::styleForElement): (WebCore::StyleResolver::styleForKeyframe): (WebCore::StyleResolver::styleForPage): (WebCore::StyleResolver::loadPendingImages): * css/StyleResolver.h: 2015-02-13 ChangSeok Oh Div having contentEditable and display:grid cannot be edited if it is empty. https://bugs.webkit.org/show_bug.cgi?id=141465 Reviewed by Ryosuke Niwa. This bug is quite similar to webkit.org/b/141218. RenderGrid should be also treated as a candidate for visible position as like RenderFlexibleBox. The only different situation between them is that RenderGrid has a bug setting "0px" for logicalHeight when it is empty. RenderGrid should also have a minimum height of a single line if it is editable as well as RenderFlexibleBox does. Test: fast/events/key-events-in-editable-gridbox.html * dom/Position.cpp: (WebCore::Position::isCandidate): (WebCore::Position::isRenderedCharacter): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::layoutGridItems): 2015-02-12 Zalan Bujtas REGRESSION (r176262): Invalid cast in WebCore`WebCore::RootInlineBox::selectionTop https://bugs.webkit.org/show_bug.cgi?id=138992 Reviewed by Dave Hyatt. RenderRubyText requires the ancestor chain to be (RenderRubyAsInline | RenderRubyAsBlock) -> RenderRubyRun -> RenderRubyText. This patch ensures that we create RenderRubyText for an element only when the expected ancestor chain is guaranteed. Test: fast/ruby/crash-when-ruby-is-set-to-inline-block.html * rendering/RenderElement.cpp: (WebCore::RenderElement::createFor): treat inline-block as block. * rendering/RenderObject.h: (WebCore::RenderObject::isRubyInline): (WebCore::RenderObject::isRubyBlock): (WebCore::RenderObject::isRuby): Deleted. * rendering/RenderRuby.cpp: (WebCore::isAnonymousRubyInlineBlock): * rendering/RenderRuby.h: add support for is(renderer) and for is(renderer) The isRuby() method does not follow the is*() -> maps to one class pattern. (WebCore::isRuby): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::addChild): (WebCore::RenderRubyRun::staticCreateRubyRun): 2015-02-13 Csaba Osztrogonac Fix the gperf related build issue on the WinCairo bot https://bugs.webkit.org/show_bug.cgi?id=141507 Reviewed by Alex Christensen. * platform/ColorData.gperf: Modified property svn:eol-style. 2015-02-13 Csaba Osztrogonác Unreviewed, remove empty directories. * loader/icon/wince: Removed. * platform/graphics/wince: Removed. * storage/wince: Removed. 2015-02-12 Timothy Horton Crashes under detectItemAroundHitTestResult when DataDetectors is not available https://bugs.webkit.org/show_bug.cgi?id=141549 Reviewed by Dan Bernstein. * editing/mac/DataDetection.mm: (WebCore::DataDetection::detectItemAroundHitTestResult): Bail out from data detection if either of the relevant frameworks aren't loaded. 2015-02-12 Dean Jackson [iOS Media] Audio should hide timeline scrubber until playback starts https://bugs.webkit.org/show_bug.cgi?id=141542 Reviewed by Eric Carlson. We regressed from the system behaviour in iOS 7, where the timeline scrubber for an audio element is not shown until the user starts playback. * Modules/mediacontrols/mediaControlsiOS.css: (video::-webkit-media-controls-panel): Fix the alignment of the flexbox. (audio::-webkit-media-controls-status-display): Add the style for the status display. * Modules/mediacontrols/mediaControlsiOS.js: (ControllerIOS.prototype.configureInlineControls): Start hidden if we are an