Changeset 171891 in webkit


Ignore:
Timestamp:
Jul 31, 2014 3:32:40 PM (10 years ago)
Author:
Beth Dakin
Message:

Hit-testing broken in WebKit 1 views with AppKit's contentInsets
https://bugs.webkit.org/show_bug.cgi?id=135434
-and corresponding-
<rdar://problem/17850323>

Reviewed by Benjamin Poulain.

Source/WebCore:
AppKit's contentInsets are factored into scroll positions and mouse positions, but
in WebCore, we generally want all of those things to be factored out so that, for
example, the scroll position of a document pinned to the top is the same whether
or not there is a contentInset. So to fix hit-testing in WebKit 1 views with
contentInsets, this patch factors the inset out or into of all coordinate
conversion methods just like we do for the WebKit2 contentInset.

This patch also adds the ability to test WK1 platformContentInsets with
window.internals, and it re-names convertFromRenderer to
convertFromRendererToContainingView and also re-names convertToRenderer to
convertFromContainingViewToRenderer.

ScrollView::topContentInset() takes an optional parameter indicating whether the
caller wants the WebCore::Page contentInset or the platform content inset. It’s
necessary to distinguish between these cases because there is a lot of code that
only wants the WebCore::Page contentInset since that feature is actually
implemented in WebCore as opposed to being implemented at the platform level.

  • WebCore.exp.in:
  • page/FrameView.cpp:

(WebCore::FrameView::topContentInset):

For layout test purposes, set the platforTopContentInset here if there is a
platformWidget().
(WebCore::FrameView::topContentInsetDidChange):

Re-named functions, also all coordinate conversion functions call
topContentInset(ManualOrPlatformContentInset)
(WebCore::FrameView::convertFromContainingViewToRenderer):
(WebCore::FrameView::convertToContainingView):
(WebCore::FrameView::convertFromContainingView):
(WebCore::FrameView::convertFromRenderer): Deleted.
(WebCore::FrameView::convertToRenderer): Deleted.

  • page/FrameView.h:
  • page/Page.cpp:

(WebCore::Page::setTopContentInset):

  • platform/ScrollView.cpp:

(WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin):
(WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
(WebCore::ScrollView::contentsToRootView):
(WebCore::ScrollView::rootViewToTotalContents):
(WebCore::ScrollView::contentsToWindow):
(WebCore::ScrollView::platformTopContentInset):
(WebCore::ScrollView::platformSetTopContentInset):

  • platform/ScrollView.h:

(WebCore::ScrollView::topContentInset):

  • platform/ios/ScrollViewIOS.mm:

(WebCore::ScrollView::platformTopContentInset):
(WebCore::ScrollView::platformSetTopContentInset):

Implement new platform inset-related functions using AppKit's implementation.

  • platform/mac/ScrollViewMac.mm:

(WebCore::ScrollView::platformTopContentInset):
(WebCore::ScrollView::platformSetTopContentInset):

When we set the scroll position for the documentView, we have to factor the inset
back into the WebCore scroll position.
(WebCore::ScrollView::platformSetScrollPosition):

Re-named functions.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::convertFromScrollbarToContainingView):
(WebCore::RenderLayer::convertFromContainingViewToScrollbar):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::convertFromScrollbarToContainingView):
(WebCore::RenderListBox::convertFromContainingViewToScrollbar):

Source/WebKit2:
Re-named functions.

  • WebProcess/Plugins/PDF/PDFPlugin.mm:

(WebKit::PDFPlugin::convertFromScrollbarToContainingView):
(WebKit::PDFPlugin::convertFromContainingViewToScrollbar):

LayoutTests:
These hit-testing related contentInset tests will now work for mac on wk1 on
Yosemite and wk2.

  • platform/mac-wk1/TestExpectations:
  • platform/mac-wk2/tiled-drawing/content-inset-hit-testing-expected.txt: Removed.
  • platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame-expected.txt: Removed.
  • platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame.html: Removed.
  • platform/mac-wk2/tiled-drawing/content-inset-hit-testing.html: Removed.
  • platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html: Removed.
  • platform/mac/fast/events/content-inset-hit-testing-expected.txt: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-expected.txt.
  • platform/mac/fast/events/content-inset-hit-testing-in-frame-expected.txt: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame-expected.txt.
  • platform/mac/fast/events/content-inset-hit-testing-in-frame.html: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame.html.
  • platform/mac/fast/events/content-inset-hit-testing.html: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing.html.
  • platform/mac/fast/events/resources: Added.
  • platform/mac/fast/events/resources/iframe-to-hit-test.html: Copied from platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html.
Location:
trunk
Files:
1 added
15 edited
5 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r171886 r171891  
     12014-07-31  Beth Dakin  <bdakin@apple.com>
     2
     3        Hit-testing broken in WebKit 1 views with AppKit's contentInsets
     4        https://bugs.webkit.org/show_bug.cgi?id=135434
     5        -and corresponding-
     6        <rdar://problem/17850323>
     7
     8        Reviewed by Benjamin Poulain.
     9
     10        These hit-testing related contentInset tests will now work for mac on wk1 on
     11        Yosemite and wk2.
     12
     13        * platform/mac-wk1/TestExpectations:
     14        * platform/mac-wk2/tiled-drawing/content-inset-hit-testing-expected.txt: Removed.
     15        * platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame-expected.txt: Removed.
     16        * platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame.html: Removed.
     17        * platform/mac-wk2/tiled-drawing/content-inset-hit-testing.html: Removed.
     18        * platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html: Removed.
     19        * platform/mac/fast/events/content-inset-hit-testing-expected.txt: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-expected.txt.
     20        * platform/mac/fast/events/content-inset-hit-testing-in-frame-expected.txt: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame-expected.txt.
     21        * platform/mac/fast/events/content-inset-hit-testing-in-frame.html: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing-in-frame.html.
     22        * platform/mac/fast/events/content-inset-hit-testing.html: Copied from platform/mac-wk2/tiled-drawing/content-inset-hit-testing.html.
     23        * platform/mac/fast/events/resources: Added.
     24        * platform/mac/fast/events/resources/iframe-to-hit-test.html: Copied from platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html.
     25
    1262014-07-31  Bear Travis  <betravis@adobe.com>
    227
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r171344 r171891  
    4848plugins/snapshotting
    4949
     50# Mavericks and prior do not support contentInset
     51[ MountainLion Mavericks ] platform/mac/fast/events/content-inset-hit-testing.html [ Skip ]
     52[ MountainLion Mavericks ] platform/mac/fast/events/content-inset-hit-testing-in-frame.html [ Skip ]
     53
    5054### END OF (2) Failures without bug reports
    5155########################################
  • trunk/Source/WebCore/ChangeLog

    r171890 r171891  
     12014-07-31  Beth Dakin  <bdakin@apple.com>
     2
     3        Hit-testing broken in WebKit 1 views with AppKit's contentInsets
     4        https://bugs.webkit.org/show_bug.cgi?id=135434
     5        -and corresponding-
     6        <rdar://problem/17850323>
     7
     8        Reviewed by Benjamin Poulain.
     9
     10        AppKit's contentInsets are factored into scroll positions and mouse positions, but
     11        in WebCore, we generally want all of those things to be factored out so that, for
     12        example, the scroll position of a document pinned to the top is the same whether
     13        or not there is a contentInset. So to fix hit-testing in WebKit 1 views with
     14        contentInsets, this patch factors the inset out or into of all coordinate
     15        conversion methods just like we do for the WebKit2 contentInset.
     16       
     17        This patch also adds the ability to test WK1 platformContentInsets with
     18        window.internals, and it re-names convertFromRenderer to
     19        convertFromRendererToContainingView and also re-names convertToRenderer to
     20        convertFromContainingViewToRenderer.
     21
     22        ScrollView::topContentInset() takes an optional parameter indicating whether the
     23        caller wants the WebCore::Page contentInset or the platform content inset. It’s
     24        necessary to distinguish between these cases because there is a lot of code that
     25        only wants the WebCore::Page contentInset since that feature is actually
     26        implemented in WebCore as opposed to being implemented at the platform level.
     27        * WebCore.exp.in:
     28        * page/FrameView.cpp:
     29        (WebCore::FrameView::topContentInset):
     30
     31        For layout test purposes, set the platforTopContentInset here if there is a
     32        platformWidget().
     33        (WebCore::FrameView::topContentInsetDidChange):
     34
     35        Re-named functions, also all coordinate conversion functions call
     36        topContentInset(ManualOrPlatformContentInset)
     37        (WebCore::FrameView::convertFromContainingViewToRenderer):
     38        (WebCore::FrameView::convertToContainingView):
     39        (WebCore::FrameView::convertFromContainingView):
     40        (WebCore::FrameView::convertFromRenderer): Deleted.
     41        (WebCore::FrameView::convertToRenderer): Deleted.
     42        * page/FrameView.h:
     43        * page/Page.cpp:
     44        (WebCore::Page::setTopContentInset):
     45        * platform/ScrollView.cpp:
     46        (WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin):
     47        (WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
     48        (WebCore::ScrollView::contentsToRootView):
     49        (WebCore::ScrollView::rootViewToTotalContents):
     50        (WebCore::ScrollView::contentsToWindow):
     51        (WebCore::ScrollView::platformTopContentInset):
     52        (WebCore::ScrollView::platformSetTopContentInset):
     53        * platform/ScrollView.h:
     54        (WebCore::ScrollView::topContentInset):
     55        * platform/ios/ScrollViewIOS.mm:
     56        (WebCore::ScrollView::platformTopContentInset):
     57        (WebCore::ScrollView::platformSetTopContentInset):
     58
     59        Implement new platform inset-related functions using AppKit's implementation.
     60        * platform/mac/ScrollViewMac.mm:
     61        (WebCore::ScrollView::platformTopContentInset):
     62        (WebCore::ScrollView::platformSetTopContentInset):
     63       
     64        When we set the scroll position for the documentView, we have to factor the inset
     65        back into the WebCore scroll position.
     66        (WebCore::ScrollView::platformSetScrollPosition):
     67       
     68        Re-named functions.
     69        * rendering/RenderLayer.cpp:
     70        (WebCore::RenderLayer::convertFromScrollbarToContainingView):
     71        (WebCore::RenderLayer::convertFromContainingViewToScrollbar):
     72        * rendering/RenderListBox.cpp:
     73        (WebCore::RenderListBox::convertFromScrollbarToContainingView):
     74        (WebCore::RenderListBox::convertFromContainingViewToScrollbar):
     75
    1762014-07-31  Dean Jackson  <dino@apple.com>
    277
  • trunk/Source/WebCore/WebCore.exp.in

    r171826 r171891  
    20182018__ZNK7WebCore9FrameView13paintBehaviorEv
    20192019__ZNK7WebCore9FrameView14didFirstLayoutEv
    2020 __ZNK7WebCore9FrameView15topContentInsetEv
    2021 __ZNK7WebCore9FrameView17convertToRendererEPKNS_13RenderElementERKNS_7IntRectE
    2022 __ZNK7WebCore9FrameView17convertToRendererEPKNS_13RenderElementERKNS_8IntPointE
     2020__ZNK7WebCore9FrameView15topContentInsetENS_10ScrollView19TopContentInsetTypeE
    20232021__ZNK7WebCore9FrameView19baseBackgroundColorEv
    2024 __ZNK7WebCore9FrameView19convertFromRendererEPKNS_13RenderElementERKNS_7IntRectE
    2025 __ZNK7WebCore9FrameView19convertFromRendererEPKNS_13RenderElementERKNS_8IntPointE
    20262022__ZNK7WebCore9FrameView20isSoftwareRenderableEv
    20272023__ZNK7WebCore9FrameView21maximumScrollPositionEv
     
    20302026__ZNK7WebCore9FrameView27windowClipRectForFrameOwnerEPKNS_21HTMLFrameOwnerElementEb
    20312027__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
     2028__ZNK7WebCore9FrameView35convertFromContainingViewToRendererEPKNS_13RenderElementERKNS_7IntRectE
     2029__ZNK7WebCore9FrameView35convertFromContainingViewToRendererEPKNS_13RenderElementERKNS_8IntPointE
     2030__ZNK7WebCore9FrameView35convertFromRendererToContainingViewEPKNS_13RenderElementERKNS_7IntRectE
     2031__ZNK7WebCore9FrameView35convertFromRendererToContainingViewEPKNS_13RenderElementERKNS_8IntPointE
    20322032__ZNK7WebCore9InlineBox10lineHeightEv
    20332033__ZNK7WebCore9InlineBox14caretMaxOffsetEv
  • trunk/Source/WebCore/page/FrameView.cpp

    r171886 r171891  
    931931}
    932932
    933 float FrameView::topContentInset() const
    934 {
     933float FrameView::topContentInset(TopContentInsetType contentInsetTypeToReturn) const
     934{
     935    if (platformWidget() && contentInsetTypeToReturn == TopContentInsetType::WebCoreOrPlatformContentInset)
     936        return platformTopContentInset();
     937
    935938    if (!frame().isMainFrame())
    936939        return 0;
     
    940943}
    941944   
    942 void FrameView::topContentInsetDidChange()
     945void FrameView::topContentInsetDidChange(float newTopContentInset)
    943946{
    944947    RenderView* renderView = this->renderView();
    945948    if (!renderView)
    946949        return;
     950
     951    if (platformWidget())
     952        platformSetTopContentInset(newTopContentInset);
    947953   
    948954    layout();
     
    953959
    954960    if (TiledBacking* tiledBacking = this->tiledBacking())
    955         tiledBacking->setTopContentInset(topContentInset());
     961        tiledBacking->setTopContentInset(newTopContentInset);
    956962}
    957963   
     
    39323938}
    39333939
    3934 IntRect FrameView::convertFromRenderer(const RenderElement* renderer, const IntRect& rendererRect) const
     3940IntRect FrameView::convertFromRendererToContainingView(const RenderElement* renderer, const IntRect& rendererRect) const
    39353941{
    39363942    IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer->localToAbsoluteQuad(FloatRect(rendererRect)).boundingBox()));
     
    39383944    // Convert from page ("absolute") to FrameView coordinates.
    39393945    if (!delegatesScrolling())
    3940         rect.moveBy(-scrollPosition() + IntPoint(0, headerHeight() + topContentInset()));
     3946        rect.moveBy(-scrollPosition() + IntPoint(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)));
    39413947
    39423948    return rect;
    39433949}
    39443950
    3945 IntRect FrameView::convertToRenderer(const RenderElement* renderer, const IntRect& viewRect) const
     3951IntRect FrameView::convertFromContainingViewToRenderer(const RenderElement* renderer, const IntRect& viewRect) const
    39463952{
    39473953    IntRect rect = viewRect;
     
    39573963}
    39583964
    3959 IntPoint FrameView::convertFromRenderer(const RenderElement* renderer, const IntPoint& rendererPoint) const
     3965IntPoint FrameView::convertFromRendererToContainingView(const RenderElement* renderer, const IntPoint& rendererPoint) const
    39603966{
    39613967    IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, UseTransforms));
     
    39633969    // Convert from page ("absolute") to FrameView coordinates.
    39643970    if (!delegatesScrolling())
    3965         point.moveBy(-scrollPosition() + IntPoint(0, headerHeight() + topContentInset()));
     3971        point.moveBy(-scrollPosition() + IntPoint(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)));
    39663972    return point;
    39673973}
    39683974
    3969 IntPoint FrameView::convertToRenderer(const RenderElement* renderer, const IntPoint& viewPoint) const
     3975IntPoint FrameView::convertFromContainingViewToRenderer(const RenderElement* renderer, const IntPoint& viewPoint) const
    39703976{
    39713977    IntPoint point = viewPoint;
     
    39923998            rect.move(renderer->borderLeft() + renderer->paddingLeft(),
    39933999                      renderer->borderTop() + renderer->paddingTop());
    3994             return parentView->convertFromRenderer(renderer, rect);
     4000            return parentView->convertFromRendererToContainingView(renderer, rect);
    39954001        }
    39964002       
     
    40124018                return parentRect;
    40134019
    4014             IntRect rect = parentView->convertToRenderer(renderer, parentRect);
     4020            IntRect rect = parentView->convertFromContainingViewToRenderer(renderer, parentRect);
    40154021            // Subtract borders and padding
    40164022            rect.move(-renderer->borderLeft() - renderer->paddingLeft(),
     
    40414047            point.move(renderer->borderLeft() + renderer->paddingLeft(),
    40424048                       renderer->borderTop() + renderer->paddingTop());
    4043             return parentView->convertFromRenderer(renderer, point);
     4049            return parentView->convertFromRendererToContainingView(renderer, point);
    40444050        }
    40454051       
     
    40614067                return parentPoint;
    40624068
    4063             IntPoint point = parentView->convertToRenderer(renderer, parentPoint);
     4069            IntPoint point = parentView->convertFromContainingViewToRenderer(renderer, parentPoint);
    40644070            // Subtract borders and padding
    40654071            point.move(-renderer->borderLeft() - renderer->paddingLeft(),
  • trunk/Source/WebCore/page/FrameView.h

    r171336 r171891  
    388388
    389389    // Methods to convert points and rects between the coordinate space of the renderer, and this view.
    390     IntRect convertFromRenderer(const RenderElement*, const IntRect&) const;
    391     IntRect convertToRenderer(const RenderElement*, const IntRect&) const;
    392     IntPoint convertFromRenderer(const RenderElement*, const IntPoint&) const;
    393     IntPoint convertToRenderer(const RenderElement*, const IntPoint&) const;
     390    IntRect convertFromRendererToContainingView(const RenderElement*, const IntRect&) const;
     391    IntRect convertFromContainingViewToRenderer(const RenderElement*, const IntRect&) const;
     392    IntPoint convertFromRendererToContainingView(const RenderElement*, const IntPoint&) const;
     393    IntPoint convertFromContainingViewToRenderer(const RenderElement*, const IntPoint&) const;
    394394
    395395    bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
     
    466466    void setFooterHeight(int);
    467467
    468     virtual float topContentInset() const override;
    469     void topContentInsetDidChange();
     468    virtual float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const override;
     469    void topContentInsetDidChange(float newTopContentInset);
    470470
    471471    virtual void willStartLiveResize() override;
  • trunk/Source/WebCore/page/Page.cpp

    r171661 r171891  
    807807   
    808808    if (FrameView* view = mainFrame().view())
    809         view->topContentInsetDidChange();
     809        view->topContentInsetDidChange(m_topContentInset);
    810810}
    811811
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r170558 r171891  
    411411IntSize ScrollView::documentScrollOffsetRelativeToViewOrigin() const
    412412{
    413     return scrollOffset() - IntSize(0, headerHeight() + topContentInset());
     413    return scrollOffset() - IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
    414414}
    415415
     
    417417{
    418418    IntPoint scrollPosition = this->scrollPosition();
    419     return IntPoint(scrollPosition.x(), scrollPosition.y() - headerHeight() - topContentInset());
     419    return IntPoint(scrollPosition.x(), scrollPosition.y() - headerHeight() - topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
    420420}
    421421
     
    831831        return convertToRootView(contentsPoint);
    832832
    833     IntPoint viewPoint = contentsPoint + IntSize(0, headerHeight() + topContentInset()) - scrollOffset();
     833    IntPoint viewPoint = contentsPoint + IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)) - scrollOffset();
    834834    return convertToRootView(viewPoint); 
    835835}
     
    851851
    852852    IntRect viewRect = contentsRect;
    853     viewRect.move(-scrollOffset() + IntSize(0, headerHeight() + topContentInset()));
     853    viewRect.move(-scrollOffset() + IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)));
    854854    return convertToRootView(viewRect);
    855855}
     
    861861
    862862    IntPoint viewPoint = convertFromRootView(rootViewPoint);
    863     return viewPoint + scrollOffset() - IntSize(0, topContentInset());
     863    return viewPoint + scrollOffset() - IntSize(0, topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
    864864}
    865865
     
    878878        return convertToContainingWindow(contentsPoint);
    879879
    880     IntPoint viewPoint = contentsPoint + IntSize(0, headerHeight() + topContentInset()) - scrollOffset();
     880    IntPoint viewPoint = contentsPoint + IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)) - scrollOffset();
    881881    return convertToContainingWindow(viewPoint); 
    882882}
     
    898898
    899899    IntRect viewRect = contentsRect;
    900     viewRect.move(-scrollOffset() + IntSize(0, headerHeight() + topContentInset()));
     900    viewRect.move(-scrollOffset() + IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset)));
    901901    return convertToContainingWindow(viewRect);
    902902}
     
    15161516}
    15171517
     1518float ScrollView::platformTopContentInset() const
     1519{
     1520    return 0;
     1521}
     1522
     1523void ScrollView::platformSetTopContentInset(float)
     1524{
     1525}
     1526
    15181527IntSize ScrollView::platformVisibleContentSize(bool) const
    15191528{
  • trunk/Source/WebCore/platform/ScrollView.h

    r170773 r171891  
    157157    bool canBlitOnScroll() const;
    158158
    159     virtual float topContentInset() const { return 0; }
     159    // There are at least three types of contentInset. Usually we just care about WebCoreContentInset, which is the inset
     160    // that is set on a Page that requires WebCore to move its layers to accomodate the inset. However, there are platform
     161    // concepts that are similar on both iOS and Mac when there is a platformWidget(). Sometimes we need the Mac platform value
     162    // for topContentInset, so when the TopContentInsetType is WebCoreOrPlatformContentInset, platformTopContentInset()
     163    // will be returned instead of the value set on Page.
     164    enum class TopContentInsetType { WebCoreContentInset, WebCoreOrPlatformContentInset };
     165    virtual float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const { return 0; }
    160166
    161167    // The visible content rect has a location that is the scrolled offset of the document. The width and height are the unobscured viewport
     
    408414    // Called to update the scrollbars to accurately reflect the state of the view.
    409415    void updateScrollbars(const IntSize& desiredOffset);
     416
     417    float platformTopContentInset() const;
     418    void platformSetTopContentInset(float);
    410419
    411420private:
  • trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm

    r170773 r171891  
    162162}
    163163
     164float ScrollView::platformTopContentInset(float) const
     165{
     166    return 0;
     167}
     168
     169void ScrollView::platformSetTopContentInset()
     170{
     171}
     172
    164173IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
    165174{
  • trunk/Source/WebCore/platform/mac/ScrollViewMac.mm

    r171615 r171891  
    109109}
    110110
     111float ScrollView::platformTopContentInset() const
     112{
     113    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     114#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     115    return scrollView().contentInsets.top;
     116#endif
     117    END_BLOCK_OBJC_EXCEPTIONS;
     118
     119    return 0;
     120}
     121
     122void ScrollView::platformSetTopContentInset(float topContentInset)
     123{
     124    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     125#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     126    if (topContentInset)
     127        scrollView().automaticallyAdjustsContentInsets = NO;
     128    else
     129        scrollView().automaticallyAdjustsContentInsets = YES;
     130
     131    NSEdgeInsets contentInsets = scrollView().contentInsets;
     132    contentInsets.top = topContentInset;
     133    scrollView().contentInsets = contentInsets;
     134#else
     135    UNUSED_PARAM(topContentInset);
     136#endif
     137    END_BLOCK_OBJC_EXCEPTIONS;
     138}
     139
    111140IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
    112141{
     
    161190    NSPoint floatPoint = scrollPoint;
    162191    NSPoint tempPoint = { std::max(-[scrollView() scrollOrigin].x, floatPoint.x), std::max(-[scrollView() scrollOrigin].y, floatPoint.y) };  // Don't use NSMakePoint to work around 4213314.
     192
     193#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     194    // AppKit has the inset factored into all of its scroll positions. In WebCore, we use positions that ignore
     195    // the insets so that they are equivalent whether or not there is an inset.
     196    tempPoint.x = tempPoint.x - scrollView().contentInsets.left;
     197    tempPoint.y = tempPoint.y - scrollView().contentInsets.top;
     198#endif
     199
    163200    [documentView() scrollPoint:tempPoint];
    164201    END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r171745 r171891  
    27312731    rect.move(scrollbarOffset(scrollbar));
    27322732
    2733     return renderer().view().frameView().convertFromRenderer(&renderer(), rect);
     2733    return renderer().view().frameView().convertFromRendererToContainingView(&renderer(), rect);
    27342734}
    27352735
    27362736IntRect RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
    27372737{
    2738     IntRect rect = renderer().view().frameView().convertToRenderer(&renderer(), parentRect);
     2738    IntRect rect = renderer().view().frameView().convertFromContainingViewToRenderer(&renderer(), parentRect);
    27392739    rect.move(-scrollbarOffset(scrollbar));
    27402740    return rect;
     
    27452745    IntPoint point = scrollbarPoint;
    27462746    point.move(scrollbarOffset(scrollbar));
    2747     return renderer().view().frameView().convertFromRenderer(&renderer(), point);
     2747    return renderer().view().frameView().convertFromRendererToContainingView(&renderer(), point);
    27482748}
    27492749
    27502750IntPoint RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
    27512751{
    2752     IntPoint point = renderer().view().frameView().convertToRenderer(&renderer(), parentPoint);
     2752    IntPoint point = renderer().view().frameView().convertFromContainingViewToRenderer(&renderer(), parentPoint);
    27532753    point.move(-scrollbarOffset(scrollbar));
    27542754    return point;
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r170972 r171891  
    726726    int scrollbarTop = borderTop();
    727727    rect.move(scrollbarLeft, scrollbarTop);
    728     return view().frameView().convertFromRenderer(this, rect);
     728    return view().frameView().convertFromRendererToContainingView(this, rect);
    729729}
    730730
    731731IntRect RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
    732732{
    733     IntRect rect = view().frameView().convertToRenderer(this, parentRect);
     733    IntRect rect = view().frameView().convertFromContainingViewToRenderer(this, parentRect);
    734734    int scrollbarLeft = width() - borderRight() - scrollbar->width();
    735735    int scrollbarTop = borderTop();
     
    744744    int scrollbarTop = borderTop();
    745745    point.move(scrollbarLeft, scrollbarTop);
    746     return view().frameView().convertFromRenderer(this, point);
     746    return view().frameView().convertFromRendererToContainingView(this, point);
    747747}
    748748
    749749IntPoint RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
    750750{
    751     IntPoint point = view().frameView().convertToRenderer(this, parentPoint);
     751    IntPoint point = view().frameView().convertFromContainingViewToRenderer(this, parentPoint);
    752752    int scrollbarLeft = width() - borderRight() - scrollbar->width();
    753753    int scrollbarTop = borderTop();
  • trunk/Source/WebKit2/ChangeLog

    r171887 r171891  
     12014-07-31  Beth Dakin  <bdakin@apple.com>
     2
     3        Hit-testing broken in WebKit 1 views with AppKit's contentInsets
     4        https://bugs.webkit.org/show_bug.cgi?id=135434
     5        -and corresponding-
     6        <rdar://problem/17850323>
     7
     8        Reviewed by Benjamin Poulain.
     9
     10        Re-named functions.
     11        * WebProcess/Plugins/PDF/PDFPlugin.mm:
     12        (WebKit::PDFPlugin::convertFromScrollbarToContainingView):
     13        (WebKit::PDFPlugin::convertFromContainingViewToScrollbar):
     14
    1152014-07-31  Oliver Hunt  <oliver@apple.com>
    216
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm

    r170972 r171891  
    680680    rect.move(scrollbar->location() - pluginView()->location());
    681681
    682     return pluginView()->frame()->view()->convertFromRenderer(pluginView()->renderer(), rect);
     682    return pluginView()->frame()->view()->convertFromRendererToContainingView(pluginView()->renderer(), rect);
    683683}
    684684
    685685IntRect PDFPlugin::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
    686686{
    687     IntRect rect = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentRect);
     687    IntRect rect = pluginView()->frame()->view()->convertFromContainingViewToRenderer(pluginView()->renderer(), parentRect);
    688688    rect.move(pluginView()->location() - scrollbar->location());
    689689
     
    696696    point.move(scrollbar->location() - pluginView()->location());
    697697
    698     return pluginView()->frame()->view()->convertFromRenderer(pluginView()->renderer(), point);
     698    return pluginView()->frame()->view()->convertFromRendererToContainingView(pluginView()->renderer(), point);
    699699}
    700700
    701701IntPoint PDFPlugin::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
    702702{
    703     IntPoint point = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentPoint);
     703    IntPoint point = pluginView()->frame()->view()->convertFromContainingViewToRenderer(pluginView()->renderer(), parentPoint);
    704704    point.move(pluginView()->location() - scrollbar->location());
    705705   
Note: See TracChangeset for help on using the changeset viewer.