Ticket #62: popup.patch

File popup.patch, 25.1 kB (added by mbensi, 6 months ago)
  • BAL/ChangeLogOWB

    old new  
     12008-06-18  Mario Bensi  <mbensi@pleyo.com> 
     2 
     3        Reviewed by NOBODY (OOPS!). 
     4        add new implementation of Popup and fix Database 
     5 
     6        * OWBAL/Concretizations/Facilities/Posix/BCFileSystemPosix.cpp: 
     7        (OWBAL::fileSystemRepresentation): 
     8        (OWBAL::homeDirectoryPath): 
     9        * WKAL/Concretizations/Events/SDL/BCEventLoopSDL.cpp: 
     10        (WKAL::EventLoop::cycle): 
     11        * WKAL/Concretizations/Graphics/SDL/BCImageSDL.cpp: 
     12        (WKAL::BitmapImage::draw): 
     13        (WKAL::Image::drawPattern): 
     14        * WKAL/Concretizations/Widgets/SDL/BCPopupMenuSDL.cpp: 
     15        (WKAL::PopupMenu::show): 
     16        (WKAL::PopupMenu::setFocusedIndex): 
     17        (WKAL::PopupMenu::scrollToRevealSelection): 
     18        (WKAL::PopupMenu::hide): 
     19        (WKAL::PopupMenu::updateFromElement): 
     20        (WKAL::PopupMenu::menuItemActivated): 
     21        (WKAL::PopupMenu::menuUnmapped): 
     22        (WKAL::PopupMenu::menuPositionFunction): 
     23        (WKAL::PopupMenu::windowRect): 
     24        (WKAL::PopupMenu::calculatePositionAndSize): 
     25        (WKAL::PopupMenu::valueChanged): 
     26        * WKAL/Concretizations/Widgets/SDL/BCPopupMenuSDL.h: 
     27        * scripts/patches/FileSystemPosix.patch: 
     28        * scripts/patches/index.txt: 
     29 
    1302008-06-16  Mario Bensi  <mbensi@pleyo.com> 
    231 
    332        Reviewed by Jean-Charles Verdie. 
  • BAL/OWBAL/Concretizations/Facilities/Posix/BCFileSystemPosix.cpp

    old new  
    163163    return -1; 
    164164} 
    165165 
    166 CString fileSystemRepresentation(const String&
     166CString fileSystemRepresentation(const String &file
    167167{ 
    168     return ""
     168    return file.utf8()
    169169} 
    170170 
    171171void closeFile(PlatformFileHandle&) 
     
    179179 
    180180String homeDirectoryPath() 
    181181{ 
    182     return ""
     182    return getenv("HOME")
    183183} 
    184184 
    185185CString openTemporaryFile(const char* prefix, PlatformFileHandle&) 
  • BAL/WKAL/Concretizations/Events/SDL/BCEventLoopSDL.cpp

    old new  
    2626 
    2727void EventLoop::cycle() 
    2828{ 
    29     SDL_Event event; 
    30     SDL_WaitEvent(&event); 
     29    //SDL_Event event; 
     30    //SDL_WaitEvent(&event); 
    3131} 
    3232 
    3333} // namespace WebCore 
  • BAL/WKAL/Concretizations/Graphics/SDL/BCImageSDL.cpp

    old new  
    249249    else 
    250250        srcRect.h = static_cast<Uint16>(src.height()); 
    251251 
    252     dstRect.x = static_cast<Sint16>(dest.x()); 
    253     dstRect.y = static_cast<Sint16>(dest.y()); 
     252    dstRect.x = static_cast<Sint16>(dest.x() + context->origin().width()); 
     253    dstRect.y = static_cast<Sint16>(dest.y() + context->origin().height()); 
    254254    dstRect.w = static_cast<Sint16>(dest.width()); 
    255255    dstRect.h = static_cast<Sint16>(dest.height()); 
    256256 
     
    273273        for (int y = static_cast<int>(phase.y()); y <= yMax; y += image->h) { 
    274274            dest.setLocation(IntPoint(x, y) + context->origin()); 
    275275             
    276             dstRect.x = static_cast<Sint16>(dest.x()); 
    277             dstRect.y = static_cast<Sint16>(dest.y()); 
     276            dstRect.x = static_cast<Sint16>(dest.x() + context->origin().width()); 
     277            dstRect.y = static_cast<Sint16>(dest.y() + context->origin().height()); 
    278278            dstRect.w = static_cast<Sint16>(dest.width()); 
    279279            dstRect.h = static_cast<Sint16>(dest.height()); 
    280280 
  • BAL/WKAL/Concretizations/Widgets/SDL/BCPopupMenuSDL.cpp

    old new  
    4040#include "PlatformScreen.h" 
    4141#include "PlatformString.h" 
    4242#include "RenderStyle.h" 
     43#include "BCObserverService.h" 
    4344#include "SDL.h" 
    4445 
    4546using std::min; 
     
    7879 
    7980PopupMenu::~PopupMenu() 
    8081{ 
    81     printf("PopupMenu::~PopupMenu\n"); 
    8282    if (m_popup) 
    8383        SDL_FreeSurface(m_popup); 
    8484} 
     
    9191    if (clientRect().isEmpty()) 
    9292        return; 
    9393 
    94     printf("PopupMenu::show\n"); 
    95     if (!m_popup) { 
    96         printf("PopupMenu::show create popup\n"); 
    97         // Even though we already know our size and location at this point, we pass (0,0,0,0) as our size/location here. 
    98         // We need to wait until after the call to ::SetWindowLongPtr to set our size so that in our WM_SIZE handler we can get access to the PopupMenu object 
    99         SDL_Surface* surface; 
    100         Uint32 rmask, gmask, bmask, amask; 
    101         /* SDL interprets each pixel as a 32-bit number, so our masks must depend 
    102         on the endianness (byte order) of the machine */ 
    103         rmask = 0x00ff0000; 
    104         gmask = 0x0000ff00; 
    105         bmask = 0x000000ff; 
    106         amask = 0xff000000; 
    107         m_popup = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCALPHA, r.width(), r.height(), 32, 
    108                                        rmask, gmask, bmask, amask); 
    109  
    110         if (!m_popup) 
    111             return; 
    112     } 
    113  
    114     if (!m_scrollBar) 
    115         if (visibleItems() < client()->listSize()) { 
    116             // We need a scroll bar 
    117             m_scrollBar = PlatformScrollbar::create(this, VerticalScrollbar, SmallScrollbar); 
    118             m_scrollBar->setContainingWindow(m_popup); 
    119         } 
    120  
    121     SDL_Rect srcRect, dstRect; 
    122  
    123     static_cast<Sint16>(r.x()); 
    124     static_cast<Sint16>(r.y()); 
    125     if (0 == r.width()) 
    126         srcRect.w = m_popup->w; 
    127     else 
    128         srcRect.w = static_cast<Uint16>(r.width()); 
    129     if (0 == r.height()) 
    130         srcRect.h = m_popup->h; 
    131     else 
    132         srcRect.h = static_cast<Uint16>(r.height()); 
    133  
    134  
    135     dstRect.x = static_cast<Sint16>(m_windowRect.x()); 
    136     dstRect.y = static_cast<Sint16>(m_windowRect.y()); 
    137     dstRect.w = static_cast<Sint16>(m_windowRect.width()); 
    138     dstRect.h = static_cast<Sint16>(m_windowRect.height()); 
    139  
    140     printf("srcRect %d %d %d %d\n", srcRect.x, srcRect.y, srcRect.h, srcRect.w); 
    141     printf("dstRect %d %d %d %d\n", dstRect.x, dstRect.y, dstRect.h, dstRect.w); 
    142     WebCore::Color c(255, 0, 0, 255); 
    143     SDL_FillRect(m_popup, &srcRect, c.rgb()); 
    144     SDL_BlitSurface(m_popup, &srcRect, v->containingWindow(), &dstRect); 
    145  
    146     if (client()) { 
    147         int index = client()->selectedIndex(); 
    148         if (index >= 0) 
    149             setFocusedIndex(index); 
    150     } 
    151     SDL_UpdateRect(v->containingWindow(), dstRect.x, dstRect.y, dstRect.w, dstRect.h); 
     94    OWBAL::BCObserverService::createBCObserverService()->notifyObserver("PopupMenuShow", "", this); 
    15295} 
    15396 
    15497int PopupMenu::focusedIndex() const 
     
    158101 
    159102bool PopupMenu::setFocusedIndex(int i, bool hotTracking) 
    160103{ 
    161     if (i < 0 || i >= client()->listSize() || i == focusedIndex()) 
    162         return false; 
    163  
    164     if (!client()->itemIsEnabled(i)) 
    165         return false; 
    166  
    167     invalidateItem(focusedIndex()); 
    168     invalidateItem(i); 
    169  
    170     m_focusedIndex = i; 
    171  
    172     if (!hotTracking) 
    173         client()->setTextFromItem(i); 
    174  
    175     if (!scrollToRevealSelection()) 
    176         SDL_UpdateRect(m_popup, 0, 0, m_popup->w, m_popup->h); 
    177  
    178104    return true; 
    179105} 
    180106 
    181107bool PopupMenu::scrollToRevealSelection() 
    182108{ 
    183     if (!m_scrollBar) 
    184         return false; 
    185  
    186     int index = focusedIndex(); 
    187  
    188     if (index < m_scrollOffset) { 
    189         m_scrollBar->setValue(index); 
    190         return true; 
    191     } 
    192  
    193     if (index >= m_scrollOffset + visibleItems()) { 
    194         m_scrollBar->setValue(index - visibleItems() + 1); 
    195         return true; 
    196     } 
    197  
    198     return false; 
     109    return true; 
    199110} 
    200111 
    201112void PopupMenu::hide() 
    202113{ 
    203     printf("PopupMenu::hide\n"); 
     114    OWBAL::BCObserverService::createBCObserverService()->notifyObserver("PopupMenuHide", "", this); 
    204115} 
    205116 
    206117void PopupMenu::updateFromElement() 
    207118{ 
    208     printf("PopupMenu::updateFromElement\n"); 
    209     client()->setTextFromItem(client()->selectedIndex()); 
    210119} 
    211120 
    212121bool PopupMenu::itemWritingDirectionIsNatural() 
    213122{ 
    214     //printf("PopupMenu::itemWritingDirectionIsNatural\n"); 
    215123    return false; 
    216124} 
    217125 
    218126void PopupMenu::menuItemActivated(BalMenuItem* item, PopupMenu* that) 
    219127{ 
    220     printf("PopupMenu::menuItemActivated\n"); 
    221128    ASSERT(that->client()); 
    222129 
    223130} 
    224131 
    225132void PopupMenu::menuUnmapped(BalWidget*, PopupMenu* that) 
    226133{ 
    227     printf("PopupMenu::menuUnmapped\n"); 
    228134    ASSERT(that->client()); 
    229135    that->client()->hidePopup(); 
    230136} 
    231137 
    232138void PopupMenu::menuPositionFunction(BalMenu*, int* x, int* y, bool* pushIn, PopupMenu* that) 
    233139{ 
    234     printf("PopupMenu::menuPositionFunction\n"); 
    235140    *x = that->m_menuPosition.x(); 
    236141    *y = that->m_menuPosition.y(); 
    237142    *pushIn = true; 
     
    239144 
    240145void PopupMenu::menuRemoveItem(BalWidget* widget, PopupMenu* that) 
    241146{ 
    242     printf("PopupMenu::menuRemoveItem\n"); 
    243147    ASSERT(that->m_popup); 
    244148 
    245149} 
    246150 
     151IntRect PopupMenu::windowRect() 
     152{ 
     153    return m_windowRect; 
     154} 
     155 
    247156const int endOfLinePadding = 2; 
    248157void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v) 
    249158{ 
    250     printf(" r = %d %d %d %d \n", r.x(), r.y(), r.width(), r.height()); 
    251     printf(" clientInsetLeft = %d clientInsetRight = %d clientPaddingLeft = %d clientPaddingRight = %d\n", client()->clientInsetLeft(), client()->clientInsetRight(), client()->clientPaddingLeft(), client()->clientPaddingRight()); 
    252     // r is in absolute document coordinates, but we want to be in screen coordinates 
    253  
    254     // First, move to WebView coordinates 
    255159    IntRect rScreenCoords(v->contentsToWindow(r.location()), r.size()); 
    256     printf("rScreenCoords %d %d %d %d\n", rScreenCoords.x(), rScreenCoords.y(), rScreenCoords.width(), rScreenCoords.height()); 
    257     // Then, translate to screen coordinates 
    258     //IntRect location(rScreenCoords.location()); 
    259     //if (!::ClientToScreen(v->containingWindow(), &location)) 
    260     //    return; 
    261  
    262     //rScreenCoords.setLocation(location); 
     160    rScreenCoords.setY(rScreenCoords.y() + rScreenCoords.height()); 
     161     
     162    m_itemHeight = rScreenCoords.height(); 
    263163 
    264     // First, determine the popup's height 
    265164    int itemCount = client()->listSize(); 
    266     m_itemHeight = client()->clientStyle()->font().height() + optionSpacingMiddle; 
    267165    int naturalHeight = m_itemHeight * itemCount; 
    268     int popupHeight = min(maxPopupHeight, naturalHeight); 
    269     // The popup should show an integral number of items (i.e. no partial items should be visible) 
    270     popupHeight -= popupHeight % m_itemHeight; 
    271      
    272     // Next determine its width 
     166 
    273167    int popupWidth = 0; 
    274168    for (int i = 0; i < itemCount; ++i) { 
    275169        String text = client()->itemText(i); 
     
    286180 
    287181        popupWidth = max(popupWidth, itemFont.width(TextRun(text.characters(), text.length()))); 
    288182    } 
     183     
     184    rScreenCoords.setHeight(naturalHeight); 
     185    rScreenCoords.setWidth(popupWidth + 10); 
    289186 
    290     if (naturalHeight > maxPopupHeight) 
    291         // We need room for a scrollbar 
    292         popupWidth += PlatformScrollbar::verticalScrollbarWidth(); 
    293  
    294     // Add padding to align the popup text with the <select> text 
    295     // Note: We can't add paddingRight() because that value includes the width 
    296     // of the dropdown button, so we must use our own endOfLinePadding constant. 
    297     popupWidth += max(0, endOfLinePadding - client()->clientInsetRight()) + max(0, client()->clientPaddingLeft() - client()->clientInsetLeft()); 
    298  
    299     // Leave room for the border 
    300     popupWidth += 2 * popupWindowBorderWidth; 
    301     popupHeight += 2 * popupWindowBorderWidth; 
    302  
    303     // The popup should be at least as wide as the control on the page 
    304     popupWidth = max(rScreenCoords.width() - client()->clientInsetLeft() - client()->clientInsetRight(), popupWidth); 
    305  
    306     // Always left-align items in the popup.  This matches popup menus on the mac. 
    307     int popupX = rScreenCoords.x() + client()->clientInsetLeft(); 
    308  
    309     IntRect popupRect(popupX, rScreenCoords.bottom(), popupWidth, popupHeight); 
    310  
    311     // The popup needs to stay within the bounds of the screen and not overlap any toolbars 
    312     FloatRect screen = screenAvailableRect(v); 
    313  
    314     // Check that we don't go off the screen vertically 
    315     if (popupRect.bottom() > screen.height()) { 
    316         // The popup will go off the screen, so try placing it above the client 
    317         if (rScreenCoords.y() - popupRect.height() < 0) { 
    318             // The popup won't fit above, either, so place it whereever's bigger and resize it to fit 
    319             if ((rScreenCoords.y() + rScreenCoords.height() / 2) < (screen.height() / 2)) { 
    320                 // Below is bigger 
    321                 popupRect.setHeight(static_cast<int>(screen.height() - popupRect.y())); 
    322             } else { 
    323                 // Above is bigger 
    324                 popupRect.setY(0); 
    325                 popupRect.setHeight(rScreenCoords.y()); 
    326             } 
    327         } else { 
    328             // The popup fits above, so reposition it 
    329             popupRect.setY(rScreenCoords.y() - popupRect.height()); 
    330         } 
    331     } 
    332  
    333     // Check that we don't go off the screen horizontally 
    334     if (popupRect.x() < screen.x()) { 
    335         popupRect.setWidth(static_cast<int>(popupRect.width() - (screen.x() - popupRect.x()))); 
    336         popupRect.setX(static_cast<int>(screen.x())); 
    337     } 
    338  
    339     m_windowRect = popupRect; 
    340         printf("m_windowRect %d %d %d %d\n", m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height()); 
    341     return; 
     187    m_windowRect = rScreenCoords; 
    342188} 
    343189 
    344190void PopupMenu::invalidateItem(int index) 
     
    376222 
    377223void PopupMenu::valueChanged(Scrollbar* scrollBar) 
    378224{ 
    379     printf("PopupMenu::valueChanged\n"); 
    380225} 
    381226 
    382227} 
  • BAL/WKAL/Concretizations/Widgets/SDL/BCPopupMenuSDL.h

    old new  
    6161    PopupMenuClient* client() const { return m_popupClient; } 
    6262 
    6363    static bool itemWritingDirectionIsNatural(); 
    64  
     64     
     65    IntRect windowRect(); 
    6566 
    6667protected: 
    6768    PopupMenu(PopupMenuClient* client); 
  • BAL/scripts/patches/FileSystemPosix.patch

    old new  
    1212+    return -1; 
    1313+} 
    1414+ 
    15 +CString fileSystemRepresentation(const String&
     15+CString fileSystemRepresentation(const String &file
    1616+{ 
    17 +    return ""
     17+    return file.utf8()
    1818+} 
    1919+ 
    2020+void closeFile(PlatformFileHandle&) 
     
    2828+ 
    2929+String homeDirectoryPath() 
    3030+{ 
    31 +    return ""
     31+    return getenv("HOME")
    3232+} 
    3333+ 
    3434+CString openTemporaryFile(const char* prefix, PlatformFileHandle&) 
  • BAL/scripts/patches/index.txt

    old new  
    2727../../Base/wtf/Platform.h       0:Platform.patch 
    2828../../WKAL/Concretizations/Graphics/Cairo/BCImageSourceCairo.cpp        0:ImageSourceCairo.patch 
    2929../../WKAL/Concretizations/Network/Curl/BCResourceHandleManagerCurl.cpp 0:ResourceHandleManager.patch 
     30../../OWBAL/Concretizations/Facilities/Posix/BCFileSystemPosix.cpp      0:FileSystemPosix.patch 
  • WebKit/ChangeLogOWB

    old new  
     12008-06-18  Mario Bensi  <mbensi@pleyo.com> 
     2 
     3        Reviewed by NOBODY (OOPS!). 
     4        add popup in WebViewPrivate 
     5 
     6        * OrigynWebBrowser/Api/SDL/WebViewPrivate.cpp: 
     7        (WebViewPrivate::onExpose): 
     8        (WebViewPrivate::popupMenuHide): 
     9        (WebViewPrivate::popupMenuShow): 
     10        * OrigynWebBrowser/Api/SDL/WebViewPrivate.h: 
     11        * OrigynWebBrowser/Api/WebView.cpp: 
     12        (WebView::WebView): 
     13        (WebView::close): 
     14        (WebView::stringByEvaluatingJavaScriptFromString): 
     15        (WebView::observe): 
     16        * OrigynWebBrowser/Api/gtk/WebViewPrivate.h: 
     17        (WebViewPrivate::popupMenuHide): 
     18        (WebViewPrivate::popupMenuShow): 
     19 
    1202008-06-16  Mario Bensi  <mbensi@pleyo.com> 
    221 
    322        Reviewed by odole@pleyo.com 
  • WebKit/OrigynWebBrowser/Api/WebView.cpp

    old new  
    231231    WebPreferences* sharedPreferences = WebPreferences::sharedStandardPreferences(); 
    232232    continuousSpellCheckingEnabled = sharedPreferences->continuousSpellCheckingEnabled(); 
    233233    grammarCheckingEnabled = sharedPreferences->grammarCheckingEnabled(); 
     234 
     235    OWBAL::BCObserverService::createBCObserverService()->registerObserver("PopupMenuShow", this); 
     236    OWBAL::BCObserverService::createBCObserverService()->registerObserver("PopupMenuHide", this); 
    234237    DS_CONSTRUCT(); 
    235238} 
    236239 
     
    468471    registerForIconNotification(false); 
    469472#endif 
    470473    OWBAL::BCObserverService::createBCObserverService()->removeObserver(WebPreferences::webPreferencesChangedNotification(), this); 
    471      
     474    OWBAL::BCObserverService::createBCObserverService()->removeObserver("PopupMenuShow", this); 
     475    OWBAL::BCObserverService::createBCObserverService()->removeObserver("PopupMenuHide", this); 
    472476    String identifier = m_preferences->identifier(); 
    473477    if (identifier != String()) 
    474478        WebPreferences::removeReferenceForIdentifier(identifier); 
     
    12761280    if (!coreFrame) 
    12771281        return String(); 
    12781282 
    1279     KJS::JSValue* scriptExecutionResult = coreFrame->loader()->executeScript(script, true); 
     1283    KJS::JSValue* scriptExecutionResult = coreFrame->loader()->executeScript(script, false); 
    12801284    if(!scriptExecutionResult) 
    12811285        return String(); 
    12821286    else if (scriptExecutionResult->isString()) { 
     
    18831887    if (topic == WebPreferences::webPreferencesChangedNotification()) 
    18841888        notifyPreferencesChanged(static_cast<WebPreferences*>(userData)); 
    18851889 
     1890    if (topic == "PopupMenuHide") 
     1891        d->popupMenuHide(); 
     1892    if (topic == "PopupMenuShow") { 
     1893        d->popupMenuShow(userData); 
     1894    } 
     1895 
    18861896} 
    18871897 
    18881898void WebView::notifyPreferencesChanged(WebPreferences* preferences) 
  • WebKit/OrigynWebBrowser/Api/SDL/WebViewPrivate.cpp

    old new  
    4040#include <PlatformWheelEvent.h> 
    4141#include "SelectionController.h" 
    4242#include "Editor.h" 
     43#include "owb-config.h" 
     44#include "PopupMenu.h" 
     45#include "CString.h" 
     46#include "File.h" 
    4347#include DEEPSEE_INCLUDE 
    4448 
    4549using namespace WebCore; 
     
    5963        frame->view()->adjustViewSize(); 
    6064    } 
    6165 
    62     //m_webView->page()->focusController()->setActive(frame); 
    63  
    6466    GraphicsContext ctx(m_webView->viewWindow()); 
    6567    ctx.setBalExposeEvent(&event); 
    6668    if (frame->contentRenderer() && frame->view() && !m_webView->dirtyRegion().isEmpty()) { 
    6769        frame->view()->layoutIfNeededRecursive(); 
    68         //frame->view()->paint(&ctx, m_webView->dirtyRegion()); 
    69         //printf("dirty region x=%d y=%d w=%d h=%d\n", 0 + m_webView->scrollOffset().x(), 0 + m_webView->scrollOffset().y(), 800, 600); 
    7070        IntRect dirty = m_webView->dirtyRegion(); 
    71         //frame->view()->paint(&ctx, IntRect(m_rect.x() + m_webView->scrollOffset().x(), m_rect.y() + m_webView->scrollOffset().y(), m_rect.width(), m_rect.height())); 
    7271        frame->view()->paint(&ctx, dirty); 
    73         //printf("dirty region x=%d y=%d w=%d h=%d\n", dirty.x(), dirty.y(), dirty.width(), dirty.height()); 
    74         //m_webView->addToDirtyRegion(IntRect(0, 0, 0, 0)); 
    75         if(dirty != m_webView->dirtyRegion()) 
    76             printf("AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\n"); 
    7772        m_webView->clearDirtyRegion(); 
    78         /* use SDL_Flip only if double buffering is available */ 
    79         //if (m_webView->viewWindow()->flags & SDL_DOUBLEBUF) 
    80         //    SDL_Flip(m_webView->viewWindow()); 
    81         //else 
    82         //    SDL_UpdateRect(m_webView->viewWindow(), m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height()); 
    83             //SDL_UpdateRect(m_webView->viewWindow(), dirty.x(), dirty.y(), dirty.width(), dirty.height()); 
    8473    } 
    8574} 
    8675 
     
    209198void WebViewPrivate::onUserEvent(BalUserEvent) 
    210199{ 
    211200} 
     201 
     202void WebViewPrivate::popupMenuHide() 
     203{ 
     204    //BOOKMARKLET_INSTALL_PATH 
     205} 
     206 
     207void WebViewPrivate::popupMenuShow(void *popupInfo) 
     208{ 
     209    PopupMenu *pop = static_cast<PopupMenu *>(popupInfo); 
     210    if (!pop) 
     211        return; 
     212    //printf("pop %d %d %d %d\n", pop->windowRect().x(), pop->windowRect().y(), pop->windowRect().width(), pop->windowRect().height()); 
     213    int itemCount = pop->client()->listSize(); 
     214 
     215    String tabIndex = "var myTabId1 = new Array("; 
     216    String tabName = "var myTabName1 = new Array("; 
     217    for (int i = 0; i < itemCount; ++i) { 
     218        String text = pop->client()->itemText(i); 
     219        if (text.isEmpty()) 
     220            continue; 
     221        if (i == 0) { 
     222            tabName += "\""; 
     223            tabIndex += "\""; 
     224        } else { 
     225            tabName += ", \""; 
     226            tabIndex += ", \""; 
     227        } 
     228 
     229        tabName += text; 
     230        tabName += "\""; 
     231        tabIndex += String::number(i+1); 
     232        tabIndex += "\""; 
     233    } 
     234    tabIndex += ");"; 
     235    tabName += ");"; 
     236    String path = BOOKMARKLET_INSTALL_PATH; 
     237    path +=  "popup.js"; 
     238 
     239    File *f = new File(path); 
     240    if (!f) 
     241        return; 
     242    if (f->open('r') == -1) 
     243        return ; 
     244    String buffer(f->read(f->getSize())); 
     245    f->close(); 
     246    delete f; 
     247 
     248    String callCreateTab = "createTabs(myTabId1 ,myTabName1 ,"; 
     249    callCreateTab += String::number(pop->windowRect().x()); 
     250    callCreateTab += ", "; 
     251    callCreateTab += String::number(pop->windowRect().y()); 
     252    callCreateTab += ", "; 
     253    callCreateTab += String::number(pop->windowRect().width()); 
     254    callCreateTab += ");"; 
     255 
     256    buffer = buffer.replace("@TabIndexDefinition", tabIndex); 
     257    buffer = buffer.replace("@TabNameDefinition", tabName); 
     258    buffer = buffer.replace("@callCreateTab", callCreateTab); 
    212259     
     260//    printf("popup = %s \n", buffer.utf8().data()); 
     261 
     262    m_webView->stringByEvaluatingJavaScriptFromString(buffer); 
     263} 
  • WebKit/OrigynWebBrowser/Api/SDL/WebViewPrivate.h

    old new  
    8686    void onResize(BalResizeEvent event); 
    8787    void onQuit(BalQuitEvent); 
    8888    void onUserEvent(BalUserEvent); 
    89      
     89    void popupMenuHide(); 
     90    void popupMenuShow(void *popupInfo); 
    9091private: 
    9192    WebCore::IntRect m_rect; 
    9293    WebView *m_webView; 
  • WebKit/OrigynWebBrowser/Api/gtk/WebViewPrivate.h

    old new  
    9393    void onResize(BalResizeEvent){} 
    9494    void onQuit(BalQuitEvent){} 
    9595    void onUserEvent(BalUserEvent){} 
     96    void popupMenuHide() {} 
     97    void popupMenuShow(void *popupInfo) {} 
    9698private: 
    9799    WebCore::IntRect m_rect; 
    98100    GtkWidget *m_view; 
  • WebKitTools/ChangeLogOWB

    old new  
     12008-06-18  Mario Bensi  <mbensi@pleyo.com> 
     2 
     3        Reviewed by NOBODY (OOPS!). 
     4        fix Database 
     5 
     6        * OWBLauncher/SDL/main.cpp: 
     7        (waitEvent): 
     8 
    192008-06-16  Mario Bensi  <mbensi@pleyo.com> 
    210 
    311        Reviewed by odole@pleyo.com 
  • WebKitTools/OWBLauncher/SDL/main.cpp

    old new  
    3939#include "SDL.h" 
    4040#include "Timer.h" 
    4141#include "SharedTimer.h" 
    42  
     42#include "MainThread.h" 
    4343#include <unistd.h> 
    4444 
    4545using namespace WebCore; 
     
    174174                    ;//printf("other event\n"); 
    175175            } 
    176176        } else { 
     177            WTF::dispatchFunctionsFromMainThread(); 
    177178            WebCore::fireTimerIfNeeded(); 
    178179            usleep(10000); 
    179180        }