Layer bounds are incorrect for sharing layers that paint with transforms
[WebKit-https.git] / Source / WebCore / ChangeLog
index 5bc103e..c7c8dca 100644 (file)
@@ -1,3 +1,482 @@
+2019-05-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Layer bounds are incorrect for sharing layers that paint with transforms
+        https://bugs.webkit.org/show_bug.cgi?id=197768
+        <rdar://problem/50695493>
+
+        Reviewed by Zalan Bujtas.
+
+        We don't need to traverse shared layers if the backing-provider has overflow clip,
+        because we know they are containing-block descendants and therefore clipped.
+
+        Note tha the CSS "clip" property doesn't guarantee this, because the clip rect
+        can be larger than the element, so in that case we just traverse shared layers.
+
+        Tests: compositing/shared-backing/sharing-bounds-clip.html
+               compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html
+               compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html
+               compositing/shared-backing/sharing-bounds.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateCompositedBounds):
+
+2019-05-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Translucent gradient rendering bug due to will-change transform
+        https://bugs.webkit.org/show_bug.cgi?id=197654
+        <rdar://problem/50547664>
+
+        Reviewed by Dean Jackson.
+        
+        We failed to re-evaluate 'contentsOpaque' when a background changed, because this
+        happened in updateGeometry() and that doesn't run for background changes.
+        
+        However, 'contentsOpaque' also requires knowing about geometry because we have to
+        turn it off when there's subpixel positioning, and updateConfiguration()
+        runs before updateGeometry().
+        
+        So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
+        updateAfterDescendants().
+
+        Test: compositing/contents-opaque/background-change-to-transparent.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::RenderLayerBacking::updateGeometry):
+        (WebCore::RenderLayerBacking::updateAfterDescendants):
+        * rendering/RenderLayerBacking.h:
+
+2019-05-11  Simon Fraser  <simon.fraser@apple.com>
+
+        When the scroller hosting a shared layer becomes non-scrollable, content disappears
+        https://bugs.webkit.org/show_bug.cgi?id=197766
+        <rdar://problem/50695808>
+
+        Reviewed by Zalan Bujtas.
+
+        RenderLayerCompositor::requiresOwnBackingStore() should return true for a layer that shares
+        its backing store. We always made backing for overlap layers, so even  if the sharing layers
+        have no painted content, this should rarely be a backing store memory regression.
+
+        Test: compositing/shared-backing/overflow-scroll/sharing-layer-becomes-non-scrollable.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
+
+2019-05-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Backing-sharing layers with transforms render incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=197692
+        <rdar://problem/50652127>
+
+        Reviewed by Antti Koivisto.
+
+        Layers that paint into shared backing need to enter the RenderLayer painting code
+        in a way that paints the filters, transforms, opacity and blending.
+        
+        RenderLayerBacking::paintIntoLayer() normally enters at paintLayerContents(), because
+        the effects are rendered via the GraphicsLayer, but shared layers will paint effects.
+        Note that if the backing-provider has effects, it will be the stacking context
+        for the shared layers, so it's correct that sharing layers are impacted by effects
+        on the backing-provider.
+
+        In addition, we have to ensure that we don't over-eagerly make layers shared.
+        Consider:
+        
+        <div class="clipping">
+            <div class="sharing">
+                <div class="inner">
+                </div>
+            </div>
+        </div>
+        
+        Here "clipping" is the provider layer, "sharing" paints into shared backing, but
+        we don't want to also mark "inner" as sharing, since "sharing" will just paint it.
+        This is akin to avoiding unnecessary compositing of z-order descendants when they can just
+        paint.
+        
+        To do this we need to ensure that sharing layers are treated like compositing layers
+        in the overlap map, i.e. when a layer is sharing, we call overlapMap.pushCompositingContainer(),
+        and later overlapMap.popCompositingContainer().
+
+        Tests: compositing/shared-backing/nested-shared-layers-with-opacity.html
+               compositing/shared-backing/shared-layer-has-blending.html
+               compositing/shared-backing/shared-layer-has-filter.html
+               compositing/shared-backing/shared-layer-has-opacity.html
+               compositing/shared-backing/shared-layer-has-reflection.html
+               compositing/shared-backing/shared-layer-has-transform.html
+               compositing/shared-backing/shared-layer-isolates-blending.html
+               compositing/shared-backing/shared-transformed-layer-bounds.html
+               compositing/shared-backing/sharing-layer-becomes-non-scrollable.html
+               compositing/shared-backing/sharing-layer-has-effect.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayer):
+        (WebCore::RenderLayer::paintLayerWithEffects):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const):
+        (WebCore::backingProviderLayerCanIncludeLayer):
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+
+2019-05-10  Youenn Fablet  <youenn@apple.com>
+
+        A service worker instance should be terminated when its SWServer is destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=197801
+        <rdar://problem/50587270>
+
+        Reviewed by Chris Dumez.
+
+        On session destruction, the SWServer is destroyed.
+        At that time, it should terminate all its running service workers.
+        Covered by updated API test.
+
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::~SWServer):
+
+2019-05-10  Eric Carlson  <eric.carlson@apple.com>
+
+        [iOS] HTMLMediaElement sometimes doesn't send 'webkitplaybacktargetavailabilitychanged' event
+        https://bugs.webkit.org/show_bug.cgi?id=197793
+        <rdar://problem/46429187>
+
+        Reviewed by Jer Noble.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::MediaElementSession): Initialize m_hasPlaybackTargets.
+
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange): Log
+        target availability.
+        (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Call the client 
+        externalOutputDeviceAvailableDidChange method after the AVRouteDetector is available.
+
+2019-05-09  Geoffrey Garen  <ggaren@apple.com>
+
+        Downgrade RELEASE_ASSERT TO RELEASE_LOG_FAULT for SQLite Class A files
+        https://bugs.webkit.org/show_bug.cgi?id=197760
+
+        Reviewed by Jer Noble.
+
+        We have all the data we need, and this crash is happening more than
+        expected.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open):
+
+2019-05-10  Zalan Bujtas  <zalan@apple.com>
+
+        [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
+        https://bugs.webkit.org/show_bug.cgi?id=197781
+        <rdar://problem/48027412>
+
+        Reviewed by Simon Fraser.
+
+        Synthetic bold is essentially two regular glyphs painted with an offset. While on macOS this offset is always 1px (CSS), on iOS larger font produces higher offset value. At paint time, this offset value (in CSS px unit) get converted
+        to a device pixel value taking context scale into account. This conversion ensures that the gap between the 2 regular glyphs won't get wider (in device pixels) as the user pinch zooms in.
+        This works as long as the scale on the context is >= 1. This patch ensures that a scaled down context won't blow up this gap.
+
+        Test: fast/text/large-synthetic-bold-with-scale-transform.html
+
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::drawGlyphs):
+
+2019-05-10  Brent Fulgham  <bfulgham@apple.com>
+
+        Gracefully handle inaccessible font face data
+        https://bugs.webkit.org/show_bug.cgi?id=197762
+        <rdar://problem/50433861>
+
+        Reviewed by Per Arne Vollan.
+
+        Make sure CSS Font Face handling gracefully recovers from
+        missing font data.
+
+        Test: fast/text/missing-font-crash.html
+
+        * css/CSSFontFace.cpp:
+        (WebCore::CSSFontFace::fontLoadEventOccurred):
+        (WebCore::CSSFontFace::timeoutFired):
+        (WebCore::CSSFontFace::fontLoaded):
+        (WebCore::CSSFontFace::font):
+
+2019-05-10  Simon Fraser  <simon.fraser@apple.com>
+
+        ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()) on nytimes.com after r245170
+        https://bugs.webkit.org/show_bug.cgi?id=197776
+
+        Reviewed by Zalan Bujtas.
+
+        Only try to paint into shared backing for layers that are able to be composited. This
+        avoids trying to do sharing for non-self-painting layers, which doesn't make sense.
+
+        Test: compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
+2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        Fix a bunch of compiler warnings
+        https://bugs.webkit.org/show_bug.cgi?id=197785
+
+        Reviewed by Don Olmstead.
+
+        * CMakeLists.txt: WebCoreTestSupport should accept extra SYSTEM includes.
+        * PlatformGTK.cmake: GTK includes should be added to SYSTEM headers to avoid warnings.
+        * inspector/InspectorCanvas.cpp: Add preprocessor guards to fix unused function warning.
+        * rendering/RenderLayer.cpp: Fix unused variable warning.
+        (WebCore::RenderLayer::updateClipRects):
+
+2019-05-10  Antti Koivisto  <antti@apple.com>
+
+        Event region generation needs to know about backing-sharing
+        https://bugs.webkit.org/show_bug.cgi?id=197694
+        <rdar://problem/50584991>
+
+        Reviewed by Simon Fraser.
+
+        Test: pointerevents/ios/touch-action-region-backing-sharing.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateEventRegion):
+
+        Gather event region from backing sharing layers too.
+
+2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
+        https://bugs.webkit.org/show_bug.cgi?id=197271
+
+        Reviewed by Youenn Fablet.
+
+        * dom/Document.cpp:
+        (WebCore::Document::didAssociateFormControlsTimerFired):
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+
+2019-05-09  Simon Fraser  <simon.fraser@apple.com>
+
+        Implement backing-sharing in compositing layers, allowing overlap layers to paint into the backing store of another layer
+        https://bugs.webkit.org/show_bug.cgi?id=197561
+        <rdar://problem/50445998>
+
+        Reviewed by Antti Koivisto.
+
+        This change introduces the concept of layers that share backing store for compositing. A layer
+        which is sharing its backing store first paints itself, and then some set of layers which come
+        later in paint order in the same stacking context. This reduces the composited layer count in
+        some overflow scrolling scenarios, thereby also simplifying the scrolling tree.
+        
+        A backing-shared layer stores a vector of "sharing" RenderLayer* in its RenderLayerBacking. At
+        paint time, the owning layer is painted, then the sharing layers, setting the owning layer as the
+        painting root so that positioning and clipping just work.
+        
+        Sharing layer relationships are constructed in RenderLayerCompositor::computeCompositingRequirements().
+        We track the last layer which was composited in paint order as a shared candidate. If a later layer
+        would composite for overlap (and no other reasons), then we allow it to share with the candidate
+        if the candidate is in its ancestor containing block chain. Sharing is currently limited to layers
+        in the same stacking context.
+        
+        isComposited() returns false for sharing layers, but they are like composited layers in that
+        they behave as painting boundaries, so RenderLayer::paintLayer() needs to stop at them,
+        and repaints in shared layers have to be directed to their shared layer, hence
+        changes to RenderLayer::clippingRootForPainting() and RenderLayer::enclosingCompositingLayerForRepaint().
+        
+        The clipping boundary logic in RenderLayer::backgroundClipRect() needed to be generalized so that
+        all calls to RenderLayer::parentClipRects() check for crossing painting boundaries and use
+        TemporaryClipRects in that case.
+
+        Tests: compositing/shared-backing/overflow-scroll/absolute-in-stacking-relative-in-scroller.html
+               compositing/shared-backing/overflow-scroll/composited-absolute-in-absolute-in-relative-in-scroller.html
+               compositing/shared-backing/overflow-scroll/nested-absolute-with-clipping-in-stacking-overflow.html
+               compositing/shared-backing/overflow-scroll/previous-sibling-prevents-inclusiveness.html
+               compositing/shared-backing/overflow-scroll/relative-in-clipping-in-scroller-in-clipping.html
+               compositing/shared-backing/overflow-scroll/relative-in-clipping-in-scroller-in-relative-clipping.html
+               compositing/shared-backing/overflow-scroll/relative-in-div-in-overflow-scroll.html
+               compositing/shared-backing/overflow-scroll/scrolled-contents-has-painted-content.html
+               compositing/shared-backing/overflow-scroll/scrolled-contents-unconstrained-clip.html
+               compositing/shared-backing/overflow-scroll/shared-layer-clipping.html
+               compositing/shared-backing/overflow-scroll/shared-layer-composited-bounds.html
+               compositing/shared-backing/overflow-scroll/shared-layer-nested-relative-stacking.html
+               compositing/shared-backing/overflow-scroll/shared-layer-repaint.html
+               compositing/shared-backing/partial-compositing-update.html
+               compositing/shared-backing/partial-compositing-update2.html
+               compositing/shared-backing/remove-sharing-layer.html
+               compositing/shared-backing/sharing-cached-clip-rects.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::~RenderLayer):
+        (WebCore::RenderLayer::ancestorLayerIsInContainingBlockChain const):
+        (WebCore::RenderLayer::setBackingProviderLayer):
+        (WebCore::RenderLayer::disconnectFromBackingProviderLayer):
+        (WebCore::RenderLayer::enclosingCompositingLayerForRepaint const):
+        (WebCore::RenderLayer::clippingRootForPainting const):
+        (WebCore::RenderLayer::clipToRect):
+        (WebCore::RenderLayer::paintLayer):
+        (WebCore::RenderLayer::updateClipRects):
+        (WebCore::RenderLayer::clipCrossesPaintingBoundary const):
+        (WebCore::RenderLayer::calculateClipRects const):
+        (WebCore::outputPaintOrderTreeLegend):
+        (WebCore::outputPaintOrderTreeRecursive):
+        (WebCore::inContainingBlockChain): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::willBeDestroyed):
+        (WebCore::clearBackingSharingLayerProviders):
+        (WebCore::RenderLayerBacking::setBackingSharingLayers):
+        (WebCore::RenderLayerBacking::removeBackingSharingLayer):
+        (WebCore::RenderLayerBacking::clearBackingSharingLayers):
+        (WebCore::RenderLayerBacking::updateCompositedBounds):
+        (WebCore::RenderLayerBacking::updateDrawsContent):
+        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+        (WebCore::RenderLayerBacking::paintContents):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const):
+        (WebCore::RenderLayerCompositor::CompositingState::propagateStateFromChildren):
+        (WebCore::RenderLayerCompositor::CompositingState::propagateStateFromChildrenForUnchangedSubtree):
+        (WebCore::RenderLayerCompositor::BackingSharingState::resetBackingProviderCandidate):
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        (WebCore::backingProviderLayerCanIncludeLayer):
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+        (WebCore::RenderLayerCompositor::updateBacking):
+        (WebCore::RenderLayerCompositor::layerWillBeRemoved):
+        (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderTreeAsText.cpp:
+
+2019-05-09  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Right command key has wrong value for property code
+        https://bugs.webkit.org/show_bug.cgi?id=193876
+        <rdar://problem/47577308>
+
+        Reviewed by Brent Fulgham.
+
+        We're looking for the wrong Windows virtual key code for the right command key.
+        Substitute VK_APPS for VK_RWIN so we can identify the right command key and return
+        the correct value for the code property of the DOM key event.
+
+        * platform/ios/PlatformEventFactoryIOS.mm:
+        (WebCore::codeForKeyEvent):
+
+2019-05-09  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Numpad comma key has incorrect keyIdentifier property
+        https://bugs.webkit.org/show_bug.cgi?id=197753
+        <rdar://problem/50636274>
+
+        Reviewed by Brent Fulgham.
+
+        Map the Numpad Comma HID usage code to its Window virtual key code, VK_SEPARATOR,
+        so that can compute the keyIdentifier property for the Numpad Comma key. Also
+        consider this key as a keypad key just like we do on Mac. There is no discernable
+        difference for doing so on iOS because the non-keypad code path computes the same result
+        due to GraphicsServices having fixed up the input string for the Numpad Comma to be
+        ",", which is want.
+
+        * platform/ios/KeyEventIOS.mm:
+        (WebCore::windowsKeyCodeForKeyCode): Map kHIDUsage_KeypadComma to VK_SEPARATOR.
+        * platform/ios/PlatformEventFactoryIOS.mm:
+        (WebCore::codeForKeyEvent): Add a comment to explain that this key is only on
+        JIS keyboards.
+        (WebCore::isKeypadEvent): Return true for the Numpad Comma key.
+
+2019-05-09  Zalan Bujtas  <zalan@apple.com>
+
+        Do not mix inline and block level boxes.
+        https://bugs.webkit.org/show_bug.cgi?id=197462
+        <rdar://problem/50369362>
+
+        Reviewed by Antti Koivisto.
+
+        This patch tightens the remove-anonymous-wrappers logic by checking if the removal would
+        produce an inline-block sibling mix.
+        When a block level box is removed from the tree, we check if after the removal the anonymous sibling block
+        boxes are still needed or whether we can removed them as well (and have only inline level child boxes).
+        In addition to checking if the container is anonymous and is part of a continuation, we also need to check
+        if collapsing it (and by that moving its children one level up) would cause a inline-block box mix.
+
+        Test: fast/ruby/continuation-and-column-spanner-crash.html
+
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
+        * rendering/updating/RenderTreeBuilderContinuation.cpp:
+        (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
+
+2019-05-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Refine AudioSession route sharing policy
+        https://bugs.webkit.org/show_bug.cgi?id=197742
+        <rdar://problem/50590818>
+
+        Reviewed by Darin Adler.
+
+        No new tests, updated AVAudioSessionRouteSharingPolicy API test.
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (MediaSessionManagerCocoa::updateSessionState):
+
+2019-05-09  Simon Fraser  <simon.fraser@apple.com>
+
+        fast/hidpi/video-controls-in-hidpi.html sometimes asserts in WK1
+        https://bugs.webkit.org/show_bug.cgi?id=197695
+
+        Reviewed by Zalan Bujtas.
+
+        With the backing-sharing changes that landed in r245058, some WebKit1 tests with media controls asserted in
+        RenderLayerBacking::computeParentGraphicsLayerRect() because a layer would have a m_ancestorClippingLayer,
+        but backgroundClipRect() would return an infinite rect.
+        
+        This happened when a layer tree change caused the layer's compositing ancestor to no longer isolate
+        composited blending (which affects the behavior of RenderLayerCompositor:clippedByAncestor()), but we failed
+        to mark its composited children as needing the configuration update which would eliminate their m_ancestorClippingLayers.
+        
+        The fix is to call setChildrenNeedCompositingGeometryUpdate() when isolatesCompositedBlending changes. We don't haev
+        setChildrenNeedCompositingConfigurationUpdate(), but setChildrenNeedCompositingGeometryUpdate() has the desired side-effect.
+
+        I was unable to make a standalone test case for this, but the code is exercised by media control tests.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
+2019-05-09  Brent Fulgham  <bfulgham@apple.com>
+
+        Correct delayed load event handling
+        https://bugs.webkit.org/show_bug.cgi?id=197679
+        <rdar://problem/50423334>
+
+        Reviewed by Alex Christensen.
+
+        We need to properly account for the fact that JavaScript might run
+        while performing loads.
+
+        * dom/Document.cpp:
+        (WebCore::Document::loadEventDelayTimerFired):
+
+2019-05-09  Antti Koivisto  <antti@apple.com>
+
+        Elements with "display: inline-block" don't have a touch-action region
+        https://bugs.webkit.org/show_bug.cgi?id=197281
+        <rdar://problem/50535081>
+
+        Reviewed by Antoine Quint.
+
+        Test: pointerevents/ios/touch-action-region-inline-block.html
+
+        PaintPhase::EventRegion failed to traverse into inline boxes.
+
+        * rendering/InlineElementBox.cpp:
+        (WebCore::InlineElementBox::paint):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::paintAsInlineBlock):
+
 2019-05-08  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         REGRESSION(r239915): [FreeType] White space skipped when rendering plain text with noto CJK font