Changeset 151926 in webkit


Ignore:
Timestamp:
Jun 24, 2013 2:02:36 PM (11 years ago)
Author:
Simon Fraser
Message:

Move displayID stuff from Widget to Chrome
https://bugs.webkit.org/show_bug.cgi?id=117944

Reviewed by Anders Carlsson.

In r151877 I polluted Widget with displayID-related stuff. This would
be better on HostWindow, so move it there. This is a net code reduction,
and eliminates PlatformScreenMac.h, and the NSScreen category.

Source/WebCore:

  • WebCore.exp.in: Remove some functions from the exports list.
  • WebCore.xcodeproj/project.pbxproj: PlatformScreenMac.h is gone!
  • dom/Document.cpp:

(WebCore::Document::requestAnimationFrame): Get the displayID from page->chrome()

  • page/Chrome.cpp:

(WebCore::Chrome::Chrome): Initialize m_displayID.
(WebCore::Chrome::displayID):
(WebCore::Chrome::windowScreenDidChange): Code moved from Page; save the
displayID, and tell all subframes that the displayID changed.

  • page/Chrome.h: Add displayID-related functions.
  • page/FrameView.cpp: Removed windowDisplayID().
  • page/FrameView.h: Ditto.
  • page/Page.cpp: Removed code.

(WebCore::Page::Page):

  • page/Page.h:
  • platform/HostWindow.h: Added virtual displayID-related functions.
  • platform/Widget.cpp: Removed code.
  • platform/Widget.h: Ditto.
  • platform/mac/PlatformScreenMac.h: Removed.
  • platform/mac/PlatformScreenMac.mm: Removed the NSScreen category.

(WebCore::displayIDFromScreen):
(WebCore::screenForDisplayID):
(WebCore::displayFromWidget):
(WebCore::screenForWidget):

  • platform/mac/WidgetMac.mm: Removed windowDisplayID().
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh): Get
the displayID via chrome().

Source/WebKit/mac:

  • WebView/WebView.mm:

(-[WebView doWindowDidChangeScreen]): Go via chrome().

Source/WebKit2:

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::windowScreenDidChange): Go via chrome().

Location:
trunk/Source
Files:
1 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151925 r151926  
     12013-06-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Move displayID stuff from Widget to Chrome
     4        https://bugs.webkit.org/show_bug.cgi?id=117944
     5
     6        Reviewed by Anders Carlsson.
     7
     8        In r151877 I polluted Widget with displayID-related stuff. This would
     9        be better on HostWindow, so move it there. This is a net code reduction,
     10        and eliminates PlatformScreenMac.h, and the NSScreen category.
     11
     12        * WebCore.exp.in: Remove some functions from the exports list.
     13        * WebCore.xcodeproj/project.pbxproj: PlatformScreenMac.h is gone!
     14        * dom/Document.cpp:
     15        (WebCore::Document::requestAnimationFrame): Get the displayID from page->chrome()
     16        * page/Chrome.cpp:
     17        (WebCore::Chrome::Chrome): Initialize m_displayID.
     18        (WebCore::Chrome::displayID):
     19        (WebCore::Chrome::windowScreenDidChange): Code moved from Page; save the
     20        displayID, and tell all subframes that the displayID changed.
     21        * page/Chrome.h: Add displayID-related functions.
     22        * page/FrameView.cpp: Removed windowDisplayID().
     23        * page/FrameView.h: Ditto.
     24        * page/Page.cpp: Removed code.
     25        (WebCore::Page::Page):
     26        * page/Page.h:
     27        * platform/HostWindow.h: Added virtual displayID-related functions.
     28        * platform/Widget.cpp: Removed code.
     29        * platform/Widget.h: Ditto.
     30        * platform/mac/PlatformScreenMac.h: Removed.
     31        * platform/mac/PlatformScreenMac.mm: Removed the NSScreen category.
     32        (WebCore::displayIDFromScreen):
     33        (WebCore::screenForDisplayID):
     34        (WebCore::displayFromWidget):
     35        (WebCore::screenForWidget):
     36        * platform/mac/WidgetMac.mm: Removed windowDisplayID().
     37        * rendering/RenderLayerCompositor.cpp:
     38        (WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh): Get
     39        the displayID via chrome().
     40
    1412013-06-24  Andreas Kling  <akling@apple.com>
    242
  • trunk/Source/WebCore/WebCore.exp.in

    r151877 r151926  
    10121012__ZN7WebCore6Widget9setParentEPNS_10ScrollViewE
    10131013__ZN7WebCore6WidgetD2Ev
    1014 __ZNK7WebCore6Widget15windowDisplayIDEv
    10151014__ZN7WebCore6toInt8EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE
    10161015__ZN7WebCore6toNodeEN3JSC7JSValueE
     
    18991898__ZN7WebCore42contextMenuItemTagCheckSpellingWhileTypingEv
    19001899__ZN7WebCore46contextMenuItemTagCorrectSpellingAutomaticallyEv
    1901 __ZN7WebCore4Page21windowScreenDidChangeEj
    19021900__ZN7WebCore5Frame9nodeImageEPNS_4NodeE
    19031901__ZN7WebCore6Cursor8fromTypeENS0_4TypeE
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r151914 r151926  
    252252                0F15DA8A0F3AAEE70000CE47 /* AnimationControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F15DA890F3AAEE70000CE47 /* AnimationControllerPrivate.h */; };
    253253                0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F29C16D1300C2E2002D794E /* AccessibilityAllInOne.cpp */; };
    254                 0F2C98EB1774084C00C1BBBA /* PlatformScreenMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2C98EA1774084C00C1BBBA /* PlatformScreenMac.h */; };
    255254                0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */; };
    256255                0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */; };
     
    64756474                0F15DA890F3AAEE70000CE47 /* AnimationControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationControllerPrivate.h; path = animation/AnimationControllerPrivate.h; sourceTree = "<group>"; };
    64766475                0F29C16D1300C2E2002D794E /* AccessibilityAllInOne.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAllInOne.cpp; sourceTree = "<group>"; };
    6477                 0F2C98EA1774084C00C1BBBA /* PlatformScreenMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformScreenMac.h; sourceTree = "<group>"; };
    64786476                0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowBlur.cpp; sourceTree = "<group>"; };
    64796477                0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowBlur.h; sourceTree = "<group>"; };
     
    1459514593                                BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */,
    1459614594                                C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
    14597                                 0F2C98EA1774084C00C1BBBA /* PlatformScreenMac.h */,
    1459814595                                BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
    1459914596                                29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
     
    2300122998                                C598905814E9C29900E8D18B /* PlatformPasteboard.h in Headers */,
    2300222999                                BCEC01D70C274EB4009F4EC9 /* PlatformScreen.h in Headers */,
    23003                                 0F2C98EB1774084C00C1BBBA /* PlatformScreenMac.h in Headers */,
    2300423000                                297BE3D516C03C08003316BD /* PlatformSpeechSynthesisUtterance.h in Headers */,
    2300523001                                297BE3D616C03C0B003316BD /* PlatformSpeechSynthesisVoice.h in Headers */,
  • trunk/Source/WebCore/dom/Document.cpp

    r151925 r151926  
    54685468    if (!m_scriptedAnimationController) {
    54695469#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    5470         m_scriptedAnimationController = ScriptedAnimationController::create(this, page() ? page()->displayID() : 0);
     5470        m_scriptedAnimationController = ScriptedAnimationController::create(this, page() ? page()->chrome().displayID() : 0);
    54715471#else
    54725472        m_scriptedAnimationController = ScriptedAnimationController::create(this, 0);
  • trunk/Source/WebCore/page/Chrome.cpp

    r150214 r151926  
    6666    : m_page(page)
    6767    , m_client(client)
     68    , m_displayID(0)
    6869{
    6970    ASSERT(m_client);
     
    530531#endif
    531532
     533PlatformDisplayID Chrome::displayID() const
     534{
     535    return m_displayID;
     536}
     537
     538void Chrome::windowScreenDidChange(PlatformDisplayID displayID)
     539{
     540    if (displayID == m_displayID)
     541        return;
     542
     543    m_displayID = displayID;
     544
     545    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
     546        if (frame->document())
     547            frame->document()->windowScreenDidChange(displayID);
     548    }
     549}
     550
    532551// --------
    533552
  • trunk/Source/WebCore/page/Chrome.h

    r149971 r151926  
    8888    virtual void scheduleAnimation() OVERRIDE;
    8989#endif
     90
     91    virtual PlatformDisplayID displayID() const OVERRIDE;
     92    virtual void windowScreenDidChange(PlatformDisplayID) OVERRIDE;
    9093
    9194    void scrollRectIntoView(const IntRect&) const;
     
    187190    Page* m_page;
    188191    ChromeClient* m_client;
     192    PlatformDisplayID m_displayID;
    189193    Vector<PopupOpeningObserver*> m_popupOpeningObservers;
    190194};
  • trunk/Source/WebCore/page/FrameView.cpp

    r151877 r151926  
    39763976}
    39773977
    3978 PlatformDisplayID FrameView::windowDisplayID() const
    3979 {
    3980     if (Page* page = m_frame->page())
    3981         return page->displayID();
    3982    
    3983     return Widget::windowDisplayID();
    3984 }
    3985 
    39863978// Normal delay
    39873979void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p)
  • trunk/Source/WebCore/page/FrameView.h

    r151877 r151926  
    483483    virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
    484484
    485     virtual PlatformDisplayID windowDisplayID() const OVERRIDE;
    486 
    487485    // ScrollableArea interface
    488486    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
  • trunk/Source/WebCore/page/Page.cpp

    r151607 r151926  
    177177    , m_visibilityState(PageVisibilityStateVisible)
    178178#endif
    179     , m_displayID(0)
    180179    , m_requestedLayoutMilestones(0)
    181180    , m_headerHeight(0)
     
    943942}
    944943
    945 void Page::windowScreenDidChange(PlatformDisplayID displayID)
    946 {
    947     m_displayID = displayID;
    948    
    949     for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    950         if (frame->document())
    951             frame->document()->windowScreenDidChange(displayID);
    952     }
    953 }
    954 
    955944void Page::suspendScriptedAnimations()
    956945{
  • trunk/Source/WebCore/page/Page.h

    r151607 r151926  
    303303    bool isInWindow() const { return m_isInWindow; }
    304304
    305     void windowScreenDidChange(PlatformDisplayID);
    306 
    307305    void suspendScriptedAnimations();
    308306    void resumeScriptedAnimations();
     
    356354#endif
    357355
    358     PlatformDisplayID displayID() const { return m_displayID; }
    359 
    360356    void addLayoutMilestones(LayoutMilestones);
    361357    void removeLayoutMilestones(LayoutMilestones);
     
    524520    PageVisibilityState m_visibilityState;
    525521#endif
    526     PlatformDisplayID m_displayID;
    527522
    528523    LayoutMilestones m_requestedLayoutMilestones;
  • trunk/Source/WebCore/platform/HostWindow.h

    r100309 r151926  
    7474    virtual void scheduleAnimation() = 0;
    7575#endif
     76
     77    virtual PlatformDisplayID displayID() const = 0;
     78    virtual void windowScreenDidChange(PlatformDisplayID) = 0;
    7679};
    7780
  • trunk/Source/WebCore/platform/Widget.cpp

    r151877 r151926  
    162162    return point;
    163163}
    164 
    165 PlatformDisplayID Widget::windowDisplayID() const
    166 {
    167     return 0;
    168 }
    169164#endif
    170165
  • trunk/Source/WebCore/platform/Widget.h

    r151877 r151926  
    226226    virtual IntPoint convertToContainingView(const IntPoint&) const;
    227227    virtual IntPoint convertFromContainingView(const IntPoint&) const;
    228    
    229     // Return the displayID of the screen that this widget's window is primarily on.
    230     virtual PlatformDisplayID windowDisplayID() const;
    231228
    232229private:
  • trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm

    r151879 r151926  
    2828
    2929#import "FloatRect.h"
    30 #import "Frame.h"
    31 #import "Page.h"
    32 #import "Widget.h"
     30#import "HostWindow.h"
     31#import "ScrollView.h"
    3332#import "NotImplemented.h"
    3433
    35 @implementation NSScreen(WebCoreNSScreenUtilities)
    36 + (NSScreen *)screenForDislayID:(PlatformDisplayID)displayID
     34namespace WebCore {
     35
     36static PlatformDisplayID displayIDFromScreen(NSScreen *screen)
     37{
     38    return (PlatformDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
     39}
     40
     41static NSScreen *screenForDisplayID(PlatformDisplayID displayID)
    3742{
    3843    for (NSScreen *screen in [NSScreen screens]) {
    39         if ([screen displayID] == displayID)
     44        if (displayIDFromScreen(screen) == displayID)
    4045            return screen;
    4146    }
    4247    return nil;
    4348}
    44 
    45 - (PlatformDisplayID)displayID
    46 {
    47     return (PlatformDisplayID)[[[self deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
    48 }
    49 @end
    50 
    51 namespace WebCore {
    5249
    5350int screenDepth(Widget*)
     
    6966// assume that the screen and the page share the same coordinate system.
    7067
     68static PlatformDisplayID displayFromWidget(Widget* widget)
     69{
     70    if (!widget)
     71        return 0;
     72   
     73    ScrollView* view = widget->root();
     74    if (!view)
     75        return 0;
     76
     77    return view->hostWindow()->displayID();
     78}
     79
    7180static NSScreen *screenForWidget(Widget* widget, NSWindow *window)
    7281{
     
    7685   
    7786    // Didn't get an NSWindow; probably WebKit2. Try using the Widget's display ID.
    78     if (NSScreen *screen = widget ? [NSScreen screenForDislayID:widget->windowDisplayID()] : nil)
     87    if (NSScreen *screen = screenForDisplayID(displayFromWidget(widget)))
    7988        return screen;
    8089   
  • trunk/Source/WebCore/platform/mac/WidgetMac.mm

    r151877 r151926  
    3838#import "Page.h"
    3939#import "PlatformMouseEvent.h"
    40 #import "PlatformScreenMac.h"
    4140#import "ScrollView.h"
    4241#import "WebCoreFrameView.h"
     
    357356}
    358357
    359 PlatformDisplayID Widget::windowDisplayID() const
    360 {
    361     return [[[platformWidget() window] screen] displayID];
    362 }
    363 
    364358} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r151661 r151926  
    422422        PlatformDisplayID displayID = 0;
    423423        if (Page* page = this->page())
    424             displayID = page->displayID();
     424            displayID = page->chrome().displayID();
    425425
    426426        m_layerUpdater = adoptPtr(new GraphicsLayerUpdater(this, displayID));
  • trunk/Source/WebKit/mac/ChangeLog

    r151832 r151926  
     12013-06-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Move displayID stuff from Widget to Chrome
     4        https://bugs.webkit.org/show_bug.cgi?id=117944
     5
     6        Reviewed by Anders Carlsson.
     7
     8        In r151877 I polluted Widget with displayID-related stuff. This would
     9        be better on HostWindow, so move it there. This is a net code reduction,
     10        and eliminates PlatformScreenMac.h, and the NSScreen category.
     11
     12        * WebView/WebView.mm:
     13        (-[WebView doWindowDidChangeScreen]): Go via chrome().
     14
    1152013-06-21  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    216
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r151832 r151926  
    117117#import <WebCore/BackForwardListImpl.h>
    118118#import <WebCore/MemoryCache.h>
     119#import <WebCore/Chrome.h>
    119120#import <WebCore/ColorMac.h>
    120121#import <WebCore/Cursor.h>
     
    37013702{
    37023703    if (_private && _private->page)
    3703         _private->page->windowScreenDidChange((PlatformDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
     3704        _private->page->chrome().windowScreenDidChange((PlatformDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
    37043705}
    37053706
  • trunk/Source/WebKit2/ChangeLog

    r151904 r151926  
     12013-06-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Move displayID stuff from Widget to Chrome
     4        https://bugs.webkit.org/show_bug.cgi?id=117944
     5
     6        Reviewed by Anders Carlsson.
     7
     8        In r151877 I polluted Widget with displayID-related stuff. This would
     9        be better on HostWindow, so move it there. This is a net code reduction,
     10        and eliminates PlatformScreenMac.h, and the NSScreen category.
     11
     12        * WebProcess/WebPage/WebPage.cpp:
     13        (WebKit::WebPage::windowScreenDidChange): Go via chrome().
     14
    1152013-06-24  Krzysztof Wolanski  <k.wolanski@samsung.com>
    216
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r151881 r151926  
    12511251void WebPage::windowScreenDidChange(uint64_t displayID)
    12521252{
    1253     m_page->windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
     1253    m_page->chrome().windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
    12541254}
    12551255
Note: See TracChangeset for help on using the changeset viewer.