Changeset 83909 in webkit


Ignore:
Timestamp:
Apr 14, 2011 4:13:35 PM (13 years ago)
Author:
beidson@apple.com
Message:

<rdar://problem/8665102> and https://bugs.webkit.org/show_bug.cgi?id=58595
Menu is not displayed for <input type=search results="5">

Reviewed by Sam Weinig.

  • WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp:

(WebKit::WebSearchPopupMenu::enabled): Return true, like all good search popup menus should.

  • WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:

(WebKit::WebPopupMenu::setUpPlatformData): Remember the shouldPopOver-ness.

  • Shared/PlatformPopupMenuData.cpp:

(WebKit::PlatformPopupMenuData::encode): Remember the shouldPopOver-ness.
(WebKit::PlatformPopupMenuData::decode): Remember the shouldPopOver-ness.

  • Shared/PlatformPopupMenuData.h:
  • UIProcess/mac/WebPopupMenuProxyMac.mm:

(WebKit::WebPopupMenuProxyMac::showPopupMenu): Use the shouldPopOver-ness to adjust display position.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r83901 r83909  
     12011-04-14  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        <rdar://problem/8665102> and https://bugs.webkit.org/show_bug.cgi?id=58595
     6        Menu is not displayed for <input type=search results="5">
     7
     8        * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp:
     9        (WebKit::WebSearchPopupMenu::enabled): Return true, like all good search popup menus should.
     10
     11        * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
     12        (WebKit::WebPopupMenu::setUpPlatformData): Remember the shouldPopOver-ness.
     13
     14        * Shared/PlatformPopupMenuData.cpp:
     15        (WebKit::PlatformPopupMenuData::encode): Remember the shouldPopOver-ness.
     16        (WebKit::PlatformPopupMenuData::decode): Remember the shouldPopOver-ness.
     17        * Shared/PlatformPopupMenuData.h:
     18
     19        * UIProcess/mac/WebPopupMenuProxyMac.mm:
     20        (WebKit::WebPopupMenuProxyMac::showPopupMenu): Use the shouldPopOver-ness to adjust display position.
     21
    1222011-04-14  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebKit2/Shared/PlatformPopupMenuData.cpp

    r82441 r83909  
    6262#elif PLATFORM(MAC)
    6363    encoder->encode(fontInfo);
     64    encoder->encode(shouldPopOver);
    6465#endif
    6566}
     
    9394    if (!decoder->decode(data.fontInfo))
    9495        return false;
     96    if (!decoder->decode(data.shouldPopOver))
     97        return false;
    9598#endif
    9699   
  • trunk/Source/WebKit2/Shared/PlatformPopupMenuData.h

    r82441 r83909  
    5555#elif PLATFORM(MAC)
    5656    FontInfo fontInfo;
     57    bool shouldPopOver;
    5758#endif
    5859};
  • trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm

    r79886 r83909  
    109109    // These values were borrowed from AppKit to match their placement of the menu.
    110110    const int popOverHorizontalAdjust = -10;
    111     NSRect titleFrame = [m_popup.get()  titleRectForBounds:rect];
    112     if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0)
    113         titleFrame = rect;
    114     float vertOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
    115     NSPoint location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - vertOffset);
     111    const int popUnderHorizontalAdjust = 6;
     112    const int popUnderVerticalAdjust = 6;
     113   
     114    // Menus that pop-over directly obscure the node that generated the popup menu.
     115    // Menus that pop-under are offset underneath it.
     116    NSPoint location;
     117    if (data.shouldPopOver) {
     118        NSRect titleFrame = [m_popup.get()  titleRectForBounds:rect];
     119        if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0)
     120            titleFrame = rect;
     121        float vertOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
     122        location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - vertOffset);
     123    } else
     124        location = NSMakePoint(NSMinX(rect) + popUnderHorizontalAdjust, NSMaxY(rect) + popUnderVerticalAdjust); 
    116125
    117126    RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:rect]);
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp

    r76916 r83909  
    11/*
    22 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    3  * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    5353bool WebSearchPopupMenu::enabled()
    5454{
    55     return false;
     55    return true;
    5656}
    5757
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm

    r79886 r83909  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747   
    4848    data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
     49    data.shouldPopOver = m_popupClient->shouldPopOver();
    4950}
    5051
Note: See TracChangeset for help on using the changeset viewer.