2017-07-12 Carlos Alberto Lopez Perez REGRESSION(r219332): [GTK] 9 new failures on fast/forms spinbutton related tests https://bugs.webkit.org/show_bug.cgi?id=174395 Reviewed by Carlos Garcia Campos. Covered by existing tests. Before r219332 the height of the spin button widget was calculated as the maximum value between the individual button ( the [+] or [-] ) width (33 pixels) and height (16 pixels). And r219332 caused the height of the widget to be calculated as the height of the button (16 pixels), which was incorrect as each button should be first expanded vertically to fit the preferred size of the widget. Fix this by making the calculations about the spin button widget on a new function spinButtonSize() that takes this into account, and use this values both for adjusting the style of the input field and the spin button widget itself. * rendering/RenderThemeGtk.cpp: (WebCore::spinButtonSize): (WebCore::RenderThemeGtk::adjustTextFieldStyle): (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle): 2017-07-11 Carlos Alberto Lopez Perez [GTK] Spin buttons on input type number appear over the value itself for small widths https://bugs.webkit.org/show_bug.cgi?id=173572 Reviewed by Carlos Garcia Campos. When drawing the spin buttons, override the width of the input element to increment it with the width of the spin button. This ensures that we don't end up covering the input values with the spin buttons. Do this also for user controlled styles, because most web authors won't test how their site renders on WebKitGTK+, and they will assume spin buttons in the order of 13 pixels wide (that is what most browsers use), but the GTK+ spin button is much wider (66 pixels). Test: platform/gtk/fast/forms/number/number-size-spinbutton-nocover.html * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustTextFieldStyle): Call the theme's adjustTextFieldStyle() also for user controlled styles. (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle): 2017-05-12 Jiewen Tan Elements should be inserted into a template element as its content's last child https://bugs.webkit.org/show_bug.cgi?id=171373 Reviewed by Ryosuke Niwa. Before this change, our HTML parser obeys the following premises: 1) A fostering child whose parent is a table should be inserted before its parent and under its grandparent. 2) When inserting into a template element, an element should be inserted into its content. Let's walk through the example: a) Before eventhandler takes place template table svg <- parser b) After eventhandler takes place template table svg <- parser c) after parsing svg template content svg (table) table Finally, in the example, the svg element will be inserted into the content of the template element while having its next sibling point to the table element. However, the table element is actually under the template element not its content. This messy tree is constructed because the second premise is incompleted. It should be: When inserting into a template element, an element should be inserted into its content as its last child. Quoted from Step 3 of https://html.spec.whatwg.org/multipage/syntax.html#appropriate-place-for-inserting-a-node A correct tree will then looks like: template content svg table Tests: fast/dom/HTMLTemplateElement/insert-fostering-child-crash.html fast/dom/HTMLTemplateElement/insert-fostering-child.html * html/parser/HTMLConstructionSite.cpp: (WebCore::insert): By nullifying task.nextChild, it will force the parser to append the element as task.parent's last child. 2017-05-15 Jiewen Tan Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto https://bugs.webkit.org/show_bug.cgi?id=172146 Reviewed by Brent Fulgham. In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in the custom binding codes. Test: crypto/webkitSubtle/import-export-raw-key-leak.html * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::encrypt): (WebCore::JSWebKitSubtleCrypto::decrypt): (WebCore::JSWebKitSubtleCrypto::sign): (WebCore::JSWebKitSubtleCrypto::verify): (WebCore::JSWebKitSubtleCrypto::digest): (WebCore::JSWebKitSubtleCrypto::importKey): (WebCore::JSWebKitSubtleCrypto::unwrapKey): * crypto/WebKitSubtleCrypto.idl: 2017-05-13 Zalan Bujtas AccessibilityRenderObject::textUnderElement needs to assert on unclean tree. https://bugs.webkit.org/show_bug.cgi?id=172065 Reviewed by Simon Fraser. r192103 changed the assert logic incorrectly. If the tree is dirty, regardless of the renderer's type, TextIterator will end up forcing style update/layout on the render tree. The original assert would have hit with bug 171546 prior to r216726. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): 2017-05-11 Zalan Bujtas AX: Defer text changes until after the tree is clean if needed. https://bugs.webkit.org/show_bug.cgi?id=171546 Reviewed by Simon Fraser. While updating an accessibility object state, we might trigger unintentional style updates. This style update could end up destroying renderes that are still referenced by functions on the callstack. To avoid that, defer such changes and let AXObjectCache operate on a clean tree. Test: accessibility/crash-when-render-tree-is-not-clean.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::handleAttributeChanged): (WebCore::AXObjectCache::labelChanged): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::deferRecomputeIsIgnored): (WebCore::AXObjectCache::deferTextChangedIfNeeded): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted. (WebCore::AXObjectCache::deferTextChanged): Deleted. * accessibility/AXObjectCache.h: Decouple different type of changes. (WebCore::AXObjectCache::deferRecomputeIsIgnored): (WebCore::AXObjectCache::deferTextChangedIfNeeded): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted. (WebCore::AXObjectCache::deferTextChanged): Deleted. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::deleteLines): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::createAndAppendRootInlineBox): * rendering/RenderText.cpp: (WebCore::RenderText::setText): 2017-05-02 Zalan Bujtas Defer AX cache update when text content changes until after layout is finished. https://bugs.webkit.org/show_bug.cgi?id=171429 Reviewed by Simon Fraser. When the content of the RenderText changes (even as the result of a text-transform change) instead of updating the AX cache eagerly (and trigger layout on a half-backed render tree) we should just defer it until after the subsequent layout is done. Test: accessibility/crash-while-adding-text-child-with-transform.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): (WebCore::AXObjectCache::deferTextChanged): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted. * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::deferTextChanged): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted. * page/FrameView.cpp: (WebCore::FrameView::performPostLayoutTasks): * rendering/RenderText.cpp: (WebCore::RenderText::setText): 2017-06-19 Brady Eidson Various IndexedDB crashes as an after effect of previous test. and https://bugs.webkit.org/show_bug.cgi?id=170436 Reviewed by Chris Dumez. No new test (No consistent test possible, in practice covered by all existing IDB tests) This is timing related, where a UniqueIDBDatabase can be destroyed on the main thread while it still has one task left to try to execute on the IDBServer thread. The background thread tasks don't Ref<> the UniqueIDBDatabase, so even though task execution took a Ref<> protector, there was still a small window for a race. Should be closed up by making the background thread tasks themselves protect this. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask): (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply): (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask): (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply): * Modules/indexeddb/server/UniqueIDBDatabase.h: 2017-06-18 Carlos Garcia Campos [GStreamer] MainThreadNotifier ASSERTION FAILED: m_boundThread == currentThread() in _WebKitWebSrcPrivate::~_WebKitWebSrcPrivate https://bugs.webkit.org/show_bug.cgi?id=152043 Reviewed by Xabier Rodriguez-Calvar. Stop using a WeakPtr in MainThreadNotifier, because it's not thread safe, which causes a crash in debug builds when the notifier is destroyed in a different thread. Make MainThreadNotifier thread safe refcounted instead, and add an invalidate() method to mark it as invalid. * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: (WebCore::InbandTextTrackPrivateGStreamer::handleSample): (WebCore::InbandTextTrackPrivateGStreamer::streamChanged): * platform/graphics/gstreamer/MainThreadNotifier.h: (WebCore::MainThreadNotifier::MainThreadNotifier): Deleted. (WebCore::MainThreadNotifier::notify): Deleted. (WebCore::MainThreadNotifier::cancelPendingNotifications): Deleted. (WebCore::MainThreadNotifier::addPendingNotification): Deleted. (WebCore::MainThreadNotifier::removePendingNotification): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback): (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): (WebCore::TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer): (WebCore::TrackPrivateBaseGStreamer::disconnect): (WebCore::TrackPrivateBaseGStreamer::activeChangedCallback): (WebCore::TrackPrivateBaseGStreamer::tagsChanged): * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): (webKitWebSrcDispose): (webKitWebSrcStop): (webKitWebSrcStart): (webKitWebSrcNeedData): (webKitWebSrcEnoughData): (webKitWebSrcSeek): 2017-06-17 Antti Koivisto Crash due to infinite recursion via FrameSelection::updateAppearanceAfterLayout https://bugs.webkit.org/show_bug.cgi?id=173468 Reviewed by Ryosuke Niwa. Test: editing/selection/updateAppearanceAfterLayout-recursion.html Calling FrameSelection::updateAppearanceAfterLayout() from Document::resolveStyle is unsafe because it may cause another call to resolveStyle. We have some cases where the style is still unclean when updateAppearanceAfterLayout() is called. This can lead to infinite recursion. The test case is not the common stack seen in CrashTracer (couldn't quit replicate it) but the updateAppearanceAfterLayout/resolveStyle recursion is the same. * dom/Document.cpp: (WebCore::Document::resolveStyle): Normally selection appearance update is done in post-layout but not all style resolutions schedule a layout. Invoke it asynchronously in that case instead of the previous synchronous call. * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::updateAppearanceAfterLayout): (WebCore::FrameSelection::scheduleAppearanceUpdateAfterStyleChange): (WebCore::FrameSelection::appearanceUpdateTimerFired): (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): * editing/FrameSelection.h: 2017-06-17 Ryosuke Niwa REGRESSION(r209495): materiauxlaverdure.com fails to load https://bugs.webkit.org/show_bug.cgi?id=173301 Reviewed by Antti Koivisto. The bug was caused by WebKit wrapping CSS string values with single quotation marks instead of double quotation marks as spec'ed in https://drafts.csswg.org/cssom/#serialize-a-string and implemented in Firefox and Chrome. The website eval's the computed value of the `content` CSS property with the value `'{name: "flat"}'` after stripping single quotation marks from both ends. Prior to r209495, WebKit serialized this CSS value in single quotations without escaping double quotations. After r209495, double quotations are escaped with backslashes as `'{name: \"flat\"}'`. As a result, `eval` is invoked with `{name: \"flat\"}` after stripping single quotations from both ends, which resulted in an exception. Chrome and Firefox don't encounter this exception despite of the fact they escape double quotations as well because serialize with double quotations as `"{name: \"flat\"}"`. Because there is no code to strip double quotations, eval is invoked with the same string, resulting in the entire value as being parsed as string, instead of an object with a single key "name" with the value of "flat" as was the case in WebKit prior to r209495. While this behavior was most certainly not the intent of the website author, Chrome and Firefox don't encounter an exception and the website continues to work. This patch aligns WebKit's behavior to that of the CSS OM specification, Firefox, and Chrome by serializing CSS string values using double quotation marks instead of single quotation marks. Note: inline change log comments are added below for every call site of serializeString for clarity. Test: fast/css/getPropertyValue-serialization-with-double-quotes.html * css/CSSBasicShapes.cpp: (WebCore::buildPathString): Use double quotation marks in path(~) of shapes. * css/CSSMarkup.cpp: (WebCore::serializeString): (WebCore::serializeURL): Use double quotation marks to serialize URLs. (WebCore::serializeAsStringOrCustomIdent): Use double quotation marks to serialize strings. We still avoid using wrapping the value with double quotations when the value can be an identifier. See r209495. (WebCore::serializeFontFamily): Ditto for font-family names such as "San Francisco". * css/CSSMarkup.h: * css/CSSNamespaceRule.cpp: (WebCore::CSSNamespaceRule::cssText): Use double quotation marks to serialize namespace URIs. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Use double quotation marks to serialize the separators; e.g. counter(sectionNumber, ".") to produce "1.". * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): Use double quotation marks to serialize attribute values. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize): Use double quotation marks to serialize strings in @support. * editing/EditingStyle.cpp: (WebCore::StyleChange::extractTextStyles): Updated to strip double quotation marks in font family names to maintain the compatibility with old versions of Microsoft Outlook. * html/HTMLElement.cpp: (WebCore::HTMLElement::mapLanguageAttributeToLocale): Use double quotations marks to serialize the value of the lang content attribute. It doesn't matter which one is used here because it's only a temporary value only fed into the CSS parser to set the equivalent CSS value from the content attribute. 2017-06-14 Miguel Gomez REGRESSION(r216901): ImageDecoders: rendering of large images is broken since r216901 https://bugs.webkit.org/show_bug.cgi?id=172502 Reviewed by Carlos Garcia Campos. When using GTK and WPE image decoders, the decoded frames are stored inside a Vector of ImageFrames inside the decoders. These ImageFrames have and ImageBackingStore with the pixels. When a NativeImagePtr is requested, a cairo surface is created from the data in those ImageBackingStores, but the data keeps being owned by the backing stores. Due to this, if the decoder that created the image gets destroyed, the backing stores for the decoded frames get destroyed as well, causing the cairo surfaces that were using that data to contain garbage (and potentially cause a crash). To fix this, we change ImageBackingStore so the pixels are stored in a SharedBuffer. The buffer will be reffed everytime a cairo surface is created with it, and the cairo surfaces will unref the buffer when they are destroyed. This way, the pixel data won't be freed while there are cairo surfaces using it. No new tests, no behaviour change. * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::setSize): (WebCore::ImageBackingStore::ImageBackingStore): * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: (WebCore::ImageBackingStore::image): 2017-06-13 Jer Noble Protect lifetime of media element during HTMLMediaElement::notifyAboutPlaying() https://bugs.webkit.org/show_bug.cgi?id=173320 Reviewed by Brent Fulgham. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::notifyAboutPlaying): 2017-06-09 Brady Eidson Crash when IndexedDB's getAll is used inside a Web Worker. https://bugs.webkit.org/show_bug.cgi?id=172434 Reviewed by Andy Estes. Test: storage/indexeddb/modern/worker-getall.html * Modules/indexeddb/IDBGetAllResult.cpp: (WebCore::IDBGetAllResult::IDBGetAllResult): Add an isolated-copying constructor. (WebCore::IDBGetAllResult::isolatedCopy): * Modules/indexeddb/IDBGetAllResult.h: * Modules/indexeddb/shared/IDBResultData.cpp: (WebCore::IDBResultData::isolatedCopy): Actually copy the IDBGetAllResult. 2017-06-08 Ryosuke Niwa Crash inside InsertNodeBeforeCommand via InsertParagraphSeparatorCommand https://bugs.webkit.org/show_bug.cgi?id=173085 Reviewed by Wenson Hsieh. The crash was caused by the condition to check for special cases failing when visiblePos is null. Exit early in these extreme cases. Also replaced the use of deprecatedNode and deprecatedEditingOffset to modern idioms. Test: editing/inserting/insert-horizontal-rule-in-empty-document-crash.html * editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply): 2017-06-06 Zalan Bujtas Safari doesn't load newest The Order of the Stick comic. https://bugs.webkit.org/show_bug.cgi?id=172949 Reviewed by Antti Koivisto. As part of the table layout, RenderTableSection::layoutRows calls the RenderTableCell's layout() directly (skipping the RenderTableRow parent). If during this call the RenderTableCell (or any of its descendant) marks the ancestor chain dirty, this dirty flag on the RenderTableRows will never be cleared and we'll end up early returning from RenderTableSection::paint. For certain type of float objects, we need to invalidate the line layout path during layout (and we mark the ancestors dirty). This patch takes a conservative approach and marks the ancestors dirty only when the renderer is not dirty yet, but as part of webkit.org/b/172947 we should revisit and validate whether the setNeedsLayout() is required at all. Test: fast/table/floating-table-sibling-is-invisible.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::invalidateLineLayoutPath): 2017-06-05 Zalan Bujtas Destroy the associated renderer subtree when display: contents node is deleted. https://bugs.webkit.org/show_bug.cgi?id=172920 Reviewed by Antti Koivisto. Since display: contents node does not create a renderer, we need to explicitly check and distinguish it from the display: none case. Covered by existing tests. * dom/ContainerNode.cpp: (WebCore::destroyRenderTreeIfNeeded): * dom/Node.cpp: (WebCore::Node::~Node): Promote ASSERT(!renderer()) to ASSERT_WITH_SECURITY_IMPLICATION. * dom/Text.cpp: (WebCore::Text::~Text): Redundant assert. Text is a Node. 2017-06-05 Carlos Garcia Campos [GStreamer] Deadlock in MediaPlayerPrivateGStreamer::changePipelineState, web process often locks up on seeking in a youtube video that has already fully buffered https://bugs.webkit.org/show_bug.cgi?id=170003 Reviewed by Michael Catanzaro. When video sink is requested to render a frame, the GstBaseSink preroll mutex is taken. Then WebKit media player schedules a repaint in the main thread, taking the draw mutex and waiting on draw condition. It can happen that before the repaint is done in the main thread, a pause is requested in the main thread, causing a change state from PLAYING to PAUSE. When the change state reaches the video sink gst_base_sink_change_state() tries to get the preroll mutex. This causes a deadlock because the main thread is waiting to get the preroll mutex, but the other thread is waiting for the main thread to do the repaint. GStreamer handles this case by calling unlock() on the video sink before trying to get the preroll mutex, but the media player doesn't cancel the pending repaint when using coordinated graphics. This patch adds a new signal to WebKitVideoSink "repaint-cancelled" to notify the media player to cancel the pending prepaint. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): Release the draw mutex and notify the condition. (WebCore::MediaPlayerPrivateGStreamerBase::repaintCancelledCallback): Call cancelRepaint(). (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): Connect to WebKitVideoSink::repaint-cancelled. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: (webkitVideoSinkRepaintCancelled): Emit WebKitVideoSink::repaint-cancelled. (webkitVideoSinkUnlock): Call webkitVideoSinkRepaintCancelled(). (webkitVideoSinkStop): Ditto. (webkit_video_sink_class_init): Add WebKitVideoSink::repaint-cancelled signal. 2017-06-01 Carlos Garcia Campos [GTK] Cache RenderThemeGadget hierarchies for rendering themed elements with GTK+ 3.20+ https://bugs.webkit.org/show_bug.cgi?id=162673 Reviewed by Michael Catanzaro. Because of the way the new theming system works in GTK+ >= 3.20 we are currently creating a gadget hierarchy every time we need to render a styled element or get layout information about it. That's happening on every repaint, and it's specially problematic for overlay scrollbar indicators that fade in/out when shown/hidden. We need to cache the gadgets and simply apply the state before every paint or layout query. When using GtkWidgetPath, calling gtk_style_context_save() breaks the gadget hierarchy, and style classes need to be set when building the GtkWidgetPath. That means we can't cache RenderThemeGadgets, call save, apply style classes and state, and then call restore. We need to cache gadget hierarchies with fixed style classes. Fortunately, setting the state does work, so we don't need to also cache a different hierarchy for every possible state. For example, for the particular case of scrollbars we would cache VerticalScrollbarRight, VerticalScrollbarLeft, HorizontalScrollbar, VerticalScrollIndicatorRight, VerticalScrollIndicatorLeft and HorizontalScrollIndicator. In practice, we will only have 4 of those at the same time in the cache. This patch adds RenderThemeWidget to represent a hierarchy of gadgets with fixed style classes that can be cached and reused to render or query style of those "widgets". It also simplifies the RenderThemeGtk and ScrollbarThemeGtk code by removing a lot of duplicated code to build the gadget hierarchies. * PlatformGTK.cmake: * platform/gtk/RenderThemeGadget.cpp: (WebCore::createStyleContext): (WebCore::appendElementToPath): (WebCore::RenderThemeGadget::state): (WebCore::RenderThemeGadget::setState): * platform/gtk/RenderThemeGadget.h: * platform/gtk/RenderThemeWidget.cpp: Added. (WebCore::widgetMap): (WebCore::RenderThemeWidget::getOrCreate): (WebCore::RenderThemeWidget::clearCache): (WebCore::RenderThemeWidget::~RenderThemeWidget): (WebCore::RenderThemeScrollbar::RenderThemeScrollbar): (WebCore::RenderThemeScrollbar::stepper): (WebCore::RenderThemeToggleButton::RenderThemeToggleButton): (WebCore::RenderThemeButton::RenderThemeButton): (WebCore::RenderThemeComboBox::RenderThemeComboBox): (WebCore::RenderThemeEntry::RenderThemeEntry): (WebCore::RenderThemeSearchEntry::RenderThemeSearchEntry): (WebCore::RenderThemeSpinButton::RenderThemeSpinButton): (WebCore::RenderThemeSlider::RenderThemeSlider): (WebCore::RenderThemeProgressBar::RenderThemeProgressBar): (WebCore::RenderThemeListView::RenderThemeListView): (WebCore::RenderThemeIcon::RenderThemeIcon): * platform/gtk/RenderThemeWidget.h: Added. (WebCore::RenderThemeEntry::entry): (WebCore::RenderThemeEntry::selection): * platform/gtk/ScrollbarThemeGtk.cpp: (WebCore::ScrollbarThemeGtk::themeChanged): (WebCore::ScrollbarThemeGtk::updateThemeProperties): (WebCore::widgetTypeForScrollbar): (WebCore::contentsRectangle): (WebCore::ScrollbarThemeGtk::trackRect): (WebCore::ScrollbarThemeGtk::backButtonRect): (WebCore::ScrollbarThemeGtk::forwardButtonRect): (WebCore::ScrollbarThemeGtk::paint): (WebCore::ScrollbarThemeGtk::scrollbarThickness): (WebCore::ScrollbarThemeGtk::minimumThumbLength): * rendering/RenderThemeGtk.cpp: (WebCore::createStyleContext): (WebCore::setToggleSize): (WebCore::paintToggle): (WebCore::RenderThemeGtk::paintButton): (WebCore::menuListColor): (WebCore::RenderThemeGtk::popupInternalPaddingBox): (WebCore::RenderThemeGtk::paintMenuList): (WebCore::RenderThemeGtk::adjustTextFieldStyle): (WebCore::RenderThemeGtk::paintTextField): (WebCore::adjustSearchFieldIconStyle): (WebCore::paintSearchFieldIcon): (WebCore::RenderThemeGtk::paintSliderTrack): (WebCore::RenderThemeGtk::adjustSliderThumbSize): (WebCore::RenderThemeGtk::paintSliderThumb): (WebCore::RenderThemeGtk::progressBarRectForBounds): (WebCore::RenderThemeGtk::paintProgressBar): (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle): (WebCore::RenderThemeGtk::paintInnerSpinButton): (WebCore::styleColor): (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor): (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor): (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor): (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor): (WebCore::RenderThemeGtk::paintMediaButton): 2017-06-01 Chris Dumez Make WebCore::defaultPortForProtocol() thread-safe https://bugs.webkit.org/show_bug.cgi?id=172797 Reviewed by Brent Fulgham. Make WebCore::defaultPortForProtocol() thread-safe since it is called from the SecurityOrigin constructor and SecurityOrigin objects are constructed from various threads. This should not regress the non-testing code paths since we only pay locking costs if a default port override has been set by the tests. * platform/URL.cpp: (WebCore::defaultPortForProtocolMapLock): (WebCore::defaultPortForProtocolMapForTesting): (WebCore::ensureDefaultPortForProtocolMapForTesting): (WebCore::registerDefaultPortForProtocolForTesting): (WebCore::clearDefaultPortForProtocolMapForTesting): (WebCore::defaultPortForProtocol): 2017-05-30 Dan Bernstein Fixed the build after r217588. * page/FrameView.h: Stopped exporting a function defined inline. 2017-05-30 Zalan Bujtas ASSERTION FAILED: m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout https://bugs.webkit.org/show_bug.cgi?id=171501 Reviewed by Simon Fraser. We should be able to paint as long as the tree is clean and we are in paintable state. * page/FrameView.cpp: (WebCore::FrameView::paintContents): 2017-05-30 Jeremy Jones m_resourceSelectionTaskQueue tasks should be cleared when player is destroyed to prevent invalid state. https://bugs.webkit.org/show_bug.cgi?id=172726 rdar://problem/30867764 Reviewed by Eric Carlson. I haven't found a reproducible way to make a test case for this race condition. If m_player is cleared while there is an outstanding task in m_resourceSelectionTaskQueue, that task may assume m_player is not null and crash. It is better to cancel that task than to perform it part way with null checks. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::clearMediaPlayer): 2017-05-27 Zalan Bujtas enclosingIntRect returns a rect with -1 width/height when the input FloatRect overflows integer. https://bugs.webkit.org/show_bug.cgi?id=172676 Reviewed by Simon Fraser. Clamp integer values soon after the enclosing rectangle is resolved. * platform/graphics/FloatRect.cpp: (WebCore::enclosingIntRect): 2017-05-26 Youenn Fablet Minor clean-up related to DocumentThreadableLoader redirections https://bugs.webkit.org/show_bug.cgi?id=172647 Reviewed by Chris Dumez. No change of behavior. Decrementing m_options redirect count directly instead of using an additional counter. To compare whether two URLs are same-origin, use scheme+host+port check as per the spec. This is fine as only the initial origin may have specific rules and we are using the scheme+host+port checks when already being gone to another origin. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): * loader/DocumentThreadableLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): 2017-05-25 Chris Dumez imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table_2.html is crashing https://bugs.webkit.org/show_bug.cgi?id=172628 Reviewed by Sam Weinig. In the event where a form is removed synchronously by a script during parsing, FormAssociatedElement::m_formSetByParser may end up referring to a form that is no longer in the document. As a result, we should make sure m_formSetByParser is still connected in FormAssociatedElement::insertedInto() before we call FormAssociatedElement::setForm(m_formSetByParser). Test: fast/dom/HTMLFormElement/form-removed-during-parsing-crash.html * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::insertedInto): 2017-05-25 Zalan Bujtas Frame's composited content is visible when the frame has visibility: hidden. https://bugs.webkit.org/show_bug.cgi?id=125565 Reviewed by Simon Fraser. Do not construct composited layers for hidden RenderWidgets (frameset, iframe, object). Note that we still construct layers for the associated renderers as usual. Tests: compositing/visibility/frameset-visibility-hidden.html compositing/visibility/iframe-visibility-hidden.html compositing/visibility/object-visibility-hidden.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPlugin): (WebCore::RenderLayerCompositor::requiresCompositingForFrame): 2017-05-25 Chris Dumez DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader https://bugs.webkit.org/show_bug.cgi?id=172578 Reviewed by Youenn Fablet. DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader. The rest of the methods do not. It is unsafe for it to rely on the resource's loader because it gets cleared when the load completes. A CachedRawresource may be reused from the memory cache once its load has completed. This would cause crashes in CachedRawResource::didAddClient() when replaying the redirects because it would call DocumentThreadableLoader::redirectReceived() and potentially not have a loader anymore. To hit this exact code path, you would need to make repeated XHR to a cacheable simple cross-origin resource that has cacheable redirect. Test: http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): * loader/DocumentThreadableLoader.h: 2017-05-25 Zalan Bujtas ASSERTION FAILED: !needsStyleRecalc() || !document().childNeedsStyleRecalc() https://bugs.webkit.org/show_bug.cgi?id=172576 Reviewed by Brent Fulgham. Ensure that we clean the subframe's document before start searching for a focusable element. Covered by existing test. * page/FocusController.cpp: (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): 2017-05-24 Jiewen Tan Crash on WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance + 1195 https://bugs.webkit.org/show_bug.cgi?id=172555 Reviewed by Ryosuke Niwa. setSelectionWithoutUpdatingAppearance could dispatch a synchronous focusin event, which could invoke an event handler that deteles the frame. Therefore, add a protector before the call. Test: editing/selection/select-iframe-focusin-document-crash.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelection): 2017-05-23 Zalan Bujtas ASSERTION FAILED: !renderer().view().needsLayout() while running media/video-main-content-autoplay.html https://bugs.webkit.org/show_bug.cgi?id=172476 Reviewed by Simon Fraser. This patch decouples the layout call logic from the post layout task timer setup. Just because we are switching over to asynchronous performPostLayoutTasks() it should not stop us from running layout on a dirty tree (we could encounter a forced layout (which sets m_postLayoutTasksTimer active) and a subsequent tree mutation during performPostLayoutTasks()). There are a few different ways to end up here: root layout is done -> call performPostLayoutTasks() synchronously -> 1. tree stays clean -> no action needed. 2. tree gets dirty -> setup performPostLayoutTasks timer -> run nested layout -> since m_postLayoutTasksTimer is active() we don't try to run performPostLayoutTasks() while in the nested layout and we return with a clean tree. * page/FrameView.cpp: (WebCore::FrameView::layout): 2017-03-24 Brent Fulgham Handle recursive calls to ProcessingInstruction::checkStyleSheet https://bugs.webkit.org/show_bug.cgi?id=169982 Reviewed by Antti Koivisto. See if we triggered a recursive load of the stylesheet during the 'beforeload' event handler. If so, reset to a valid state before completing the load. We should also check after 'beforeload' that we were not disconnected from (or moved to a new) document. I also looked for other cases of this pattern and fixed them, too. Tests: fast/dom/beforeload/image-removed-during-before-load.html fast/dom/beforeload/recursive-css-pi-before-load.html fast/dom/beforeload/recursive-link-before-load.html fast/dom/beforeload/recursive-xsl-pi-before-load.html * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::clearExistingCachedSheet): Added. (WebCore::ProcessingInstruction::checkStyleSheet): Prevent recursive calls into this function during 'beforeload' handling. Also, safely handle the case where the element was disconnected in the 'beforeload' handler (similar to what we do in HTMLLinkElement). (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the current document to match what we do in setXSLStyleSheet. * dom/ProcessingInstruction.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): Prevent recursive calls into this function during 'beforeload' handling. * html/HTMLLinkElement.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): safely handle the case where the element was disconnected in the 'beforeload' handler (similar to what we do in HTMLLinkElement). * style/StyleScope.cpp: (WebCore::Style::Scope::hasPendingSheet): Added. * style/StyleScope.h: 2017-04-09 Fujii Hironori generate-bindings-all.pl shouldn't use Perl threads https://bugs.webkit.org/show_bug.cgi?id=170106 Reviewed by Yusuke Suzuki. The use of interpreter-based threads in Perl is officially discouraged and not all Linux distributions and BSD compile Perl with threads support. Use fork instead of threads to run generate-bindings.pl in parallel. * bindings/scripts/generate-bindings-all.pl: (spawnGenerateBindingsIfNeeded): Added. (executeCommand): Removed the workaround for Cygwin Perl threads. (spawnCommand): Added. (worker): Deleted. 2017-03-22 Jiewen Tan ASSERT_WITH_SECURITY_IMPLICATION hit when removing an while dragging on iOS https://bugs.webkit.org/show_bug.cgi?id=165535 Reviewed by Ryosuke Niwa. Utimately we should prevent SliderThumbElement::unregisterForTouchEvents() being called while updating render tree. A quick fix for this is to move dispatchFormControlChangeEvent for input from stopDragging up to the callers which really needs to dispatch this event, i.e., finishing dragging the slider. It is clear that not every caller of stopDragging wants to dispatchFormControlChangeEvent. Test: fast/forms/range/range-remove-on-drag.html * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::stopDragging): (WebCore::SliderThumbElement::defaultEventHandler): (WebCore::SliderThumbElement::handleTouchEndAndCancel): 2017-03-16 Dean Jackson WebGL: Improve index validation when using uint index values https://bugs.webkit.org/show_bug.cgi?id=169798 Reviewed by Simon Fraser. Make sure that we test index validation with the correct type. Also stop using -1 in WebGLBuffer to indicate non-existant values. Test: fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Use optional<> and unsigned values. * html/canvas/WebGLBuffer.cpp: Use unsigned for maxIndex (they can't be negative) and optional<> to indicate unknown value. (WebCore::WebGLBuffer::getCachedMaxIndex): (WebCore::WebGLBuffer::setCachedMaxIndex): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Use optional<> and unsigned values. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateVertexAttributes): No need to check if an unsigned value is less than zero. 2017-03-15 Daniel Bates Iteratively dispatch DOM events after restoring a cached page https://bugs.webkit.org/show_bug.cgi?id=169703 Reviewed by Brady Eidson. Make dispatching of DOM events when restoring a page from the page cache symmetric with dispatching of events when saving a page to the page cache. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to dispatch DOM events on the restored frames. (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore(). (WebCore::FrameLoader::didRestoreFromCachedPage): Added. (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage(). * loader/FrameLoader.h: * page/FrameTree.cpp: (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order traversal of the frame tree optionally wrapping around to the deepest first child in the tree. (WebCore::FrameTree::deepFirstChild): Added. * page/FrameTree.h: 2017-05-22 Antti Koivisto Crash in WebCore::StyleRuleKeyframes::findKeyframeIndex https://bugs.webkit.org/show_bug.cgi?id=170756 Reviewed by Andreas Kling. Using a malformed key with CSSKeyframesRule.findRule crashes because CSSParser::parseKeyframeKeyList returns null which is then dereferenced. * css/CSSKeyframesRule.cpp: (WebCore::StyleRuleKeyframes::findKeyframeIndex): Null test. 2017-05-19 Chris Dumez Do not fire load event for SVGElements that are detached or in frameless documents https://bugs.webkit.org/show_bug.cgi?id=172289 Reviewed by Ryosuke Niwa. We should not fire load event for SVGElements that are detached or in frameless documents. Test: svg/load-event-detached.html * svg/SVGElement.cpp: (WebCore::SVGElement::sendSVGLoadEventIfPossible): 2017-05-19 Zalan Bujtas Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent(). https://bugs.webkit.org/show_bug.cgi?id=172309 Reviewed by Simon Fraser. This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION. In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function. In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it later, while accessing the children list. However this redundant ellipsis box was never added to the line, so the assertion hits incorrectly. Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::EllipsisBox): * rendering/InlineBox.cpp: This needs 32bits padding. (WebCore::InlineBox::invalidateParentChildList): * rendering/InlineBox.h: * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::placeEllipsis): 2017-05-18 Zalan Bujtas Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent(). https://bugs.webkit.org/show_bug.cgi?id=172309 Reviewed by Simon Fraser. This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION. In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function. In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it later, while accessing the children list. However this redundant ellipsis box was never added to the line, so the assertion hits incorrectly. Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::EllipsisBox): * rendering/InlineBox.cpp: (WebCore::InlineBox::invalidateParentChildList): * rendering/InlineBox.h: * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::placeEllipsis): Use the newly created ellipsis box instead. 2017-05-18 Dean Jackson Transform misplaces element 50% of the time https://bugs.webkit.org/show_bug.cgi?id=172300 Reviewed by Simon Fraser. A hardware-accelerated animation of the transform property requires layout to happen if it contains a translate operation using percentages, otherwise it may create an incorrect animation. The "50% of the time" comes in to play because the layout timer may sometimes fire before the animation timer. The test case contains a example that is much more likely to fail without this fix. Test: animations/needs-layout.html * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::animationTimerFired): If we've been told that we need a layout, and we have one pending, then force it before doing the rest of the animation logic. (WebCore::CSSAnimationController::updateAnimations): Check if the CompositeAnimation depends on layout, and tell the private controller that it should check for the necessity of a layout as the animation timer fires. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::animate): Ask the keyframes if this animation depends on layout. * page/animation/CompositeAnimation.h: (WebCore::CompositeAnimation::hasAnimationThatDependsOnLayout): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::computeLayoutDependency): Look at all the keyframe properties for something that is a translation using percentages. * page/animation/KeyframeAnimation.h: 2017-05-18 Daniel Bates Improve error message for Access-Control-Allow-Origin violation due to misconfigured server https://bugs.webkit.org/show_bug.cgi?id=162819 Reviewed by Joseph Pecoraro. Inspired by Blink change: At most one Access-Control-Allow-Origin header may be in an HTTP response. Improve the error message emitted on a CORS failure when Access-Control-Allow-Origin contains more than one origin, indicated by the presence of a ',', as a way to help web developers/server administrators differentiate between a misconfigured Access-Control-Allow-Origin header and a misconfigured server. * loader/CrossOriginAccessControl.cpp: (WebCore::passesAccessControlCheck): Defined a local variable to hold the value of securityOrigin.toString() and referenced this variable throughout the code to avoid computing the stringified security origin more than once. Switched to using makeString() to concatenate error message when the origin of the page does not match the value of the Access-Control-Allow-Origin header. 2017-05-18 Daniel Bates REGRESSION (r209608): Cross-origin plugin document opened in child window blocked by parent window CSP when object-src 'none' is set https://bugs.webkit.org/show_bug.cgi?id=172038 Reviewed by Andy Estes. Fixes an issue where a cross-origin plugin document opened in a child window would inherit the Content Security Policy (CSP) of its opener. In particular, a cross-origin plugin document opened in a child window would be blocked when the CSP of its opener disallows plugins (e.g. object-source 'none'). Prior to r209608 a document opened in a child window never inherited the CSP from its opener and a plugin document loaded in a subframe would unconditionally inherit the CSP from its parent frame. So, a plugin document opened in a child window would be allowed to load regardless of whether its opener had a CSP that prevented plugins. Following r209608 a document opened in a child window would inherit its CSP from its opener if and only if it would inherit the security origin from its opener (e.g. about:blank) or was a plugin document. The latter condition makes plugin documents opened in a child window unconditionally inherit the CSP from their opener and is the cause of this bug. It seems reasonable to exempt cross-origin plugin documents opened in a child window from the CSP inheritance rule because such documents cannot compromise the origin of their opener. Same-origin plugin documents opened in a child window will continue to inherit the CSP from their opener because such documents can compromise the origin of their opener. Tests: http/tests/security/contentSecurityPolicy/cross-origin-plugin-document-allowed-in-child-window.html http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html * dom/Document.cpp: (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner): Added. (WebCore::Document::initContentSecurityPolicy): * dom/Document.h: 2017-05-17 Ryosuke Niwa getElementById can return a wrong elemnt when a matching element is removed during beforeload event https://bugs.webkit.org/show_bug.cgi?id=171374 Reviewed by Brent Fulgham. The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated. Delay the event dispatch to the post insertion callback. Test: fast/html/link-element-removal-during-beforeload.html * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::insertedInto): (WebCore::HTMLLinkElement::finishedInsertingSubtree): * html/HTMLLinkElement.h: 2017-05-16 David Kilzer Remove C-style casts by using xmlDocPtr instead of void* Reviewed by Alex Christensen. * dom/TransformSource.h: Fix whitespace indentation. (typedef PlatformTransformSource): Use xmlDocPtr not void*. * dom/TransformSourceLibxslt.cpp: (WebCore::TransformSource::~TransformSource): Remove cast. * xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::document): Remove cast. * xml/XSLTProcessorLibxslt.cpp: (WebCore::xmlDocPtrFromNode): Remove casts. * xml/parser/XMLDocumentParser.h: (WebCore::xmlDocPtrForString): Update declaration to return xmlDocPtr not void*. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::doEnd): Change type of local variable from void* to xmlDocPtr. (WebCore::xmlDocPtrForString): Update to return xmlDocPtr not void*. 2017-05-15 David Kilzer Crash in libxml2.2.dylib: xmlDictReference Reviewed by Daniel Bates. Speculative fix and code clean-up based on source code inspection. The fix for the crash is in two parts that change XSLStyleSheet::parseString(): 1. Always set m_stylesheetDoc to nullptr after freeing it via XSLStyleSheet::clearXSLStylesheetDocument(). 2. Add nullptr check before using m_stylesheetDoc from parent. Broadly speaking, the changes are: - Extract code to reset m_stylesheetDoc into new private XSLStyleSheet::clearXSLStylesheetDocument() method. There is a special contract between m_stylesheetDoc and m_stylesheetDocTaken that wasn't being followed every time. See comment in XSLStyleSheet::compileStyleSheet(). - XSLStyleSheet::clearDocuments() now calls new clearXSLStylesheetDocument() method. Previously, it was not checking or resetting m_stylesheetDocTaken, and it might have leaked an xmlDocPtr if m_stylesheetDoc was set and m_stylesheetDocTaken was false. - XSLStyleSheet::parseString() now calls new clearXSLStylesheetDocument() method. Previously, it did not clear m_stylesheetDoc after freeing it, and it could return early due to a failure in xmlCreateMemoryParserCtxt(). - In XSLStyleSheet::parseString() use checked arithmetic when calculating 'size' for xmlCreateMemoryParserCtxt() and xmlCtxtReadMemory(). This code used to do an implicit unsigned -> signed integer conversion that could overflow. - Always iterate m_children using an 'auto& import' variable. * xml/XSLStyleSheet.h: (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add declaration. (WebCore::XSLStyleSheet::m_disabled): Add default initializer. (WebCore::XSLStyleSheet::m_stylesheetDoc): Ditto. (WebCore::XSLStyleSheet::m_stylesheetDocTaken): Ditto. (WebCore::XSLStyleSheet::m_parentStyleSheet): Ditto. * xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::XSLStyleSheet): Get rid of redundant initializers. Set m_parentStyleSheet if needed. (WebCore::XSLStyleSheet::~XSLStyleSheet): Call clearXSLStylesheetDocument() instead of custom code. Switch m_children fast iteration to use 'auto& import' variable. (WebCore::XSLStyleSheet::isLoading): Switch m_children fast iteration to use 'auto& import' variable. (WebCore::XSLStyleSheet::clearDocuments): Call clearXSLStylesheetDocument() instead of setting m_stylesheetDoc to nullptr. This might fix an occasional xmlDocPtr leak. (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add. This method always sets m_stylesheetDoc to nullptr (after freeing it if necessary) and sets m_stylesheetDocTaken to false. (WebCore::XSLStyleSheet::parseString): Call clearXSLStylesheetDocument(). Prior to this, m_stylesheetDoc might be left pointing to a freed value, and this method could return early if xmlCreateMemoryParserCtxt() failed. Switch to using Checked<> to compute required buffer size to parse XSL stylesheet, and return early on overflow. Clean up existing return statements to use boolean expressions. Add nullptr check for m_parentStyleSheet->m_stylesheetDoc before using it. (WebCore::XSLStyleSheet::loadChildSheet): Get rid of local variable by calling loadSheet() from last array element. (WebCore::XSLStyleSheet::compileStyleSheet): Add debug assert that m_stylesheetDoc is not nullptr. 2017-05-15 Gwang Yoon Hwang [CAIRO] Painting an image mask with a matrix above Pixman's limit breaks internal states of Cairo https://bugs.webkit.org/show_bug.cgi?id=169094 Reviewed by Žan Doberšek. It is the same problem which addressed in r212431. In HiDPI situation, it happens easily due to the size of coordinates. Also, if this bug happens, it will break the rendering continuously since we are reusing graphics contexts to render webpages in same webview. Test: fast/hidpi/hidpi-long-page-with-inset-element.html * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::PlatformContextCairo::pushImageMask): We can avoid the limit of the Pixman by reducing the source surface's size, and it will create a minimal pattern matrix. 2017-05-11 Jiewen Tan Check existence of a page before accessing its plugins https://bugs.webkit.org/show_bug.cgi?id=171712 Reviewed by Brent Fulgham. Test: plugins/navigator-plugin-crash.html * plugins/DOMPlugin.cpp: (WebCore::DOMPlugin::item): (WebCore::DOMPlugin::namedItem): 2017-05-12 Carlos Garcia Campos [GTK] ASSERTION FAILED: !m_flushingLayers https://bugs.webkit.org/show_bug.cgi?id=172025 Reviewed by Žan Doberšek. The problem is that syncImageBacking() is calling didChangeLayerState(). All sync methods are called by flushCompositingStateForThisLayerOnly() while flushing layers, so none of them should call didChange method that will schedule a new flush while flushing. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::syncImageBacking): 2017-05-12 Carlos Garcia Campos [GTK] GIF images are not properly loaded the first time https://bugs.webkit.org/show_bug.cgi?id=170432 Reviewed by Carlos Alberto Lopez Perez. When the GIF image is loaded for the first time, it's always read from the network, and the decoder is usually fetched with chunks of data. Then the data is cached in disk by the network process, so that when loaded from the cache, the whole encoded data is available to fetch the encoder. The problem is that we are failing to decode the image when giving chunks of data, that's why it only happens the first time loaded. If the first chunk of data provided is enough to get some metadata, including the size, but not frame contents, the load fails in CachedImage::addIncrementalDataBuffer() because the EncodedDataStatus reported is SizeAvailable but Image::isNull() returns true. An Image is considered to be Null when its size is empty, and the size is calculated always using the first frame in ImageFrameCache. Since we still don't have frames, the image is always Null in this case. It is not expected that EncodedDataStatus returns SizeAvailable and the image is Null, that's why it's considered an error and the load finishes with a decode error. However, the non CG ImageDecoder has a m_size member to handle this particular case, and it's when m_size is set when EncodedDataStatus changes to SizeAvailable. We should return the ImageEncoder size as the ImageSize when we have a decoder but not frames yet. Test: http/tests/images/gif-progressive-load.html * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::size): Return ImageDecoder::size() without caching it, if frame list is empty. 2017-05-10 Andy Estes REGRESSION (r167845): ASSERT(!m_renderView.needsLayout()) in svg/custom/bug79798.html https://bugs.webkit.org/show_bug.cgi?id=132297 Reviewed by Simon Fraser. We don't know why m_renderView needs layout in this case, but we know that we don't need to assert if the client hasn't set the ScrollableInnerFrameTrigger compositing trigger. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): 2017-05-10 Antti Koivisto REGRESSION (r207372) Visibility property is not inherited when used in an animation https://bugs.webkit.org/show_bug.cgi?id=171883 Reviewed by Simon Fraser. The problem here is that our animation code is tied to renderers. We don't have renderers during the initial style resolution so animations are not applied yet. When constructing renderers we set their style to the initial animated style but this step can't implement inheritance. Normally this is invisible as the first animation frame will immediately inherit the style correctly. However in this case the animation is discrete and the first frame is the same as the initial state. With r207372 we optimize the descendant style change away. This patch fixes the problem by tracking that the renderer has initial animated style and inheriting it to descendants during next style resolution even if it doesn't change. Test: animations/animation-initial-inheritance.html * rendering/RenderElement.cpp: (WebCore::RenderElement::RenderElement): * rendering/RenderElement.h: (WebCore::RenderElement::hasInitialAnimatedStyle): (WebCore::RenderElement::setHasInitialAnimatedStyle): * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::createRenderer): Set a bit on renderer indicating it has initial animated style. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Return at least 'Inherit' for style change when updating renderer with initial animated style. 2017-05-10 Chris Dumez REGRESSION (r206960): Possible null pointer dereference under DOMSelection::getRangeAt() https://bugs.webkit.org/show_bug.cgi?id=171925 Reviewed by Wenson Hsieh. We have evidence that selection().firstRange() can return null in DOMSelection::getRangeAt(). When this happens, we now throw an INDEX_SIZE_ERR instead of dereferencing it. I believe this can happen if the VisibleSelection is orphaned but not none, because rangeCount() only checks for isNone() but VisibleSelection::firstRange() can return null if isNoneOrOrphaned(). No new tests, I do not know how to reproduce. * page/DOMSelection.cpp: (WebCore::DOMSelection::getRangeAt): 2017-05-10 Andy Estes Keyboard input suppression should extend to subframes https://bugs.webkit.org/show_bug.cgi?id=171880 Reviewed by Ryosuke Niwa. Test: http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html * dom/EventDispatcher.cpp: (WebCore::shouldSuppressEventDispatchInDOM): Changed to call shouldSuppressKeyboardInput() on the main frame's loader. * editing/Editor.cpp: (WebCore::Editor::shouldInsertText): Ditto. 2017-05-21 Michael Catanzaro [GTK] Remove Firefox user agent quirk for Google domains https://bugs.webkit.org/show_bug.cgi?id=171941 Reviewed by Carlos Garcia Campos. * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::quirksForURL): (WebCore::UserAgentQuirks::stringForQuirk): (WebCore::urlRequiresFirefoxBrowser): Deleted. (WebCore::UserAgentQuirks::firefoxRevisionString): Deleted. * platform/UserAgentQuirks.h: * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2017-05-10 Michael Catanzaro Remove user agent quirk for Slack https://bugs.webkit.org/show_bug.cgi?id=171869 Reviewed by Carlos Garcia Campos. The user agent quirk for Slack does not seem to be necessary anymore. I am able to use Slack without difficulty using our default user agent. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2017-05-09 Michael Catanzaro Update Chrome and Firefox versions in user agent quirks https://bugs.webkit.org/show_bug.cgi?id=171823 Reviewed by Carlos Alberto Lopez Perez. * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::stringForQuirk): (WebCore::UserAgentQuirks::firefoxRevisionString): 2017-05-08 Zalan Bujtas Text overlaps on http://www.duden.de/rechtschreibung/Acre https://bugs.webkit.org/show_bug.cgi?id=171796 Reviewed by Simon Fraser. Simple line layout pre-measures space using the primary font, even if the space glyph requires a fallback font (and even if the string does not have a space in it at all). When this width gets cached (see WidthCache) we might end up using it later during normal line layout and it could produce incorrect layout. This patch removes the space width caching from Simple line layout, since Font already caches it. Test: fast/text/simple-line-layout-fallback-space-glyph.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::createLineRuns): * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition): (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth): * rendering/SimpleLineLayoutTextFragmentIterator.h: 2017-05-08 Zalan Bujtas Bail out of simple line layout when hyphen needs a fallback font. https://bugs.webkit.org/show_bug.cgi?id=171811 Reviewed by Antti Koivisto. With hyphen: auto is set, we don't know if the hypen string is going to be used, until after we started laying out the content and figured that the text overflows the line. However it's too late to bail out of simple line layout at this point, so let's just pre-check if the hyphen string needs a fallback font. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): 2017-05-09 Carlos Garcia Campos [GTK] Building Webkit2Gtk without OpenGL fails. https://bugs.webkit.org/show_bug.cgi?id=170959 Reviewed by Žan Doberšek. * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: 2017-05-04 Jiewen Tan Search events should not fire synchronously for search type input elements with incremental attribute set https://bugs.webkit.org/show_bug.cgi?id=171376 Reviewed by Chris Dumez. For some reasons, we fire search events immediately for search type input elements with incremental attribute set only when the length of the input equals to zero. This behaviour should be prevented as event listeners in the middle might perform unexpectedly. Test: fast/forms/search/search-incremental-crash.html * html/SearchInputType.cpp: (WebCore::SearchInputType::startSearchEventTimer): 2017-05-08 Antti Koivisto ComposedTreeIterator does not traverse all slotted children if the traversal root is a slot element. https://bugs.webkit.org/show_bug.cgi?id=171375 Reviewed by Zalan Bujtas. We were hitting an assert when using details element with a flow thread. The root cause for this turned out to be that we only traversed the first slotted child if the traversal root was a slot element. Test: fast/html/details-flow-thread.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::traverseNextLeavingContext): Try to traverse to the next slotted child before testing if we at the end of the current context. 2017-04-21 Konstantin Tokarev [cmake] WTF target should not have wtf and subdirectries in public interface https://bugs.webkit.org/show_bug.cgi?id=171115 Reviewed by Michael Catanzaro. In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of targets as their public interface, so that linked targets can use them implicitly without copying directory lists around. This matches existing practice for all targets except WTF, headers from which are always included with full path starting from " Renderers being destroyed should not be added to AX's deferred list. https://bugs.webkit.org/show_bug.cgi?id=171768 Reviewed by Simon Fraser. In certain cases, when custom scrollbars are present, while destroying the scrollbars' block parent, we - first remove the block from the AX's deferred list (AXObjectCache::remove) - destroy the render layer that owns the custom scrollbars (RenderLayer::destroyLayer) - detach the scrollbars from the parent (block) (RenderObject::removeFromParent) - clean up the block's lines (RenderBlock::deleteLines) - push the block back to the AX's deferred list (AXObjectCache::recomputeDeferredIsIgnored) At this point no one will remove the current block from AX's deferred list. Test: accessibility/crash-when-renderers-are-added-back-to-deferred-list.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::recomputeDeferredIsIgnored): (WebCore::AXObjectCache::deferTextChanged): 2017-05-05 Dean Jackson ...and now the GTK and Windows builds. * platform/gtk/WidgetGtk.cpp: (WebCore::Widget::paint): * platform/win/WidgetWin.cpp: (WebCore::Widget::paint): 2017-05-05 Dean Jackson Restrict SVG filters to accessible security origins https://bugs.webkit.org/show_bug.cgi?id=118689 Reviewed by Brent Fulgham. Certain SVG filters should only be allowed to operate on content that is has SecurityOrigin access to. Implement this by including a flag in PaintInfo and LayerPaintingInfo, and have RenderWidget make sure the documents have acceptable SecurityOrigins as it goes to paint. This could be used as the first step in a "safe painting" strategy, allowing some content to be rendered into a canvas or via the element() CSS function... but it is only a small first step. Test: http/tests/css/filters-on-iframes.html * page/FrameView.cpp: (WebCore::FrameView::paintContents): * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paint): * platform/ScrollView.h: * platform/Scrollbar.cpp: (WebCore::Scrollbar::paint): * platform/Scrollbar.h: * platform/Widget.h: * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin): * platform/graphics/filters/FilterOperations.h: * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::build): * rendering/FilterEffectRenderer.h: * rendering/PaintInfo.h: (WebCore::PaintInfo::PaintInfo): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paint): (WebCore::RenderLayer::setupFilters): (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): * rendering/RenderLayer.h: * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::paint): * rendering/RenderScrollbar.h: * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paintContents): 2017-05-05 Antti Koivisto ASSERTION FAILED: !frame().document()->inRenderTreeUpdate() in WebCore::FrameView::layout(bool) https://bugs.webkit.org/show_bug.cgi?id=171717 Reviewed by Brent Fulgham. * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkCompleted): Don't allow frame load to complete in the middle of a render tree update. Instead delay the check. 2017-05-04 Mark Lam DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock. https://bugs.webkit.org/show_bug.cgi?id=171716 Reviewed by Saam Barati. No new tests. This issue was caught by existing tests. IDBRequest::setResult() needs to acquire the JSLock before calling toJS() (which does JS conversion and therefore, potentially JS allocations). * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::setResult): (WebCore::IDBRequest::setResultToStructuredClone): 2017-05-05 Carlos Garcia Campos [GStreamer] Do not report more errors after the first one https://bugs.webkit.org/show_bug.cgi?id=171722 Reviewed by Xabier Rodriguez-Calvar. We can receive several error messages for the same error from different elements. That's not expected by the media source selection algorithm implementation. I don't know if didn't happen with previous versions of GST, but since the upgrade to 1.10.4 several tests are failing because of this. Fixes: media/video-error-does-not-exist.html media/video-load-networkState.html media/video-source-error.html media/video-source-none-supported.html media/video-source-moved.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Return early also when an error already occured. 2017-05-05 Carlos Garcia Campos [GStreamer] Fix handling of gst errors in MediaPlayerPrivateGStreamer::handleMessage https://bugs.webkit.org/show_bug.cgi?id=171721 Reviewed by Xabier Rodriguez-Calvar. We are checking the GError only comparing the code, and ignoring the domain in some cases. Use g_error_matches() in those cases instead of only checking the code. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2017-05-04 Antti Koivisto REGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin is also transitioned https://bugs.webkit.org/show_bug.cgi?id=171250 Reviewed by Geoffrey Garen. We were mapping unknown properties to 'all' animation. With this patch we ignore them instead. The patch also implements roundtripping of unknown properties via CSSOM, matching Blink and Gecko. Test: transitions/transition-unknown-property-ignore.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTransitionPropertyValue): Return the correct name for unknown properties. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationProperty): Map any unknown property to AnimateUnknownProperty mode instead of falling back to the default of AnimateAll. Save the unknown property name so we can roundtrip it properly. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): Ignore AnimateUnknownProperty like AnimateNone. * platform/animation/Animation.h: (WebCore::Animation::unknownProperty): (WebCore::Animation::setUnknownProperty): 2017-05-04 Zalan Bujtas Should never hit layout while updating the render tree. https://bugs.webkit.org/show_bug.cgi?id=171643 Reviewed by Antti Koivisto. Laying out a half-baked render tree is not a great idea. Especially considering that layout (sadly) can mutate the render tree. * page/FrameView.cpp: (WebCore::FrameView::layout): 2017-05-04 Dave Hyatt REGRESSION(STP): rgb() with calc() containing variables doesn't work https://bugs.webkit.org/show_bug.cgi?id=169939 Reviewed by Zalan Bujtas. Added new test in fast/css/variables. * css/CSSCalculationValue.cpp: (WebCore::CSSCalcExpressionNodeParser::parseValue): Treat floats in calcs as integers when we can. 2017-05-03 Zalan Bujtas SearchInputType could end up with a mismatched renderer. https://bugs.webkit.org/show_bug.cgi?id=171547 Reviewed by Antti Koivisto. Normally we've got the correct renderer by the time we call into SearchInputType. However, since HTMLInputElement::updateType() eagerly updates the type while the associated renderers are done lazily (so we don't get them updated until after the next tree update), we could actually end up with a mismatched renderer (e.g. through form submission). Test: fast/forms/change-input-type-and-submit-form-crash.html * html/SearchInputType.cpp: (WebCore::SearchInputType::addSearchResult): (WebCore::SearchInputType::didSetValueByUserEdit): 2017-05-07 Michael Catanzaro [GTK] Cannot sign in with new Google sign-in page https://bugs.webkit.org/show_bug.cgi?id=171770 Reviewed by Carlos Garcia Campos. Google's new authentication page does not work with the Firefox user agent that's required to make various Google websites work. Special-case accounts.google.com so that it receives our standard user agent. * platform/UserAgentQuirks.cpp: (WebCore::isGoogle): (WebCore::urlRequiresFirefoxBrowser): 2017-05-03 Michael Catanzaro YouTube user agent quirk breaks new YouTube https://bugs.webkit.org/show_bug.cgi?id=171603 Reviewed by Carlos Garcia Campos. Our user agent quirk to make YouTube 360 work breaks the new YouTube UI, causing it to attempt to use the obsolete custom elements v0 API. WebKit only supports the v1 API. We have to remove this quirk. Note this does not affect Safari as Apple ports don't use our user agent quirks. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2017-05-03 Zalan Bujtas RenderSearchField should not use isTextField() in SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT https://bugs.webkit.org/show_bug.cgi?id=171608 Reviewed by Simon Fraser. isTextField() is true for any generic single line text control. * rendering/RenderObject.h: (WebCore::RenderObject::isSearchField): * rendering/RenderSearchField.h: 2017-05-03 Daniel Bates Abandon the current load once the provisional loader detaches from the frame https://bugs.webkit.org/show_bug.cgi?id=171577 Reviewed by Brent Fulgham and Brady Eidson. We detach all child frames as part of setting our document loader to the provisional document loader when committing a load for a frame. Detaching child frames invokes the unload event handler on the child frames that can run arbitrary JavaScript script. Among other things, such script can initiate a new load in the frame whose current load is being committed. We should stop processing the current load as soon as we detect that updating our document loader has started a new provisional load. Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::transitionToCommitted): 2017-05-02 Carlos Garcia Campos [GStreamer] Dailymotion live stream videos don't play https://bugs.webkit.org/show_bug.cgi?id=170767 Reviewed by Sergio Villar Senin. The video shows a message saying that an error occurred and nothing is played. There are actually several problems with dailymotion. The main issue is that URLs are redirected by the server, and GStreamer needs to know the redirected URL. Once GStreamer knows the redirected URL the error message no longer appears, the video starts but it always stops after a few seconds. This is because the source receives an early EOS while still downloading the fragments. The reason of the early EOS is because dailymotion sends a wrong Content-Length header, something that is expected to happen and we correctly handle that case when receiving the data, by updating the size accordingly if the bytes received are longer than the expected content length. This particular case doesn't work well with GStreamer automatic EOS handling, which is the default. At some point, GStreamer detects that the bytes received are at least the expected ones and emits a GST_EVENT_EOS that the GstUriDownloader handles finishing the download early. We should always disable automatic EOS, since we know when EOS actually happens and we already call gst_app_src_end_of_stream(). This patch also emits a GST_EVENT_CUSTOM_DOWNSTREAM_STICKY event to let GStreamer know about the HTTP headers sent and received. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): Disable automatic EOS. (webKitWebSrcGetProperty): Return the redirected URL in case of redirection. (webKitWebSrcStart): Pass the ResourceRequest to the stream clients. (webKitWebSrcQueryWithParent): Set the redirected URL in the query in case of redirection. (webKitWebSrcSetUri): Clear also the redirected URL when setting a new URI. (StreamingClient::StreamingClient): Use GRefPtr for the source and initialize the request too. (StreamingClient::~StreamingClient): Remove explicit unref. (StreamingClient::createReadBuffer): (StreamingClient::handleResponseReceived): Initialize the redirected URL in case of redirection. Create and push the HTTP headers event. (StreamingClient::handleDataReceived): (StreamingClient::handleNotifyFinished): (CachedResourceStreamingClient::CachedResourceStreamingClient): (CachedResourceStreamingClient::responseReceived): (CachedResourceStreamingClient::accessControlCheckFailed): (CachedResourceStreamingClient::loadFailed): (ResourceHandleStreamingClient::ResourceHandleStreamingClient): (ResourceHandleStreamingClient::didFail): (ResourceHandleStreamingClient::wasBlocked): (ResourceHandleStreamingClient::cannotShowURL): 2017-04-12 Carlos Garcia Campos [GTK] Crash at WebCore::ResourceHandle::clearClient() when streaming live video from dailymotion https://bugs.webkit.org/show_bug.cgi?id=169725 Reviewed by Michael Catanzaro. Make ResourceHandleStreamingClient refcounted and add an invalidate method to do the cleanup in the networking thread while keeping a reference. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcStop): Call invalidate before reseting client pointer. (webKitWebSrcStart): Ditto. (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Remove all cleanup code after the run loop run call. (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Just detach the thread. (ResourceHandleStreamingClient::invalidate): Schedule a task on the networking thread to clean up and fiish the run loop, protecting this. (ResourceHandleStreamingClient::setDefersLoading): Protect this. (ResourceHandleStreamingClient::didReceiveResponse): Do nothing if client was invalidated. (ResourceHandleStreamingClient::didReceiveBuffer): Ditto. (ResourceHandleStreamingClient::didFinishLoading): Ditto. 2017-05-01 Chris Dumez Documents created using DOMParser.parseFromString should inherit their context document's origin / URL https://bugs.webkit.org/show_bug.cgi?id=171499 Reviewed by Sam Weinig. Documents created using DOMParser.parseFromString should inherit their context document's origin / URL: - https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring Test: fast/dom/domparser-parsefromstring-origin.html * xml/DOMParser.cpp: (WebCore::DOMParser::parseFromString): 2017-05-01 Chris Dumez Do not dispatch SVG load event in frameless documents https://bugs.webkit.org/show_bug.cgi?id=171505 Reviewed by Andreas Kling. We should not dispatch SVG load events in frameless documents. took care of most load events but forgot the SVG load event. Test: fast/dom/domparser-parsefromstring-svg-load-event.html * dom/Document.cpp: (WebCore::Document::implicitClose): 2017-04-28 Zalan Bujtas iBooks text can overlap, sometimes columns are shifted splitting words. https://bugs.webkit.org/show_bug.cgi?id=171472 Reviewed by Antti Koivisto. Instead of just checking if the glyph is taller than the line, we need to ensure that both the ascent and the descent have enough space (this is for -webkit-line-box-contain: glyph). Test: fast/text/simple-line-layout-glyph-overflows-line.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForText): compute the available space for the ascent/descent and check them against the ceil-ed(see FontCascade::floatWidthForSimpleText) glyph min/max y. 2017-04-28 Per Arne Vollan Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged(). https://bugs.webkit.org/show_bug.cgi?id=171427 rdar://problem/31863417 Reviewed by Brent Fulgham. The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call to the parentObject() method. This will cause a crash when accessing the object later in this method. Protect the current object while executing arbitrary event code. Test: accessibility/accessibility-crash-setattribute.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged): 2017-04-28 Dean Jackson App crashing: Dispatch queue: com.apple.root.user-interactive-qos / vBoxConvolve / WebCore::FEGaussianBlur::platformApplySoftware() https://bugs.webkit.org/show_bug.cgi?id=171461 Reviewed by Eric Carlson. We're getting reports of crashes in this function, caused by null or empty data being passed to vImage. Guard against this, in a way that will ASSERT in debug builds if anyone comes across it. Test: css3/filters/blur-various-radii.html * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::accelerateBoxBlur): Return early if things don't look good. 2017-04-28 Chris Dumez URLSearchParams should be reflective https://bugs.webkit.org/show_bug.cgi?id=171345 Reviewed by Alex Christensen. There was a bug in our implementation of [1] where we would replace '+' with 0x20 *after* URL-decoding the string, instead of *before*. This was causing us to replace URL-encoded '+' characters with 0x20. [1] https://url.spec.whatwg.org/#concept-urlencoded-parser No new tests, updated existing test. * platform/URLParser.cpp: 2017-04-27 Antti Koivisto Repeated layouts in Mail due to viewport units being used with auto-sizing https://bugs.webkit.org/show_bug.cgi?id=171371 Reviewed by Zalan Bujtas. Test: css3/viewport-percentage-lengths/vh-auto-size.html Auto-sizing code would adjust the size of the view in the beginning of layout(). This would end up invalidating style for elements that use vh units and we would perform main layout with unclean style. This would result in endless layout loops and hit assert on debug. * page/FrameView.cpp: (WebCore::FrameView::availableContentSizeChanged): Ensure we heve clean style after resize if we are in pre-layout. 2017-04-27 Zalan Bujtas Text gets cut off when bailing out of simple line layout with widows. https://bugs.webkit.org/show_bug.cgi?id=171370 Reviewed by Antti Koivisto. Normal line layout requires an extra layout to handle widows. See RenderBlockFlow::relayoutToAvoidWidows. Test: fast/multicol/simple-line-layout-widows-when-switching-over-to-normal-line-layout.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::ensureLineBoxes): 2017-04-26 Zalan Bujtas Forced page break on :after triggers infinite loop in column balancing https://bugs.webkit.org/show_bug.cgi?id=171309 rdar://problem/26285884 Reviewed by David Hyatt. Stop trying to balance the columns when the forced page breaks >= the number of columns even when this number is 1. Content will always overflow to the next page. see https://chromium.googlesource.com/chromium/src/+/fbbebf38cefb2712c912581eccb046ef363ec84e%5E%21/#F2 Test: fast/multicol/infinite-loop-when-forced-break.html * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::calculateBalancedHeight): 2017-04-25 Brent Fulgham Relax the event firing ASSERT for Attr changes https://bugs.webkit.org/show_bug.cgi?id=171236 Reviewed by Dean Jackson. The assertions added in Bug 167318 were overly strict, and trigger for valid behavior. Relax the assertion preventing event dispatch for the case of Attr elements at the end of childrenChanged. Test: fast/dom/HTMLLinkElement/event-while-removing-attribute.html * dom/Attr.cpp: (WebCore::Attr::childrenChanged): 2017-04-25 Chris Dumez Content-Disposition header filename is ignored when 'download' attribute is specified in HTML https://bugs.webkit.org/show_bug.cgi?id=171239 Reviewed by Alex Christensen. Add isAttachmentWithFilename() utility method to ResourceResponse to implement: - https://html.spec.whatwg.org/#as-a-download (Step 2) Test: http/tests/download/anchor-download-attribute-content-disposition.html * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::isAttachmentWithFilename): * platform/network/ResourceResponseBase.h: 2017-04-21 Zalan Bujtas REGRESSION(r205374):
  • content inside
      should mid-word wrap when word-break: break-word is present. https://bugs.webkit.org/show_bug.cgi?id=171108 Reviewed by Dan Bernstein. This patch ensures that we search for mid-word breaks when a zero sized element has been committed on the line unless it's an image or some other replaced element with special properties (e.g. list-style: inside). Tests: fast/replaced/ul-li-word-break-break-word.html fast/replaced/zero-width-image-force-linebreak.html * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleReplaced): (WebCore::BreakingContext::handleText): This matches pre-r205374 behaviour, but it's explicit about whether a replaced width has already been committed on the current line. * rendering/line/LineWidth.cpp: (WebCore::LineWidth::commit): * rendering/line/LineWidth.h: (WebCore::LineWidth::hasCommittedReplaced): (WebCore::LineWidth::addUncommittedReplacedWidth): These 2 last functions were removed with r205374 (and now I am adding them back). 2017-04-21 Chris Dumez Regression(r206240): XMLSerializer.serializeToString() does not properly escape '<' / '>' in attribute values https://bugs.webkit.org/show_bug.cgi?id=171132 Reviewed by Ryosuke Niwa. Use XMLSerialization [1] in MarkupAccumulator::appendAttribute() when inXMLFragmentSerialization() returns true, even if the node's associated document is an HTML document. When XMLSerializer.serializeToString() is called on a Node, we want XML serialization, even if the node comes from an HTML document. [1] https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization Test: fast/dom/XMLSerializer-serializeToString-entities.html * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendAttributeValue): (WebCore::MarkupAccumulator::appendAttribute): * editing/MarkupAccumulator.h: 2017-04-21 Per Arne Vollan Validate vImage arguments https://bugs.webkit.org/show_bug.cgi?id=171109 rdar://problem/30236606 Reviewed by Brent Fulgham. When writing data to a canvas context, clip the source rectangle to the data rectangle to make sure we will not attempt to read data outside of the buffer. Test: fast/canvas/canvas-crash.html * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::putImageData): 2017-04-21 Gwang Yoon Hwang Do not paint the border of the box if the dirty region does not intersect with border area https://bugs.webkit.org/show_bug.cgi?id=170988 Reviewed by Simon Fraser. No new tests, since there is no change in behavior. * platform/graphics/GeometryUtilities.cpp: (WebCore::ellipseContainsPoint): Checks if a point is within an ellipse. * platform/graphics/GeometryUtilities.h: Replace header-guards with #pragma once. * platform/graphics/RoundedRect.cpp: (WebCore::RoundedRect::contains): Implemented to know the dirty rectangle intersects with rounded rectangle or not. * platform/graphics/RoundedRect.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBorder): When typing in decorated text box, the dirty rect generated only for the inside of the text box, not for the decorations. So we can avoid the calculations to draw borders if the inner border totally covers the target surface. It will optimize the rendering process since we don't have to render border decorations whenever we type somethings in side of the text input element. 2017-04-20 Wenson Hsieh Inline anchor elements cannot be dragged when starting the drag from a block descendant https://bugs.webkit.org/show_bug.cgi?id=171062 Reviewed by Tim Horton. Tweaks DragController::draggableElement to traverse the DOM instead of the render tree when finding a draggable element. This prevents us from skipping elements that are in the DOM ancestor chain, but appear as siblings to the hit-tested node's renderer in the render tree. There was also previously a check to ensure that we skip anonymous RenderObjects while traversing up the chain, but this is no longer necessary fter this change, since all the elements we traverse in the DOM should have renderers that are not anonymous. Test: fast/events/drag-and-drop-link-containing-block.html * page/DragController.cpp: (WebCore::DragController::draggableElement): 2017-04-19 Alex Christensen Parsing large XML strings fails https://bugs.webkit.org/show_bug.cgi?id=170999 Reviewed by Brady Eidson. Test: fast/dom/xml-large.html * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLParserContext::createStringParser): (WebCore::XMLParserContext::createMemoryParser): Allow huge XML strings. They work fine in Chrome and Firefox. 2017-04-19 Joseph Pecoraro ASAN Crash running LayoutTests/inspector/worker tests https://bugs.webkit.org/show_bug.cgi?id=170967 Reviewed by Alex Christensen. * workers/WorkerMessagingProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): Make the MessagingProxy thread safe ref counted. Since it used to delete itself, turn this into a ref (implicit on construction) and deref (replacing delete this). (WebCore::WorkerMessagingProxy::postMessageToPageInspector): When dispatching have the lambda implicitly ref/deref with the lambda to keep the proxy alive while a lambda is queued. 2017-04-19 Dave Hyatt Remove bogus assert for :not. https://bugs.webkit.org/show_bug.cgi?id=170995 Reviewed by Zalan Bujtas. * css/parser/CSSSelectorParser.cpp: 2017-04-19 Antti Koivisto Avoid repaints for invisible animations on tumblr.com/search/aww https://bugs.webkit.org/show_bug.cgi?id=170986 Reviewed by Andreas Kling. Test: fast/repaint/mutate-non-visible.html * rendering/style/RenderStyle.cpp: (WebCore::requiresPainting): (WebCore::RenderStyle::changeRequiresRepaint): If an element is invisible it does not require repaint even if something else changes. 2017-04-18 Brent Fulgham JSEventListener::m_isolatedWorld should be a Ref https://bugs.webkit.org/show_bug.cgi?id=170910 Reviewed by Alex Christensen. Since m_isolatedWorld should never be nullptr, change the implementation of m_isolatedWorld from a RefPtr to a Ref, and adjust the various call sites to support this change. This should help us catch any changes that permit the isolatedWorld to be set to nullptr. No new tests since there should be no change in behavior. * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::JSEventListener): (WebCore::JSEventListener::initializeJSFunction): (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::cast): (WebCore::JSEventListener::isolatedWorld): (WebCore::JSEventListener::jsFunction): 2017-04-18 Ryan Haddad Rebaseline bindings tests after r215486. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjOnfooGetter): (WebCore::jsTestObjOnwebkitfooGetter): 2017-04-18 Brent Fulgham Correct handling of isolatedWorld in event handling https://bugs.webkit.org/show_bug.cgi?id=65589 Reviewed by Geoffrey Garen. This patch was inspired by Adam's original patch as well as the following Blink change: https://src.chromium.org/viewvc/blink?revision=152377&view=revision Thread isolatedWorld state through event handling logic. Tests: fast/dom/event-attrs-isolated-world.html http/tests/security/isolatedWorld/onclick-attribute.html * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::initializeJSFunction): (WebCore::JSEventListener::world): (WebCore::eventHandlerAttribute): (WebCore::setEventHandlerAttribute): (WebCore::windowEventHandlerAttribute): (WebCore::setWindowEventHandlerAttribute): (WebCore::documentEventHandlerAttribute): (WebCore::setDocumentEventHandlerAttribute): * bindings/js/JSEventListener.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * dom/Document.cpp: (WebCore::Document::setWindowAttributeEventListener): (WebCore::Document::getWindowAttributeEventListener): * dom/Document.h: * dom/Element.cpp: (WebCore::Element::setAttributeEventListener): * dom/EventTarget.cpp: (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::attributeEventListener): * dom/EventTarget.h: * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseAttribute): * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::parseAttribute): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::parseAttribute): 2017-04-18 Andreas Kling Break Document::m_associatedFormControls reference cycle. Reviewed by Antti Koivisto. There was a race between didAssociateFormControls() and didAssociateFormControlsTimerFired() where detaching Document from its frame between the two would lead to an unbreakable reference cycle between Document and its form elements. Solve this by clearing the set of associated form elements in removedLastRef(), where we clear all the other strong smart pointers to elements. * dom/Document.cpp: (WebCore::Document::removedLastRef): 2017-04-16 Chris Dumez CMD+R / CMD+Q is considered as user interaction and beforeunload alert is shown https://bugs.webkit.org/show_bug.cgi?id=169995 Reviewed by Sam Weinig. Any key event was considered as user interaction with the page, which meant that they would allow beforeunload alerts to be shown even when they do not represent actual user interaction (e.g CMD+R / CMD+Q / CMD+T keyboard shortcuts). To address the issue, we now only treat as user interaction with the page key events that are actually handled by the page (i.e. handled by JS, typed into a field, ...). Tests: fast/events/beforeunload-alert-handled-keydown.html fast/events/beforeunload-alert-unhandled-keydown.html * dom/Document.h: (WebCore::Document::setUserDidInteractWithPage): (WebCore::Document::userDidInteractWithPage): * dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): * loader/FrameLoader.cpp: (WebCore::shouldAskForNavigationConfirmation): * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): (WebCore::EventHandler::internalKeyEvent): * page/EventHandler.h: 2017-04-05 Miguel Gomez [GTK+] PNG animations that should run once are not played at all https://bugs.webkit.org/show_bug.cgi?id=170499 Reviewed by Carlos Garcia Campos. The repetition count reported bu the PNGImageDecoder is wrong. It's returning m_playCount - 1, which means 0 for the animations that need to be played once. Change it to return an appropriate value. Covered by existent tests. * platform/image-decoders/png/PNGImageDecoder.cpp: (WebCore::PNGImageDecoder::repetitionCount): * platform/image-decoders/png/PNGImageDecoder.h: 2017-04-14 Zalan Bujtas text-align start / end failure in table cells https://bugs.webkit.org/show_bug.cgi?id=141417 Reviewed by Antti Koivisto. Apply "text-align: center" on th elements when parent's computed value for the 'text-align' property is its initial value, unless it is explicitly set. Test: fast/table/center-th-when-parent-has-initial-text-align.html * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInitialTextAlign): (WebCore::StyleBuilderCustom::applyValueTextAlign): * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): (WebCore::StyleResolver::applyProperty): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasExplicitlySetTextAlign): (WebCore::RenderStyle::setHasExplicitlySetTextAlign): (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign): (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign): 2017-04-13 Dean Jackson Large negative animation-delays may not work depending on machine uptime https://bugs.webkit.org/show_bug.cgi?id=166962 Reviewed by Tim Horton. If you set a really negative animation delay, it would cause AnimationBase::m_startTime to become negative, because the delay value was "bigger" than monotonicallyIncreasingTime. However, the state machine was using -1 to mean that the start time hadn't yet been set. Classic cmarrin! Replace all the special values with std::optional, and use nullopt to mean the value doesn't exist yet. Test: animations/large-negative-delay.html * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine): (WebCore::AnimationBase::fireAnimationEventsIfNeeded): (WebCore::AnimationBase::getTimeToNextEvent): (WebCore::AnimationBase::freezeAtTime): (WebCore::AnimationBase::getElapsedTime): * page/animation/AnimationBase.h: Use std::optional. (WebCore::AnimationBase::paused): 2017-04-13 Antti Koivisto Don't invalidate composition for style changes in non-composited layers https://bugs.webkit.org/show_bug.cgi?id=170805 Reviewed by Simon Fraser. Test: compositing/updates/animation-non-composited.html In most cases they can't affect composition. Composition updates are expensive, this can save a lot of work (tumblr.com animations hit this at the moment). * rendering/RenderElement.h: (WebCore::RenderElement::createsGroup): (WebCore::RenderElement::createsGroupForStyle): Factor to a static function so we can test style directly. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerStyleChanged): (WebCore::RenderLayerCompositor::styleChangeMayAffectIndirectCompositingReasons): Test if style change might cause compositing change that can't be determined without compositing update. * rendering/RenderLayerCompositor.h: 2017-04-12 Brady Eidson QuotaExceededError when saving to localStorage in private mode. https://bugs.webkit.org/show_bug.cgi?id=157010 Reviewed by Alex Christensen. No new tests (Covered by changes to existing test). LocalStorage in private browsing is now effectively SessionStorage. It's ephemeral, per-tab, and copied over to tabs window.open()'ed from the current. * loader/EmptyClients.cpp: (WebCore::EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace): * page/Chrome.cpp: (WebCore::Chrome::createWindow): * page/Page.cpp: (WebCore::Page::ephemeralLocalStorage): (WebCore::Page::setEphemeralLocalStorage): * page/Page.h: * page/SecurityOriginData.h: * storage/Storage.cpp: (WebCore::Storage::length): (WebCore::Storage::key): (WebCore::Storage::getItem): (WebCore::Storage::setItem): (WebCore::Storage::removeItem): (WebCore::Storage::clear): (WebCore::Storage::contains): (WebCore::Storage::isDisabledByPrivateBrowsing): Deleted. * storage/StorageMap.h: * storage/StorageNamespaceProvider.cpp: (WebCore::StorageNamespaceProvider::localStorageArea): * storage/StorageNamespaceProvider.h: * storage/StorageType.h: (WebCore::isLocalStorage): (WebCore::isPersistentLocalStorage): 2017-03-31 Brady Eidson Clean up the "StorageType" enum. https://bugs.webkit.org/show_bug.cgi?id=170349 Reviewed by Tim Horton. - Make this `enum` into an `enum class` - Add a new type specific for "transient local storage" No new tests (No behavior change). * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent): * inspector/InspectorInstrumentation.h: * loader/EmptyClients.cpp: * storage/Storage.cpp: (WebCore::Storage::isDisabledByPrivateBrowsing): * storage/StorageArea.h: (): Deleted. * storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): * storage/StorageType.h: (WebCore::isLocalStorage): 2017-04-10 Miguel Gomez REGRESSION(r205841): [GTK] Test fast/images/animated-png.html is failing since r205841 https://bugs.webkit.org/show_bug.cgi?id=168425 Reviewed by Said Abou-Hallawa. There is a problem with animations that are blending their frames into the previous frame. Due to a change in how pixel components are premultiplied (the result is now rounded up), the parameters to the blending operation may vary in one unit, causing the result of the blending to be different from the expected result. In order to fix this, a new parameter is added to indicate whether we want to use rounding up when premultiplying or not, and ImageBackingStore uses that parameter to disable rounding up. Adjusted the expectation for fast/images/animated-png.html, as it must pass now. * platform/graphics/Color.cpp: (WebCore::premultipliedChannel): (WebCore::makePremultipliedRGBA): * platform/graphics/Color.h: * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::blendPixel): (WebCore::ImageBackingStore::pixelValue): 2017-04-07 Zalan Bujtas Simple line layout: FlowContents::segmentIndexForRunSlow skips empty runs. https://bugs.webkit.org/show_bug.cgi?id=170552 Reviewed by Antti Koivisto. The compare function passed to std::lower_bound completely misses empty runs. Test: fast/text/simple-line-layout-hover-over-subsequent-linebreaks.html * rendering/SimpleLineLayoutFlowContents.cpp: (WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow): 2017-04-07 Myles C. Maxfield REGRESSION(r211382): Complex text with justification erroneously overflows containers https://bugs.webkit.org/show_bug.cgi?id=170399 Reviewed by Simon Fraser. When we perform justification, we adjust glyphs' advances to add extra space between words. ComplexTextController maintains an invariant where m_totalWidth is equal to the sum of these advances. However, in RTL text, inserting extra justification space to the left of a glyph would break that invariant, and would increase the advances of two glyphs instead of just one. Then, when we go to draw the text, the sum of the advances is wider than m_totalWidth, which means the glyphs would be drawn outside of their container. This regressed in r211382 simply because of an oversight and because there were no tests for this codepath. Test: ComplexTextControllerTest.TotalWidthWithJustification * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * rendering/InlineBox.h: (WebCore::InlineBox::InlineBox): 2017-04-07 Alex Christensen REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame." if too much data is sent https://bugs.webkit.org/show_bug.cgi?id=170463 Reviewed by Michael Catanzaro. This only reproduces when using WebSockets to communicate with an external server. When communicating with a local server, CFWriteStreamWrite succeeds too reliably, so CFWriteStreamCanAcceptBytes returns true, when sometimes it doesn't when communicating across the real internet. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): Returning std::nullopt means there was an error, which is not true when the socket stream is in a state where it cannot be written to because it is actively communicating. Returning 0 means 0 new bytes were sent, so we will try again later. 2017-04-07 Brent Fulgham WebKit should percent encode single quotes in query strings https://bugs.webkit.org/show_bug.cgi?id=170561 Reviewed by Alex Christensen. Modify the characterClassTable to instruct the URLParser to convert the single-quote character ' to %27 in URL query strings. Tests: URLParserTest in TestWebKitAPI. fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html fast/frames/xss-auditor-handles-file-urls.html http/tests/security/xssAuditor * platform/URLParser.cpp: 2017-04-07 Tomas Popela AX: Don't crash if no renderer is available for AccessibilityRenderObject https://bugs.webkit.org/show_bug.cgi?id=170448 Reviewed by Chris Fleizach. Don't crash or assert if no renderer is available, but early return gracefully (as in other places in the AccessibilityRenderObject.cpp). Spotted by running some tests through dogtail. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::isOffScreen): (WebCore::AccessibilityRenderObject::isUnvisited): (WebCore::AccessibilityRenderObject::isVisited): 2017-04-06 Zalan Bujtas Simple line layout: Hittest always returns the first renderer in the block. https://bugs.webkit.org/show_bug.cgi?id=170520 Reviewed by Antti Koivisto. This is incorrect now with
      support (multiple renderers within the same block flow). Test: fast/dom/Document/CaretRangeFromPoint/simple-line-layout-hittest-with-caret-range-from-point.html * rendering/RenderText.cpp: (WebCore::RenderText::positionForPoint): Related fix. We don't yet support positionForPoint with multiple renderes. * rendering/SimpleLineLayoutFlowContents.h: (WebCore::SimpleLineLayout::FlowContents::segmentForRun): Empty runs are all valid. * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::hitTestFlow): (WebCore::SimpleLineLayout::collectFlowOverflow): * rendering/SimpleLineLayoutResolver.cpp: (WebCore::SimpleLineLayout::LineResolver::Iterator::operator*): This should eventually return a list of renderes. * rendering/SimpleLineLayoutResolver.h: (WebCore::SimpleLineLayout::RunResolver::flowContents): 2017-04-04 Brent Fulgham Do not assert when CharacterData representing an Attr fires events https://bugs.webkit.org/show_bug.cgi?id=170454 Reviewed by Ryosuke Niwa. Make the NoEventDispatchAssertion in CharacterData::notifyParentAfterChange conditional since Attr elements should be allowed to fire events. Tests: fast/dom/no-assert-for-malformed-js-url-attribute.html * dom/CharacterData.cpp: (WebCore::CharacterData::notifyParentAfterChange): 2017-04-03 Chris Dumez REGRESSION (r206744): CSS background-image in style attribute ignored when using createHTMLDocument method of DOM parsing https://bugs.webkit.org/show_bug.cgi?id=170285 Reviewed by Andy Estes. r206744 caused up to stop trying to resolve relative URLs when trying to load an image referred to by CSS. We already try to resolve the relative URL when parsing the CSS property so this will usually work fine. However, in the case when the CSS property is parsed in detached document and then moved to another document, we will not have the complete URL. Test: fast/images/background-image-relative-url-changes-document.html * css/CSSImageValue.cpp: (WebCore::CSSImageValue::loadImage): 2017-04-03 Antti Koivisto REGRESSION (r207669): FileMaker Pro Help pages do not render correctly https://bugs.webkit.org/show_bug.cgi?id=170402 Reviewed by Simon Fraser. If a new stylesheet load is started from the load event the document.styleSheets does not always reflect the already loaded stylesheets. Test: fast/css/document-stylesheets-dynamic.html * style/StyleScope.cpp: (WebCore::Style::Scope::updateActiveStyleSheets): Remove an old optimization where we would not update active stylesheets if there were pending (head) stylesheet loads and they had not been updated already. This is probably not a valuable optimization anymore with the new lazy stylesheet update strategy. * style/StyleScope.h: 2017-04-01 Zalan Bujtas Long Arabic text in ContentEditable with css white-space=pre hangs Safari https://bugs.webkit.org/show_bug.cgi?id=170245 Reviewed by Myles C. Maxfield. While searching for mid-word break, we measure the text by codepoints in a loop until the accumulated width > available width. When we see that the accumulated width for the individual codepoints overflows, we join the codepoints and re-measure them. These 2 widths could be considerably different for number of reasons (ligatures is a prime example). When we figure that the run still fits, we go back to the main loop (since we are not supposed to wrap the line here) and take the next codepoint. However this time we start the measurement from the last whitespace, so we end up remeasuring a potentially long chuck of text until we hit the wrapping point. This is way too expensive. This patch changes the logic so that we just go back to measuring individual codepoints until we hit the constrain again. Covered by existing tests. * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleText): canUseSimpleFontCodePath() is just to mitigate the potential risk of regression and complex text is more likely to fall into this category. 2017-03-30 Eric Carlson [Crash] WebCore::AudioBuffer::AudioBuffer don't checking illegal value https://bugs.webkit.org/show_bug.cgi?id=169956 Reviewed by Youenn Fablet. Test: webaudio/audiobuffer-crash.html * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::AudioBuffer): Invalidate the object and return early if the channel array allocation fails. (WebCore::AudioBuffer::AudioBuffer): Ditto. (WebCore::AudioBuffer::invalidate): Invalidate the object. * Modules/webaudio/AudioBuffer.h: 2017-03-29 Ryosuke Niwa Disconnecting a HTMLObjectElement does not always unload its content document https://bugs.webkit.org/show_bug.cgi?id=169606 Reviewed by Andy Estes. When removing a node, we first disconnect all subframes then update the focused element as we remove each child. However, when the removed element is a focused object element with a content document, removeFocusedNodeOfSubtree can update the style tree synchronously inside Document::setFocusedElement, and reload the document. Avoid this by instantiating a SubframeLoadingDisabler on the parent of the focused element. Test: fast/dom/removing-focused-object-element.html * dom/Document.cpp: (WebCore::Document::removeFocusedNodeOfSubtree): 2017-03-29 Zalan Bujtas RenderBlockFlow::addFloatsToNewParent should check if float is already added to the object list. https://bugs.webkit.org/show_bug.cgi?id=170259 Reviewed by Simon Fraser. r210145 assumed that m_floatingObjects would simply ignore the floating box if it was already in the list. Test: fast/block/float/placing-multiple-floats-crash.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addFloatsToNewParent): 2017-03-27 Brent Fulgham Only attach Attributes to a given element one time https://bugs.webkit.org/show_bug.cgi?id=170125 Reviewed by Chris Dumez. Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause arbitrary JavaScript events to fire. Test: fast/dom/Attr/only-attach-attr-once.html * dom/Element.cpp: (WebCore::Element::attachAttributeNodeIfNeeded): Added. (WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'. (WebCore::Element::setAttributeNodeNS): Ditto. * dom/Element.h: 2017-03-28 Antti Koivisto Missing render tree position invalidation when tearing down renderers for display:contents subtree https://bugs.webkit.org/show_bug.cgi?id=170199 Reviewed by Zalan Bujtas. Test: fast/shadow-dom/slot-renderer-teardown.html * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): Invalidate the render tree position in case we do a teardown for an element without renderer. 2017-03-24 Daniel Bates media/restore-from-page-cache.html causes NoEventDispatchAssertion::isEventAllowedInMainThread() assertion failure https://bugs.webkit.org/show_bug.cgi?id=170087 Reviewed by Simon Fraser. Reduce the scope of code that should never dispatch DOM events so as to allow updating contents size after restoring a page from the page cache. In r214014 we instantiate a NoEventDispatchAssertion in FrameLoader::commitProvisionalLoad() around the call to CachedPage::restore() to assert when a DOM event is dispatched during page restoration as such events can cause re-entrancy into the page cache. As it turns out it is sufficient to ensure that no DOM events are dispatched after restoring all cached frames as opposed to after CachedPage::restore() returns. Also rename Document::enqueue{Pageshow, Popstate}Event() to dispatch{Pageshow, Popstate}Event(), respectively, since they synchronously dispatch events :(. We hope in the future to make them asynchronously dispatch events. * dom/Document.cpp: (WebCore::Document::implicitClose): Update for renaming. (WebCore::Document::statePopped): Ditto. (WebCore::Document::dispatchPageshowEvent): Renamed; formerly named enqueuePageshowEvent(). (WebCore::Document::dispatchPopstateEvent): Renamed; formerly named enqueuePopstateEvent(). (WebCore::Document::enqueuePageshowEvent): Deleted. (WebCore::Document::enqueuePopstateEvent): Deleted. * dom/Document.h: * history/CachedPage.cpp: (WebCore::firePageShowAndPopStateEvents): Moved logic from FrameLoader::didRestoreFromCachedPage() to here. (WebCore::CachedPage::restore): Modified to call firePageShowAndPopStateEvents(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Removed use of NoEventDispatchAssertion RAII object. We will instantiate it in CachedPage::restore() with a smaller scope. (WebCore::FrameLoader::didRestoreFromCachedPage): Deleted; moved logic from here to WebCore::firePageShowAndPopStateEvents(). * loader/FrameLoader.h: 2017-03-24 Brady Eidson A null compound index value crashes the Databases process. and https://bugs.webkit.org/show_bug.cgi?id=170000 Reviewed by Alex Christensen. Test: storage/indexeddb/modern/single-entry-index-invalid-key-crash.html * bindings/js/IDBBindingUtilities.cpp: (WebCore::createKeyPathArray): Fix the bug by rejecting arrays with any invalid keys in them. Add some logging: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::loggingString): * Modules/indexeddb/IDBKeyPath.h: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): * Modules/indexeddb/shared/IDBIndexInfo.cpp: (WebCore::IDBIndexInfo::loggingString): 2017-03-24 Daniel Bates Prevent new navigations during document unload https://bugs.webkit.org/show_bug.cgi?id=169934 Reviewed by Chris Dumez. Similar to our policy of preventing new navigations from onbeforeunload handlers we should prevent new navigations that are initiated during the document unload process. The significant part of this change is the instantiation of the RAII object NavigationDisabler in Document::prepareForDestruction(). The rest of this change just renames class NavigationDisablerForBeforeUnload to NavigationDisabler now that this RAII class is used to prevent navigation from both onbeforeunload event handlers and when unloading a document. Test: fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Disable new navigations when disconnecting subframes. Also assert that the document is not in the page cache before we fall off the end of the function. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isNavigationAllowed): Update for renaming below. (WebCore::FrameLoader::shouldClose): Ditto. * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation): Ditto. * loader/NavigationScheduler.h: (WebCore::NavigationDisabler::NavigationDisabler): Renamed class; formerly named NavigationDisablerForBeforeUnload. (WebCore::NavigationDisabler::~NavigationDisabler): Ditto. (WebCore::NavigationDisabler::isNavigationAllowed): Ditto. (WebCore::NavigationDisablerForBeforeUnload::NavigationDisablerForBeforeUnload): Deleted. (WebCore::NavigationDisablerForBeforeUnload::~NavigationDisablerForBeforeUnload): Deleted. (WebCore::NavigationDisablerForBeforeUnload::isNavigationAllowed): Deleted. 2017-03-24 Per Arne Vollan Text stroke is sometimes clipped on video captions. https://bugs.webkit.org/show_bug.cgi?id=170006 Reviewed by Eric Carlson. Set 'overflow' property to 'visible' on cue element to avoid clipping of text stroke. Updated test media/track/track-css-stroke-cues.html. * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): 2017-03-23 Brady Eidson WebSQL databases should not openable in private browsing. and https://bugs.webkit.org/show_bug.cgi?id=170013 Reviewed by Alex Christensen. Test: storage/websql/private-browsing-open-disabled.html * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::openDatabaseBackend): (WebCore::DatabaseManager::tryToOpenDatabaseBackend): Throw an exception if in private browsing. * Modules/webdatabase/DatabaseManager.h: 2017-03-22 Dean Jackson NeverDestroyed must explicitly construct with a String https://bugs.webkit.org/show_bug.cgi?id=169987 Reviewed by Alex Christensen. CSSDefaultStyleSheets creates a static MediaQueryEvaluator, but thanks to the template magic of NeverDestroyed, it was converting the char* argument into a bool, and calling the wrong constructor. Unfortunately this is difficult to test because it only affects the default UA style sheets, and they currently don't have and @media rules (which would always evaluate to true given the bug). I don't want to put in a useless rule just to check if the bug is fixed. When one is added for bug 168447, this change will be exercised. * css/CSSDefaultStyleSheets.cpp: Explicitly construct with a String rather than a char*. (WebCore::screenEval): (WebCore::printEval): 2017-03-22 Antti Koivisto Dynamically applied :empty pseudo class with display:none does not get unapplied https://bugs.webkit.org/show_bug.cgi?id=169907 Reviewed by Ryosuke Niwa. We improperly reset the styleAffectedByEmpty bit when removing the renderer when :empty starts applying. We then fail to invalidate the style when the element becomes non-empty again. Fix by resetting the style relation bits only when computing the style. Test: fast/css/empty-display-none-invalidation.html * dom/Element.cpp: (WebCore::Element::resetStyleRelations): Expose this separately. (WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer): Don't reset style relation bits when removing renderers. * dom/Element.h: * dom/ElementRareData.h: (WebCore::ElementRareData::resetComputedStyle): (WebCore::ElementRareData::resetStyleRelations): Reset all these bits in one function. (WebCore::ElementRareData::resetDynamicRestyleObservations): Deleted. * style/StyleTreeResolver.cpp: (WebCore::Style::resetStyleForNonRenderedDescendants): (WebCore::Style::TreeResolver::resolveComposedTree): Call the explicit style relation reset function when recomputing style. 2017-03-22 Michael Catanzaro [GTK] Honor GTK+ font settings https://bugs.webkit.org/show_bug.cgi?id=82889 Reviewed by Carlos Garcia Campos. After much discussion with Behdad and Martin (who is still not completely convinced I think :) I want to merge cairo font options into the Fontconfig pattern used for rendering using cairo_ft_font_options_substitute(). This is how the API was designed to be used anyway. Fontconfig will still have final say over whether to actually respect the desktop settings or not, so it can still choose to ignore the desktop's settings, but I don't think it makes sense to have desktop-wide font settings and not tell Fontconfig about them, especially when the whole point of WebKitGTK+ is desktop integration. This should also reduce complaints that we're not following desktop settings and that we're drawing fonts differently than Firefox. * PlatformGTK.cmake: * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::getDefaultCairoFontOptions): * platform/graphics/cairo/CairoUtilities.h: * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::createFontConfigPatternForCharacters): (WebCore::strongAliasesForFamily): (WebCore::FontCache::createFontPlatformData): * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::getDefaultFontconfigOptions): (WebCore::getDefaultCairoFontOptions): Deleted. * platform/graphics/gtk/GdkCairoUtilities.cpp: (getDefaultCairoFontOptions): 2017-03-22 Chris Dumez WebKit should disallow beforeunload alerts from web pages users have never interacted with https://bugs.webkit.org/show_bug.cgi?id=169936 Reviewed by Brent Fulgham. WebKit should disallow beforeunload alerts from web pages users have never interacted with. This reduces the risk of annoyance to the user and is allowed by the specification: - https://html.spec.whatwg.org/multipage/browsers.html#prompt-to-unload-a-document (Step 8): which says: """ The user agent is encouraged to avoid asking the user for confirmation if it judges that doing so would be annoying, deceptive, or pointless. A simple heuristic might be that if the user has not interacted with the document, the user agent would not ask for confirmation before unloading it. """ Firefox already implements this, Chrome does not. Tests: fast/events/beforeunload-alert-no-user-interaction.html fast/events/beforeunload-alert-user-interaction.html fast/events/beforeunload-alert-user-interaction2.html * loader/FrameLoader.cpp: (WebCore::shouldAskForNavigationConfirmation): (WebCore::FrameLoader::dispatchBeforeUnloadEvent): 2017-03-22 Brent Fulgham ASan violation in IconLoader::stopLoading https://bugs.webkit.org/show_bug.cgi?id=169960 Reviewed by David Kilzer. DocumentLoader::finishLoadingIcon handles the life cycle of the IconLoader. Once this method is called, we should return immediately rather than attempt to make further modifications to the IconLoader. No new tests due to lack of test features (see https://bugs.webkit.org/show_bug.cgi?id=164895). Easily tested in MiniBrowser under ASan visiting websites with icons. * loader/icon/IconLoader.cpp: (WebCore::IconLoader::notifyFinished): 2017-03-21 Antti Koivisto Use AtomicString in RuleSet and RuleFeature https://bugs.webkit.org/show_bug.cgi?id=119310 Reviewed by Andreas Kling. ..instead of the plain AtomicStringImpl*. This introduces some ref churn but not too much. * css/DocumentRuleSets.cpp: (WebCore::DocumentRuleSets::ancestorClassRules): (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML): * css/DocumentRuleSets.h: * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::collectMatchingRules): (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules): * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): (WebCore::makeAttributeSelectorKey): (WebCore::RuleFeatureSet::collectFeatures): * css/RuleFeature.h: * css/RuleSet.cpp: (WebCore::RuleSet::addToRuleSet): (WebCore::rulesCountForName): (WebCore::RuleSet::addRule): * css/RuleSet.h: (WebCore::RuleSet::idRules): (WebCore::RuleSet::classRules): (WebCore::RuleSet::shadowPseudoElementRules): (WebCore::RuleSet::tagRules): * css/StyleResolver.h: (WebCore::StyleResolver::hasSelectorForAttribute): (WebCore::StyleResolver::hasSelectorForClass): (WebCore::StyleResolver::hasSelectorForId): * style/AttributeChangeInvalidation.cpp: (WebCore::Style::mayBeAffectedByAttributeChange): (WebCore::Style::AttributeChangeInvalidation::invalidateStyle): * style/IdChangeInvalidation.cpp: (WebCore::Style::mayBeAffectedByHostRules): (WebCore::Style::mayBeAffectedBySlottedRules): (WebCore::Style::IdChangeInvalidation::invalidateStyle): * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::resolve): (WebCore::Style::SharingResolver::canShareStyleWithElement): (WebCore::Style::SharingResolver::classNamesAffectedByRules): 2017-03-22 Youenn Fablet Safari sends empty "Access-Control-Request-Headers" in preflight request https://bugs.webkit.org/show_bug.cgi?id=169851 Reviewed by Chris Dumez. Covered by updated test. * loader/CrossOriginAccessControl.cpp: (WebCore::createAccessControlPreflightRequest): Not adding "Access-Control-Request-Headers" to request header if value is empty. 2017-03-21 Sergio Villar Senin [Soup] "Only from websites I visit" cookie policy is broken https://bugs.webkit.org/show_bug.cgi?id=168912 Reviewed by Carlos Garcia Campos. Do not reset the first party for cookies on redirects. That's properly done for the main resource in DocumentLoader::willSendRequest and, in the case of subresources, is absolutely wrong (which is what we were doing since r143931). The most notable effect was that subresources loaded via redirects were effectively bypassing the "no third party" policy for cookies. Test: http/tests/security/cookies/third-party-cookie-blocking-redirect.html * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::doRedirect): 2017-03-21 Brady Eidson Disable all virtual tables. and https://bugs.webkit.org/show_bug.cgi?id=169928 Reviewed by Jer Noble. No new tests (Covered by changes to existing test). * Modules/webdatabase/DatabaseAuthorizer.cpp: (WebCore::DatabaseAuthorizer::createVTable): (WebCore::DatabaseAuthorizer::dropVTable): 2017-03-21 Zalan Bujtas Tear down descendant renderers when 's display value is set to no "contents". https://bugs.webkit.org/show_bug.cgi?id=169921 Reviewed by Antti Koivisto. Since "display: contents" does not generate a renderer, when an element's display value is changed to something other than "contents", we not only create a renderer but also reparent its descendant subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we need to tear down the descendant subtree tree and build it up again to reflect the new rendering context. Test: fast/shadow-dom/slot-with-continuation-descendants.html * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): 2017-03-20 Daniel Bates Prevent new navigations from onbeforeunload handler https://bugs.webkit.org/show_bug.cgi?id=169891 Reviewed by Ryosuke Niwa. Ensure that all navigations initiated from an onbeforeunload handler are disallowed regardless of how they were scheduled. Such navigations go against the expectation of a user. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isNavigationAllowed): Added. (WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed(). (WebCore::FrameLoader::loadWithDocumentLoader): Ditto. (WebCore::FrameLoader::stopAllLoaders): Ditto. * loader/FrameLoader.h: 2017-03-20 Simon Fraser Move code out of renderer destructors into willBeDestroyed() https://bugs.webkit.org/show_bug.cgi?id=169650 Reviewed by Antti Koivisto. This is done for four reasons. First, code in willBeDestroyed() is able to call virtual functions on derived classes. Second, this code will run before we've destroyed the renderer's rareData, so can safely access it. Third, RenderWidget is special, and can have its lifetime extended via manual ref-counting, and we want all cleanup to complete before it goes into this weird zombie state. Fourth, in a shiny future where we have ref-counted RenderObjects, we want cleanup code to be run explicitly and not tied to object lifetime, and this is a step in that direction. For all classes that derive from RenderObject, move code from the destructor into willBeDestroyed(). New willBeDestroyed() implementations must call the base class. RenderBlock and RenderBlockFlow are special; RenderBlockFlow::willBeDestroyed() skips over RenderBlock::willBeDestroyed(), but they both need to run some code, which I moved into RenderBlock::blockWillBeDestroyed(). * rendering/RenderBlock.cpp: (WebCore::RenderBlock::~RenderBlock): (WebCore::RenderBlock::willBeDestroyed): (WebCore::RenderBlock::blockWillBeDestroyed): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::~RenderBlockFlow): (WebCore::RenderBlockFlow::willBeDestroyed): * rendering/RenderBox.cpp: (WebCore::RenderBox::~RenderBox): (WebCore::RenderBox::willBeDestroyed): * rendering/RenderBox.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::~RenderBoxModelObject): * rendering/RenderCounter.cpp: (WebCore::RenderCounter::~RenderCounter): (WebCore::RenderCounter::willBeDestroyed): * rendering/RenderCounter.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::~RenderElement): (WebCore::RenderElement::willBeDestroyed): * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::~RenderEmbeddedObject): (WebCore::RenderEmbeddedObject::willBeDestroyed): * rendering/RenderEmbeddedObject.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::~RenderImage): (WebCore::RenderImage::willBeDestroyed): * rendering/RenderImage.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::~RenderLayerModelObject): (WebCore::RenderLayerModelObject::willBeDestroyed): * rendering/RenderLayerModelObject.h: * rendering/RenderLineBreak.cpp: (WebCore::RenderLineBreak::~RenderLineBreak): (WebCore::RenderLineBreak::willBeDestroyed): * rendering/RenderLineBreak.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::~RenderListBox): (WebCore::RenderListBox::willBeDestroyed): * rendering/RenderListBox.h: * rendering/RenderListItem.cpp: (WebCore::RenderListItem::~RenderListItem): (WebCore::RenderListItem::willBeDestroyed): * rendering/RenderListItem.h: * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::~RenderListMarker): (WebCore::RenderListMarker::willBeDestroyed): * rendering/RenderListMarker.h: * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::~RenderMenuList): (WebCore::RenderMenuList::willBeDestroyed): * rendering/RenderMenuList.h: * rendering/RenderNamedFlowThread.cpp: (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread): (WebCore::RenderNamedFlowThread::willBeDestroyed): * rendering/RenderNamedFlowThread.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::willBeDestroyed): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::~RenderQuote): (WebCore::RenderQuote::willBeDestroyed): * rendering/RenderQuote.h: * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::~RenderSearchField): (WebCore::RenderSearchField::willBeDestroyed): * rendering/RenderSearchField.h: * rendering/RenderSnapshottedPlugIn.cpp: (WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn): (WebCore::RenderSnapshottedPlugIn::willBeDestroyed): * rendering/RenderSnapshottedPlugIn.h: * rendering/RenderText.cpp: (WebCore::RenderText::~RenderText): (WebCore::RenderText::willBeDestroyed): * rendering/RenderTextControlMultiLine.cpp: (WebCore::RenderTextControlMultiLine::~RenderTextControlMultiLine): (WebCore::RenderTextControlMultiLine::willBeDestroyed): * rendering/RenderTextControlMultiLine.h: * rendering/RenderVideo.cpp: (WebCore::RenderVideo::~RenderVideo): (WebCore::RenderVideo::willBeDestroyed): * rendering/RenderVideo.h: * rendering/RenderWidget.h: * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::~RenderSVGImage): (WebCore::RenderSVGImage::willBeDestroyed): * rendering/svg/RenderSVGImage.h: * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer): (WebCore::RenderSVGResourceContainer::willBeDestroyed): 2017-03-20 Emanuele Aina [Cairo] Ensure depth and stencil renderbuffers are created on GLESv2 https://bugs.webkit.org/show_bug.cgi?id=166643 Reviewed by Darin Adler. If the gfx device doesn't support GL_OES_packed_depth_stencil, the separate depth and stencil buffers are not generated. Copy what GraphicsContext3DEfl used to do and apply it in GraphicsContext3DCairo. The Intel gfx driver seem to tolerate unbound renderbuffers, but enabling debugging in Mesa yields an error: $ MESA_DEBUG=1 \ MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound) * platform/graphics/GraphicsContext3D.h: * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): Ensure separate depth and stencil renderbuffers are created. (WebCore::GraphicsContext3D::~GraphicsContext3D): Ensure separate depth and stencil renderbuffers are released. 2017-03-17 Dave Hyatt Disable per-region boxes for multicolumn https://bugs.webkit.org/show_bug.cgi?id=169830 Reviewed by Zalan Bujtas. Test: fast/multicol/float-adjacent-to-overflow-block.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild): * rendering/RenderBox.cpp: (WebCore::RenderBox::borderBoxRectInRegion): (WebCore::RenderBox::renderBoxRegionInfo): Limit all of the per-region box code to RenderNamedFlowThreads. This code should never be used by multicolumn layout. 2017-03-17 Said Abou-Hallawa Time channel attack on SVG Filters https://bugs.webkit.org/show_bug.cgi?id=118689 Reviewed by Simon Fraser. The time channel attack can happen if the attacker applies FEColorMatrix or FEConvolveMatrix and provides a matrix which is filled with subnormal floating point values. Performing floating-point operations on subnormals is very expensive unless the pixel in the source graphics is black (or zero). By measuring the time a filter takes to be applied, the attacker can know whether the pixel he wants to steal from an iframe is black or white. By repeating the same process on all the pixels in the iframe, the attacker can reconstruct the whole page of the iframe. To fix this issue, the values in the matrices of these filters will clamped to FLT_MIN. We do not want to consume too much time calculating filtered pixels because of such tiny values. The difference between applying FLT_MIN and applying a subnormal should not be even noticeable. Normalizing the floating-point matrices should happen only at the beginning of the filter platformApplySoftware(). * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::platformApplySoftware): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::fastSetInteriorPixels): (WebCore::FEConvolveMatrix::fastSetOuterPixels): (WebCore::FEConvolveMatrix::platformApplySoftware): * platform/graphics/filters/FEConvolveMatrix.h: * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::normalizedFloats): 2017-03-17 Zalan Bujtas Fix the flow thread state on the descendants of out of flow positioned replaced elements. https://bugs.webkit.org/show_bug.cgi?id=169821 Reviewed by Simon Fraser. Descendants of a replaced out of flow elmement should inherit the flowthread state from the replaced element and not from the replaced element's parent. Test: fast/multicol/fix-inherit-when-container-is-replaced.html * rendering/RenderObject.cpp: (WebCore::RenderObject::computedFlowThreadState): 2017-03-17 Carlos Garcia Campos [Cairo] Handle the blend mode in GraphicsContext::drawPattern https://bugs.webkit.org/show_bug.cgi?id=169746 Reviewed by Žan Doberšek. We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext(). This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode is optional and defaults to Normal. * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::toCairoCompositeOperator): (WebCore::toCairoOperator): * platform/graphics/cairo/CairoUtilities.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::setPlatformCompositeOperation): (WebCore::GraphicsContext::drawPattern): 2017-03-16 Simon Fraser RenderView::documentBeingDestroyed() needs a new name. https://bugs.webkit.org/show_bug.cgi?id=166727 Reviewed by Andreas Kling. Now that we destroy the render tree for documents going into the page cache, RenderView::documentBeingDestroyed() is misleadingly named. Rename it to renderTreeBeingDestroyed() and fix all callers. * page/FrameView.cpp: (WebCore::FrameView::scheduleRelayoutOfSubtree): * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame): * rendering/CounterNode.cpp: (WebCore::CounterNode::resetRenderers): * rendering/ImageQualityController.cpp: (WebCore::ImageQualityController::highQualityRepaintTimerFired): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::willBeDestroyed): (WebCore::canMergeContiguousAnonymousBlocks): (WebCore::RenderBlock::removeChild): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willBeDestroyed): (WebCore::RenderBlockFlow::removeChild): * rendering/RenderBox.cpp: (WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists): (WebCore::RenderBox::deleteLineBoxWrapper): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::willBeDestroyed): * rendering/RenderElement.cpp: (WebCore::RenderElement::insertChildInternal): (WebCore::RenderElement::removeChildInternal): (WebCore::RenderElement::clearLayoutRootIfNeeded): (WebCore::RenderElement::willBeDestroyed): * rendering/RenderImage.cpp: (WebCore::RenderImage::imageChanged): (WebCore::RenderImage::notifyFinished): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::removeChild): (WebCore::RenderLayer::calculateClipRects): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyFlushRequired): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerWillBeRemoved): (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged): * rendering/RenderLineBreak.cpp: (WebCore::RenderLineBreak::deleteInlineBoxWrapper): * rendering/RenderNamedFlowFragment.cpp: (WebCore::RenderNamedFlowFragment::attachRegion): * rendering/RenderObject.cpp: (WebCore::RenderObject::resetFlowThreadStateOnRemoval): (WebCore::RenderObject::willBeDestroyed): (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers): * rendering/RenderObject.h: (WebCore::RenderObject::renderTreeBeingDestroyed): (WebCore::RenderObject::documentBeingDestroyed): Deleted. * rendering/RenderQuote.cpp: (WebCore::RenderQuote::detachQuote): * rendering/RenderRegion.cpp: (WebCore::RenderRegion::attachRegion): * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::willBeDestroyed): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::removeChild): * rendering/RenderTable.h: (WebCore::RenderTable::setNeedsSectionRecalc): * rendering/RenderText.cpp: (WebCore::RenderText::removeAndDestroyTextBoxes): * rendering/RenderVideo.cpp: (WebCore::RenderVideo::updatePlayer): * rendering/svg/RenderSVGResource.cpp: (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::markClientForInvalidation): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::subtreeChildWasAdded): (WebCore::RenderSVGText::subtreeChildWillBeRemoved): (WebCore::RenderSVGText::subtreeChildWasRemoved): (WebCore::RenderSVGText::subtreeStyleDidChange): 2017-03-16 Zalan Bujtas Stay inside the continuation while searching for a candidate ancestor for insertion. https://bugs.webkit.org/show_bug.cgi?id=169768 Reviewed by David Hyatt. Test: fast/inline/continuation-crash-with-anon-ancestors.html * rendering/RenderInline.cpp: (WebCore::RenderInline::addChildToContinuation): 2017-03-16 Manuel Rego Casasnovas [css-grid] Crash on debug removing a positioned child https://bugs.webkit.org/show_bug.cgi?id=169739 Reviewed by Sergio Villar Senin. When we add or remove a positioned item we don't need to mark the grid as dirty, because positioned items do not affect the layout of the grid at all. This was causing a crash when a positioned item was removed after a layout. As after the positioned item was removed, the method RenderGrid::layoutBlock() was not called, so when the grid was repainted we got a crash. Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::addChild): Add early return to avoid marking the grid as dirty for positioned grid items. (WebCore::RenderGrid::removeChild): Ditto. 2017-03-15 Zalan Bujtas Do not reparent floating object until after intruding/overhanging dependency is cleared. https://bugs.webkit.org/show_bug.cgi?id=169711 Reviewed by Simon Fraser. This patch ensures that we cleanup the m_floatingObjects for siblings before reparenting the fresh float. Test: fast/block/float/inline-becomes-float-and-moves-around.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): * rendering/RenderElement.h: (WebCore::RenderElement::noLongerAffectsParentBlock): 2017-03-24 Daniel Bates media/restore-from-page-cache.html causes NoEventDispatchAssertion::isEventAllowedInMainThread() assertion failure https://bugs.webkit.org/show_bug.cgi?id=170087 Reviewed by Simon Fraser. Reduce the scope of code that should never dispatch DOM events so as to allow updating contents size after restoring a page from the page cache. In r214014 we instantiate a NoEventDispatchAssertion in FrameLoader::commitProvisionalLoad() around the call to CachedPage::restore() to assert when a DOM event is dispatched during page restoration as such events can cause re-entrancy into the page cache. As it turns out it is sufficient to ensure that no DOM events are dispatched after restoring all cached frames as opposed to after CachedPage::restore() returns. Also rename Document::enqueue{Pageshow, Popstate}Event() to dispatch{Pageshow, Popstate}Event(), respectively, since they synchronously dispatch events :(. We hope in the future to make them asynchronously dispatch events. * dom/Document.cpp: (WebCore::Document::implicitClose): Update for renaming. (WebCore::Document::statePopped): Ditto. (WebCore::Document::dispatchPageshowEvent): Renamed; formerly named enqueuePageshowEvent(). (WebCore::Document::dispatchPopstateEvent): Renamed; formerly named enqueuePopstateEvent(). (WebCore::Document::enqueuePageshowEvent): Deleted. (WebCore::Document::enqueuePopstateEvent): Deleted. * dom/Document.h: * history/CachedPage.cpp: (WebCore::firePageShowAndPopStateEvents): Moved logic from FrameLoader::didRestoreFromCachedPage() to here. (WebCore::CachedPage::restore): Modified to call firePageShowAndPopStateEvents(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Removed use of NoEventDispatchAssertion RAII object. We will instantiate it in CachedPage::restore() with a smaller scope. (WebCore::FrameLoader::didRestoreFromCachedPage): Deleted; moved logic from here to WebCore::firePageShowAndPopStateEvents(). * loader/FrameLoader.h: 2017-03-15 Daniel Bates Iteratively dispatch DOM events after restoring a cached page https://bugs.webkit.org/show_bug.cgi?id=169703 Reviewed by Brady Eidson. Make dispatching of DOM events when restoring a page from the page cache symmetric with dispatching of events when saving a page to the page cache. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to dispatch DOM events on the restored frames. (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore(). (WebCore::FrameLoader::didRestoreFromCachedPage): Added. (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage(). * loader/FrameLoader.h: * page/FrameTree.cpp: (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order traversal of the frame tree optionally wrapping around to the deepest first child in the tree. (WebCore::FrameTree::deepFirstChild): Added. * page/FrameTree.h: 2017-03-15 Dave Hyatt Positioned SVG not sized correctly https://bugs.webkit.org/show_bug.cgi?id=169693 Reviewed by Zalan Bujtas. Test: svg/in-html/rect-positioned.html Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This value is used instead of the available logical width to resolve replaced elements without intrinsic sizes but with aspect ratios set. * rendering/RenderBox.cpp: (WebCore::RenderBox::computeReplacedLogicalHeight): * rendering/RenderBox.h: * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeConstrainedLogicalWidth): (WebCore::RenderReplaced::computeReplacedLogicalWidth): (WebCore::RenderReplaced::computeReplacedLogicalHeight): * rendering/RenderReplaced.h: * rendering/RenderVideo.cpp: (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted. * rendering/RenderVideo.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): * rendering/svg/RenderSVGRoot.h: 2017-03-15 Zan Dobersek [GTK] Initialize m_button, m_clickCount members in PlatformMouseEvent constructors https://bugs.webkit.org/show_bug.cgi?id=169666 Reviewed by Michael Catanzaro. Initialize the m_button and m_clickCount class members in the GTK+-specific implementation of PlatformMouseEvent constructors to NoButton and 0, respectively. The constructors expect to operate on passed-in GTK+ events that will be able to initialize those two members to some valid values, but this is not guaranteed. * platform/gtk/PlatformMouseEventGtk.cpp: (WebCore::PlatformMouseEvent::PlatformMouseEvent): 2017-03-15 Zan Dobersek [TexMap] Add missing class member initializations https://bugs.webkit.org/show_bug.cgi?id=169665 Reviewed by Michael Catanzaro. Zero-initialize the members in various TextureMapper classes that are missing the proper initialization, as reported by the Coverity tool. * platform/graphics/texmap/BitmapTexturePool.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState): * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h: 2017-03-14 Wenson Hsieh RenderElements should unregister for viewport visibility callbacks when they are destroyed https://bugs.webkit.org/show_bug.cgi?id=169521 Reviewed by Simon Fraser. When registering a RenderElement for viewport visibility callbacks, we always need to make sure that it is unregistered before it is destroyed. While we account for this in the destructor of RenderElement, we only unregister in the destructor if we are already registered for visibility callbacks. In the call to RenderObject::willBeDestroyed(), we clear out rare data, which holds RenderElement's viewport callback registration state, so upon entering the destructor of RenderElement, we skip unregistration because RenderElement thinks that it is not registered. We can mitigate this by unregistering the RenderElement earlier, in RenderElement::willBeDestroyed, prior to clearing out the rare data. However, we'd ideally want to move the cleanup logic out of the destructor altogether and into willBeDestroyed (see https://bugs.webkit.org/show_bug.cgi?id=169650). Test: fast/media/video-element-in-details-collapse.html * rendering/RenderElement.cpp: (WebCore::RenderElement::willBeDestroyed): 2017-03-14 Alan Kinsley Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic. https://bugs.webkit.org/show_bug.cgi?id=169617 Reviewed by Antti Koivisto. This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout. Test: fast/text/simple-line-layout-hyphenation-constrains.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613 (WebCore::SimpleLineLayout::splitFragmentToFitLine): * rendering/line/BreakingContext.h: Integral -> fractional. (WebCore::tryHyphenating): 2017-03-14 Adrian Perez de Castro Remove redundant check for "firstLine" in RenderBlock::lineHeight() https://bugs.webkit.org/show_bug.cgi?id=169610 Reviewed by Michael Catanzaro. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::lineHeight): Remove test of "firstLine" that was already checked in the condition for the enclosing if-clause. 2017-03-13 Wenson Hsieh Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView https://bugs.webkit.org/show_bug.cgi?id=168480 Reviewed by Antti Koivisto. Implements two mitigations to prevent the symptoms of the bug from occurring (see the bugzilla for more details). Test: editing/execCommand/show-modal-dialog-during-execCommand.html * editing/EditorCommand.cpp: (WebCore::Editor::Command::execute): Do not allow edit commands to execute if the frame's document before and after layout differ (that is, edit commands triggered by a certain document should not run on a different document). * rendering/RenderView.cpp: (WebCore::RenderView::RenderView): (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator): Turns RepaintRegionAccumulator's reference to its root RenderView into a WeakPtr to gracefully handle the case where its RenderView is destroyed before RepaintRegionAccumulator's destructor gets a chance to flush the RenderView's repaint regions. * rendering/RenderView.h: 2017-03-13 Miguel Gomez ImageDecoder can be deleted while the async decoder thread is still using it https://bugs.webkit.org/show_bug.cgi?id=169199 Reviewed by Carlos Garcia Campos. Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder will stay alive as long as the decoding thread is processing frames. Also, stop the async decoding queue if a new decoder is set to ImageFrameCache. No new tests. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::setDecoder): (WebCore::ImageFrameCache::decoder): (WebCore::ImageFrameCache::startAsyncDecodingQueue): (WebCore::ImageFrameCache::metadata): * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::setDecoder): Deleted. Moved to source file so we can keep the ImageDecoder forward declaration. (WebCore::ImageFrameCache::decoder): Deleted. Moved to source file so we can keep the ImageDecoder forward declaration. * platform/graphics/ImageSource.h: * platform/graphics/cg/ImageDecoderCG.h: (WebCore::ImageDecoder::create): * platform/graphics/win/ImageDecoderDirect2D.h: (WebCore::ImageDecoder::create): * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::create): * platform/image-decoders/ImageDecoder.h: 2017-03-10 Antti Koivisto imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html is unreliable https://bugs.webkit.org/show_bug.cgi?id=169465 Reviewed by Zalan Bujtas. It shows all subtests passing but that is a bug. We don't even support all the unit types. The test occasionally fails when reloading, that failing results are actually the correct ones. * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::SizesAttributeParser): Ensure we have correct size for the iframe before parsing 'sizes' attribute values. The interpretation of these may depend on the iframe dimensions. 2017-03-09 Chris Dumez Align Document.elementFromPoint() with the CSSOM specification https://bugs.webkit.org/show_bug.cgi?id=169403 Reviewed by Sam Weinig. Align Document.elementFromPoint() with the CSSOM specification: - https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface In particular, the parameters should be mandatory and of type double. The parameters are mandatory in both Firefox and Chrome already. Parameters are finite floating point in Firefox and integers in Chrome. Test: fast/dom/elementFromPoint-parameters.html * dom/DocumentOrShadowRoot.idl: * dom/TreeScope.cpp: (WebCore::TreeScope::elementFromPoint): * dom/TreeScope.h: 2017-03-08 Chris Dumez Parameter to input.setCustomValidity() should not be nullable https://bugs.webkit.org/show_bug.cgi?id=169332 Reviewed by Sam Weinig. Parameter to input.setCustomValidity() should not be nullable: - https://html.spec.whatwg.org/#htmlinputelement Firefox and Chrome agree with the specification so the change should be safe. Test: fast/forms/setCustomValidity-null-parameter.html * html/HTMLButtonElement.idl: * html/HTMLFieldSetElement.idl: * html/HTMLInputElement.idl: * html/HTMLKeygenElement.idl: * html/HTMLObjectElement.idl: * html/HTMLOutputElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTextAreaElement.idl: 2017-03-08 Dave Hyatt CSS Multicolumn should not clip columns horizontally https://bugs.webkit.org/show_bug.cgi?id=169363 Reviewed by Sam Weinig. Revised multiple tests in fast/multicol. * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect): Stop clipping horizontally. Section 8.1 of the spec changed from "clip" to "don't clip", so we're changing to match the latest draft. Keep iBooks-based pagination clipping though. 2017-03-07 Said Abou-Hallawa Asynchronous image decoding should consider the drawing size if it is smaller than the size of the image https://bugs.webkit.org/show_bug.cgi?id=168814 Reviewed by Simon Fraser. If the image destinationRect.size() is smaller than the imageSourceSize (e.g. 3000x3000 pixels), CGImageSourceCreateThumbnailAtIndex() is slower than CGImageSourceCreateImageAtIndex() in decoding this image. To overcome this problem, the entry (kCGImageSourceThumbnailMaxPixelSize, max(destinationRect.width, destinationRect.height)) is added to the options dictionary when calling CGImageSourceCreateThumbnailAtIndex(). This will avoid copying a large block of memory for the unscaled bitmap image. An argument named 'sizeForDrawing' of type std::optional will be passed all the way from BitmapImage to ImageDecoder. If bool(sizeForDrawing) equals true that means we want async image decoding. Otherwise the image will be decoded synchronously. The subsamplingLevel argument will be passed as std::optional. to ImageFrame query functions. When combined with sizeForDrawing, the meaning of these two arguments will be the following: -- !bool(subsamplingLevel): No caching is required. return what is stored in ImageFrameCache. -- bool(subsamplingLevel) && !bool(sizeForDrawing): Match subsamplingLevel only. Recache if it's different. -- bool(subsamplingLevel) && bool(sizeForDrawing): Match both both. . Recache if one of them is different. We are going to allow decoding the same ImageFrame for different sizeForDrawings. The rule is a new decoding is allowed only if the maxPixelSize(sizeForDrawing) of the last requested image decoding is less than the new request sizeForDrawing. * loader/cache/CachedImage.h: Add a helper function which returns the URL of a CachedImage. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::frameImageAtIndex): Add a new argument for sizeForDrawing. (WebCore::BitmapImage::nativeImage): Pass an empty sizeForDrawing to frameImageAtIndex(). We an image with the native size. (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto. (WebCore::BitmapImage::nativeImageOfSize): Ditto. (WebCore::BitmapImage::draw): Pass the destRect.size() to internalStartAnimation(). (WebCore::BitmapImage::isAsyncDecodingRequired): A helper function to answer the question whether the async image decoding is required. It takes into account the animated images, the large image, and the image size. (WebCore::BitmapImage::internalStartAnimation): If async image decoding is requested for this frame m_sizeForDraw will be set. If internalStartAnimation() is called from startAnimation(), sizeForDraw will be empty. In this case no async image decoding will be requested. This happens only when startAnimation() is called from outside BitmapImage::draw(). (WebCore::BitmapImage::advanceAnimation): Change the log message. (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Ditto. * platform/graphics/BitmapImage.h: * platform/graphics/ImageFrame.cpp: (WebCore::ImageFrame::operator=): Include m_sizeForDraw in the properties of ImageFrame. (WebCore::maxPixelSize): Returns the maximum of the width() and the height of an IntSize. (WebCore::ImageFrame::isBeingDecoded): Returns true if the ImageFrame is currently being decoded for a specific sizeForDrawing. (WebCore::ImageFrame::hasValidNativeImage): Ditto. * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::enqueueSizeForDecoding): Adds a new sizeForDrawing; this sets the ImageFrame is being decoded for this sizeForDrawing. (WebCore::ImageFrame::dequeueSizeForDecoding): Removes the first sizeForDrawing was enqueued; this marks this ImageFrame has finished decoding for this sizeForDrawing. (WebCore::ImageFrame::clearSizeForDecoding): Clears the sizeForDecoding queue. Marks the ImageFrame for not being decoded. (WebCore::ImageFrame::isEmpty): Replace Decoding::Empty by Decoding::None. (WebCore::ImageFrame::sizeForDrawing): Returns the ImageFrame sizeForDraw. (WebCore::ImageFrame::hasDecodedNativeImage): Returns true if the ImageFrame doesn't need decoding before drawing. (WebCore::ImageFrame::hasValidNativeImage): Deleted. Moved to the source file. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Take a new argument for sizeForDraw. (WebCore::ImageFrameCache::setFrameMetadataAtIndex): When sizeForDraw is set, use the decoder to get the image frame size. Otherwise, get the size of the nativeImage. (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Take a new argument for sizeForDraw. (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Ditto. (WebCore::ImageFrameCache::startAsyncDecodingQueue): Pass the sizeForDraw as a new property of the ImageFrame. (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Store sizeForDraw in ImageFrameRequest. Delete unneeded check. This function always receives a valid subsamplingLevel. (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Marks all the queued ImageFrames for not being decoded. (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Take a new argument for sizeForDraw. If this function fixes the properties of ImageFrame properties, keep the old sizeForDraw and/or subsamplingLevel. If a new frame is decoded, no async image decoding will be done in this code path. So pass an empty std::optional to ImageDecoder::createFrameImageAtIndex() and store std::optional in ImageFrame. (WebCore::ImageFrameCache::frameMetadataAtIndex): A new helper function which takes a variable number of arguments which will be passed to the (ImageFrame::*functor). (WebCore::ImageFrameCache::frameMetadataAtIndexCacheIfNeeded): Make this function takes a variable number of arguments which will be passed to the frameAtIndexCacheIfNeeded(). (WebCore::ImageFrameCache::size): Pass an Metadata, valid SubsamplingLevel and empty sizeForDraw to frameMetadataAtIndexCacheIfNeeded(). (WebCore::ImageFrameCache::sizeRespectingOrientation): Ditto. (WebCore::ImageFrameCache::singlePixelSolidColor): Pass MetadataAndImage, empty SubsamplingLevel and empty sizeForDraw to frameMetadataAtIndexCacheIfNeeded(); we can use the current frame image regardless of its size. (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Pass the ImageFrame method as a function argument instead of passing it as a template argument. (WebCore::ImageFrameCache::frameIsCompleteAtIndex): Ditto. (WebCore::ImageFrameCache::frameHasAlphaAtIndex): Ditto. (WebCore::ImageFrameCache::frameHasImageAtIndex): Ditto. (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Pass subsamplingLevel and sizeForDrawing to frameMetadataAtIndex(). (WebCore::ImageFrameCache::frameHasDecodedNativeImage): New helper function to answer the question whether an ImageFrame will need decoding when drawing or not. (WebCore::ImageFrameCache::frameSubsamplingLevelAtIndex): Pass the ImageFrame method as a function argument instead of passing it as a template argument. (WebCore::ImageFrameCache::frameSizeAtIndex): Ditto. (WebCore::ImageFrameCache::frameBytesAtIndex): Ditto. (WebCore::ImageFrameCache::frameDurationAtIndex): Ditto. (WebCore::ImageFrameCache::frameOrientationAtIndex): (WebCore::ImageFrameCache::frameImageAtIndex): Ditto. (WebCore::ImageFrameCache::frameAtIndex): Deleted. Renamed to frameAtIndexCacheIfNeeded(). * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): * platform/graphics/ImageObserver.h: Define a virtual function for image sourceUrl(). * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::frameImageAtIndex): Take a new argument for sizeForDrawing. * platform/graphics/ImageSource.h: (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Take a new argument for sizeForDrawing. (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Ditto. (WebCore::ImageSource::frameHasDecodedNativeImage): New helper function. (WebCore::ImageSource::frameImageAtIndex): Ditto. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::createImageSourceOptions): Create a dictionary with the basic image decoding options. (WebCore::createImageSourceAsyncOptions): Create a dictionary with the basic asynchronous image decoding options. (WebCore::appendImageSourceOption): Append the SubsamplingLevel or the MaxPixelSize option to an CGImageSource options dictionary. (WebCore::appendImageSourceOptions): Append the SubsamplingLevel and the MaxPixelSize option to an CGImageSource options dictionary. (WebCore::imageSourceOptions): Creates a dictionary for the synchronous image decoding options. (WebCore::imageSourceAsyncOptions): Creates a dictionary for the asynchronous image decoding options. (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional. * platform/graphics/cg/ImageDecoderCG.h: Change a prototype. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional. * platform/graphics/win/ImageDecoderDirect2D.h: Change a prototype. * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional. * platform/image-decoders/ImageDecoder.h: Change a prototype. 2017-03-07 Alex Christensen [URLParser] Fix file URLs that are just file:// and a Windows drive letter https://bugs.webkit.org/show_bug.cgi?id=169242 Reviewed by Tim Horton. This is specified in https://url.spec.whatwg.org/#file-host-state and tested by a newly-passing web platform test. I added the check for the windows drive quirk in the FileHost state of the parser but I forgot it when FileHost is the terminal state. * platform/URLParser.cpp: (WebCore::URLParser::parse): 2017-03-07 Zalan Bujtas Simple line layout: Do not use invalid m_lastNonWhitespaceFragment while removing trailing whitespace. https://bugs.webkit.org/show_bug.cgi?id=169288 rdar://problem/30576976 Reviewed by Antti Koivisto. When the current line has nothing but whitespace, m_lastNonWhitespaceFragment is invalid so we should not use the start/end values to decide how many characters we need to revert. This patch makes m_lastNonWhitespaceFragment optional. When it's invalid we just remove all the runs from the current line since they are all considered whitespace runs. Test: fast/text/simple-line-layout-line-is-all-whitespace.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::revertAllRunsOnCurrentLine): (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): 2017-03-07 Fujii Hironori ShadowBlur::calculateLayerBoundingRect doesn't need to return the enclosingIntRect of layerRect https://bugs.webkit.org/show_bug.cgi?id=168650 Reviewed by Simon Fraser. No new tests, no behavior change. * platform/graphics/ShadowBlur.h: Change the type of return value from IntRect to IntSize. * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::calculateLayerBoundingRect): Ditto. (WebCore::ShadowBlur::drawRectShadow): Rename a variable layerRect layerSize. (WebCore::ShadowBlur::drawInsetShadow): Ditto. (WebCore::ShadowBlur::drawRectShadowWithoutTiling): Ditto. (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): Ditto. (WebCore::ShadowBlur::beginShadowLayer): Ditto. 2017-03-07 Dave Hyatt Animated GIFs fail to play in multi-column layout https://bugs.webkit.org/show_bug.cgi?id=167901 Reviewed by Zalan Bujtas. * rendering/RenderBox.cpp: (WebCore::RenderBox::computeRectForRepaint): Make sure to handle the case where we pass in a null repaintContainer and need to cross a multicolumn flow thread -> region boundary as a result. 2017-03-07 Chris Dumez Align initEvent / initCustomEvent / initMessageEvent with the latest specification https://bugs.webkit.org/show_bug.cgi?id=169176 Reviewed by Alex Christensen. Align initEvent / initCustomEvent / initMessageEvent with the latest specification after: - https://github.com/whatwg/dom/pull/417 - https://github.com/whatwg/html/pull/2410 In particular, the following changes were made: - initEvent: The length property now properly returns 1 instead of 3 as only the first parameter is mandatory. We were already behaving correcting the the length property value was wrong because we forgot to drop a hack from the bindings generator. - initCustomEvent: Make all parameters except the first optional. Previously, all parameters were mandatory so this is safe. - initMessageEvent: Drop the custom code and mark the first parameter as mandatory. A side effect of dropping the custom code is that null is no longer considered as valid input for the last parameter. The parameter is of type sequence<> and the new behavior is consistent with the specification and Firefox. If it turns out to break existing content, I'll make the parameter nullable in a follow-up. No new tests, updated existing tests. * bindings/js/JSMessageEventCustom.cpp: * bindings/scripts/CodeGeneratorJS.pm: (GeneratePropertiesHashTable): * dom/CustomEvent.idl: * dom/MessageEvent.idl: 2017-03-06 Brent Fulgham Validate DOM after potentially destructive actions during parser insert operations https://bugs.webkit.org/show_bug.cgi?id=169222 Reviewed by Ryosuke Niwa. Do not perform an insert operation if the next child's parent is no longer part of the tree. This can happen if JavaScript runs during node removal events and modifies the contents of the document. This patch was inspired by a similar Blink change by Marius Mlynski: Tests: fast/parser/scriptexec-during-parserInsertBefore.html * html/parser/HTMLConstructionSite.cpp: (WebCore::executeReparentTask): (WebCore::executeInsertAlreadyParsedChildTask): 2017-03-06 Fujii Hironori [CMake] SN-DBS fails to build: Cannot open include file: 'WebCoreTestSupportPrefix.h' https://bugs.webkit.org/show_bug.cgi?id=169244 Reviewed by Alex Christensen. A distributed build system SN-DBS can not find WebCoreTestSupportPrefix.h without an include path to it. * CMakeLists.txt: Add 'WebCore/testing/js' to include paths. 2017-03-06 Fujii Hironori [cairo] error C2065: 'quality': undeclared identifier since r213412 https://bugs.webkit.org/show_bug.cgi?id=169240 Reviewed by Ryosuke Niwa. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::toDataURL): Name the unnamed second argument 'quality'. 2017-03-06 Alex Christensen Fix URLs relative to file URLs with paths beginning with Windows drive letters https://bugs.webkit.org/show_bug.cgi?id=169178 Reviewed by Tim Horton. Windows drives in file URLs can begin with windows drive letters, such as file:///C:/ which should not be removed when making other URLs relative to them. See https://url.spec.whatwg.org/#file-slash-state Covered by new API tests and newly passing web-platform-tests. * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::copyASCIIStringUntil): (WebCore::URLParser::parse): * platform/URLParser.h: 2017-03-06 Manuel Rego Casasnovas [css-grid] Stretch should grow and shrink items to fit its grid area https://bugs.webkit.org/show_bug.cgi?id=163200 Reviewed by Darin Adler. After some discussions the CSS WG agreed that stretch should not only grow items, but also shrink them to fit its grid area. That way the "min-width|height: auto" is somehow ignored for grid items. More info at: https://github.com/w3c/csswg-drafts/issues/283 The good part is that this allows us to remove some ugly code we've in RenderBox that was only used by Grid Layout. For images, we'll be stretching on both axis right now, so the aspect ratio won't be preserved. The default behavior might change in those cases, but that should be implemented in a different patch. * rendering/RenderBox.cpp: (WebCore::RenderBox::computeLogicalWidthInRegion): (WebCore::RenderBox::computeLogicalHeight): 2017-03-06 Miguel Gomez [GTK] WebProcess from WebKitGtk+ 2.15.x SIGSEVs in GIFLZWContext::doLZW(unsigned char const*, unsigned long) at Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp:303 https://bugs.webkit.org/show_bug.cgi?id=167304 Reviewed by Carlos Garcia Campos. Add a lock to ensure that the GIFImageReader that we are using for decoding is not deleted while the decoding thread is using it. No new tests. * platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::clearFrameBufferCache): 2017-03-06 Vanessa Chipirrás Navalón [GStreamer] Adopt nullptr https://bugs.webkit.org/show_bug.cgi?id=123438 Reviewed by Xabier Rodriguez-Calvar. To adapt the code to the C++11 standard, all NULL or 0 pointers have been changed to nullptr. * platform/audio/gstreamer/AudioDestinationGStreamer.cpp: (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer): * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp: (WebCore::AudioFileReader::handleNewDeinterleavePad): (WebCore::AudioFileReader::plugDeinterleave): (WebCore::AudioFileReader::decodeAudioForBusCreation): * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer): (WebCore::AudioSourceProviderGStreamer::configureAudioBin): (WebCore::AudioSourceProviderGStreamer::setClient): (WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad): * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webkit_web_audio_src_init): (webKitWebAudioSrcLoop): (webKitWebAudioSrcChangeState): * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: (WebCore::AudioTrackPrivateGStreamer::setEnabled): * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::initializeGStreamer): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties): (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine): (WebCore::initializeGStreamerAndRegisterWebKitElements): (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::newTextSample): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::processTableOfContents): Removed the unused second argument on processTableOfContentsEntry function. (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Removed the unused second argument on this function. (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Removed the unused second argument on processTableOfContentsEntry function. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): (WebCore::MediaPlayerPrivateGStreamerBase::muted): (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfMute): (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): (WebCore::MediaPlayerPrivateGStreamerBase::decodedFrameCount): (WebCore::MediaPlayerPrivateGStreamerBase::droppedFrameCount): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::registerMediaEngine): * platform/graphics/gstreamer/TextCombinerGStreamer.cpp: (webkit_text_combiner_init): (webkitTextCombinerPadEvent): (webkitTextCombinerRequestNewPad): (webkitTextCombinerNew): * platform/graphics/gstreamer/TextSinkGStreamer.cpp: (webkitTextSinkNew): * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::tagsChanged): (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: (webkit_video_sink_init): (webkitVideoSinkProposeAllocation): (webkitVideoSinkNew): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::setSelected): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): (webKitWebSrcDispose): (webKitWebSrcSetProperty): (webKitWebSrcStop): (webKitWebSrcChangeState): (webKitWebSrcQueryWithParent): (webKitWebSrcGetProtocols): (StreamingClient::handleResponseReceived): (StreamingClient::handleDataReceived): (ResourceHandleStreamingClient::didFail): (ResourceHandleStreamingClient::wasBlocked): (ResourceHandleStreamingClient::cannotShowURL): * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcGetProtocols): 2017-03-05 Simon Fraser Avoid backing store for layers with empty text nodes in a few more cases https://bugs.webkit.org/show_bug.cgi?id=169185 Reviewed by Dan Bernstein. In hasPaintingNonLayerDescendants() we can check whether the RenderText's linesBoundingBox() is empty to avoid backing store in a few more cases. Also use containsOnlyWhitespace() rather than isAllCollapsibleWhitespace(), because there's no need for backing store for non-selectable whitespace text. Covered by existing tests. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2017-03-05 Chris Dumez Using
      in