Reviewed by Adele.
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2006 21:33:07 +0000 (21:33 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2006 21:33:07 +0000 (21:33 +0000)
        Remove no-longer-used PopUpButton.

        * WebCore.vcproj/WebCore/WebCore.vcproj: Remove PopUpButton.h
        * WebCore.xcodeproj/project.pbxproj: Remove PopUpButton.h,
PopUpButtonMac.mm
        * platform/PopUpButton.h: Removed.
        * platform/mac/PopUpButtonMac.mm: Removed.
        * platform/win/TemporaryLinkStubs.cpp: Remove PopUpButton:: methods
        * rendering/DeprecatedRenderSelect.cpp: Change #include of
PopUpButton.h to ListBox.h

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16624 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/PopUpButton.h [deleted file]
WebCore/platform/mac/PopUpButtonMac.mm [deleted file]
WebCore/platform/win/TemporaryLinkStubs.cpp
WebCore/rendering/DeprecatedRenderSelect.cpp

index 1601de183b87f77ea993e61e2db82f0e925abe20..cb2772383099f94e436d9f7b2dec18725fa89fc4 100644 (file)
@@ -1,3 +1,18 @@
+2006-09-28  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Adele.
+
+        Remove no-longer-used PopUpButton.
+
+        * WebCore.vcproj/WebCore/WebCore.vcproj: Remove PopUpButton.h
+        * WebCore.xcodeproj/project.pbxproj: Remove PopUpButton.h,
+        PopUpButtonMac.mm
+        * platform/PopUpButton.h: Removed.
+        * platform/mac/PopUpButtonMac.mm: Removed.
+        * platform/win/TemporaryLinkStubs.cpp: Remove PopUpButton:: methods
+        * rendering/DeprecatedRenderSelect.cpp: Change #include of
+        PopUpButton.h to ListBox.h
+
 2006-09-28  Darin Adler  <darin@apple.com>
 
         Reviewed by Alice.
index e0715eca3baa0af18996f8025eacb461334e70ab..7a0a542cb05a2ea51e91d4ca1812c6a2c79136a5 100644 (file)
                                RelativePath="..\..\platform\PlugInInfoStore.h"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\platform\PopUpButton.h"
-                               >
-                       </File>
                        <File
                                RelativePath="..\..\platform\RegularExpression.cpp"
                                >
                                        RelativePath="..\..\platform\win\GlyphMapWin.cpp"
                                        >
                                </File>
-                                <File
-                                        RelativePath="..\..\platform\win\GraphicsContextWin.cpp"
-                                        >
-                                </File>
+                               <File
+                                       RelativePath="..\..\platform\win\GraphicsContextWin.cpp"
+                                       >
+                               </File>
                                <File
                                        RelativePath="..\..\platform\win\ImageWin.cpp"
                                        >
                                RelativePath="..\..\css\CSSComputedStyleDeclaration.h"
                                >
                        </File>
-                        <File
-                                RelativePath="..\..\css\CSSCursorImageValue.cpp"
-                                >
-                        </File>
-                        <File
-                                RelativePath="..\..\css\CSSCursorImageValue.h"
-                                >
-                        </File>
+                       <File
+                               RelativePath="..\..\css\CSSCursorImageValue.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\css\CSSCursorImageValue.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\css\CSSFontFaceRule.cpp"
                                >
index 2559d61164c83e119cdd16baaf49ecd7b92c967c..d34b5997f16565f81d7f54cf8416dc8b48949db9 100644 (file)
                93F1991808245E59001E9ABC /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30402DE4476018635CA /* Range.h */; };
                93F1992108245E59001E9ABC /* XMLTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* XMLTokenizer.h */; };
                93F1992908245E59001E9ABC /* DeprecatedCString.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868302DE3B8601EA4122 /* DeprecatedCString.h */; };
-               93F1992E08245E59001E9ABC /* PopUpButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868202DE3B8601EA4122 /* PopUpButton.h */; };
                93F1992F08245E59001E9ABC /* Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868402DE3B8601EA4122 /* Cursor.h */; };
                93F1994F08245E59001E9ABC /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = F587863A02DE3A1401EA4122 /* Settings.h */; };
                93F1995008245E59001E9ABC /* CachePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F587864902DE3A9A01EA4122 /* CachePolicy.h */; };
                93F19A0908245E59001E9ABC /* southWestResizeCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 84C0FA2C052B966D000440A1 /* southWestResizeCursor.tiff */; };
                93F19A0A08245E59001E9ABC /* waitCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 84C0FA2D052B966D000440A1 /* waitCursor.tiff */; };
                93F19A0B08245E59001E9ABC /* westResizeCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 84C0FA2E052B966D000440A1 /* westResizeCursor.tiff */; };
-               93F19A1708245E59001E9ABC /* PopUpButtonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784D202DE375901EA4122 /* PopUpButtonMac.mm */; };
                93F19A1808245E59001E9ABC /* DeprecatedCString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784D502DE375901EA4122 /* DeprecatedCString.cpp */; };
                93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784F002DE375901EA4122 /* CursorMac.mm */; };
                93F19A2E08245E59001E9ABC /* JavaAppletWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784FF02DE375901EA4122 /* JavaAppletWidget.mm */; };
                F56234E003026D7301629B47 /* WebCoreEncodings.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreEncodings.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F565AE8502ECA583018635CA /* WebCoreSettings.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreSettings.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F565AE8602ECA583018635CA /* WebCoreSettings.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSettings.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F58784D202DE375901EA4122 /* PopUpButtonMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PopUpButtonMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F58784D502DE375901EA4122 /* DeprecatedCString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedCString.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F58784F002DE375901EA4122 /* CursorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CursorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F58784FF02DE375901EA4122 /* JavaAppletWidget.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JavaAppletWidget.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587864502DE3A7701EA4122 /* JavaAppletWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JavaAppletWidget.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587864902DE3A9A01EA4122 /* CachePolicy.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = CachePolicy.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = SSLKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F587868202DE3B8601EA4122 /* PopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PopUpButton.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587868302DE3B8601EA4122 /* DeprecatedCString.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedCString.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587868402DE3B8601EA4122 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587869802DE3B8601EA4122 /* TextField.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextField.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
                                BC3FCAA80AC3DB5800BA54AD /* PlatformScrollBar.h */,
                                A82398A709B3ACF500B60641 /* PlugInInfoStoreMac.mm */,
-                               F58784D202DE375901EA4122 /* PopUpButtonMac.mm */,
                                6582A15409999D6D00BEEB6D /* ScreenMac.mm */,
                                BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */,
                                BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */,
                                93CD4FEB0995FD2A007ECC97 /* PlatformString.h */,
                                935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */,
                                A82398A509B3ACDB00B60641 /* PlugInInfoStore.h */,
-                               F587868202DE3B8601EA4122 /* PopUpButton.h */,
                                F587852B02DE375901EA4122 /* RegularExpression.cpp */,
                                F58786B302DE3B8601EA4122 /* RegularExpression.h */,
                                6545F66C09B82FED0013006F /* ResourceLoader.cpp */,
                                93F1991808245E59001E9ABC /* Range.h in Headers */,
                                93F1992108245E59001E9ABC /* XMLTokenizer.h in Headers */,
                                93F1992908245E59001E9ABC /* DeprecatedCString.h in Headers */,
-                               93F1992E08245E59001E9ABC /* PopUpButton.h in Headers */,
                                93F1992F08245E59001E9ABC /* Cursor.h in Headers */,
                                93F1994F08245E59001E9ABC /* Settings.h in Headers */,
                                93F1995008245E59001E9ABC /* CachePolicy.h in Headers */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               93F19A1708245E59001E9ABC /* PopUpButtonMac.mm in Sources */,
                                93F19A1808245E59001E9ABC /* DeprecatedCString.cpp in Sources */,
                                93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */,
                                93F19A2E08245E59001E9ABC /* JavaAppletWidget.mm in Sources */,
diff --git a/WebCore/platform/PopUpButton.h b/WebCore/platform/PopUpButton.h
deleted file mode 100644 (file)
index 0543089..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef PopUpButton_h
-#define PopUpButton_h
-
-#include "ListBox.h"
-
-#ifdef __OBJC__
-@class WebCorePopUpButtonAdapter;
-#else
-class WebCorePopUpButtonAdapter;
-class NSMenuItem;
-class NSFont;
-#endif
-
-namespace WebCore {
-
-class PopUpButton : public Widget {
-public:  
-    PopUpButton();
-    ~PopUpButton();
-    
-    void clear();
-    void appendItem(const DeprecatedString& text, bool enabled) { appendItem(text, ListBoxOption, enabled); }
-    void appendGroupLabel(const DeprecatedString& text) { appendItem(text, ListBoxGroupLabel, false); }
-    void appendSeparator() { appendItem(DeprecatedString::null, ListBoxSeparator, true); }
-
-    int currentItem() const { return _currentItem; }
-    void setCurrentItem(int);
-    
-    IntSize sizeHint() const;
-    IntRect frameGeometry() const;
-    void setFrameGeometry(const IntRect&);
-    int baselinePosition(int height) const;
-    void setFont(const Font&);
-
-    void itemSelected();
-    
-    virtual FocusPolicy focusPolicy() const;
-
-    void setWritingDirection(TextDirection);
-
-    virtual void populate();
-    void populateMenu();
-    
-private:
-    void appendItem(const DeprecatedString&, ListBoxItemType, bool);
-    const int* dimensions() const;
-    NSFont* labelFont() const;
-    void setTitle(NSMenuItem*, const ListBoxItem&);
-    
-    mutable int _width;
-    mutable bool _widthGood;
-
-    mutable int _currentItem;
-
-    // A Vector<ListBoxItem> may be more efficient for large menus.
-    DeprecatedValueList<ListBoxItem> _items;
-    mutable bool _menuPopulated;
-
-    mutable NSFont *_labelFont;
-};
-
-}
-
-#endif
diff --git a/WebCore/platform/mac/PopUpButtonMac.mm b/WebCore/platform/mac/PopUpButtonMac.mm
deleted file mode 100644 (file)
index fe6e7b1..0000000
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import "config.h"
-#import "PopUpButton.h"
-
-#import "BlockExceptions.h"
-#import "Font.h"
-#import "FontData.h"
-#import "FoundationExtras.h"
-#import "FrameMac.h"
-#import "RenderView.h"
-#import "RenderWidget.h"
-#import "TextField.h"
-#import "TextStyle.h"
-#import "WebCoreFrameBridge.h"
-#import "WebCoreWidgetHolder.h"
-#import "WidgetClient.h"
-
-using namespace WebCore;
-
-@interface NSCell (WebCorePopUpButtonKnowsAppKitSecrets)
-- (NSMutableDictionary *)_textAttributes;
-@end
-
-enum {
-    topMargin,
-    bottomMargin,
-    leftMargin,
-    rightMargin,
-    baselineFudgeFactor,
-    widthNotIncludingText,
-    minimumTextWidth
-};
-
-@interface WebCorePopUpButtonCell : NSPopUpButtonCell <WebCoreWidgetHolder>
-{
-    PopUpButton *box;
-    NSWritingDirection baseWritingDirection;
-}
-- (id)initWithQComboBox:(PopUpButton *)b;
-- (void)detachQComboBox;
-- (void)setBaseWritingDirection:(NSWritingDirection)direction;
-- (NSWritingDirection)baseWritingDirection;
-@end
-
-@interface WebCorePopUpButton : NSPopUpButton <WebCoreWidgetHolder>
-{
-    BOOL inNextValidKeyView;
-    BOOL populatingMenu;
-}
-- (void)setPopulatingMenu:(BOOL)populating;
-
-@end
-
-PopUpButton::PopUpButton()
-    : _widthGood(false)
-    , _currentItem(0)
-    , _menuPopulated(true)
-    , _labelFont(nil)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = [[WebCorePopUpButton alloc] init];
-    setView(button);
-    [button release];
-    
-    WebCorePopUpButtonCell *cell = [[WebCorePopUpButtonCell alloc] initWithQComboBox:this];
-    // Work around problem where the pop-up menu gets a "..." in it
-    // by turning off the default "ellipsizing" behavior.
-    [cell setLineBreakMode:NSLineBreakByClipping];
-    [button setCell:cell];
-    [cell release];
-
-    [button setTarget:button];
-    [button setAction:@selector(action:)];
-
-    [[button cell] setControlSize:NSSmallControlSize];
-    [button setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
-    [button setAutoenablesItems:NO];
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-PopUpButton::~PopUpButton()
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    [button setTarget:nil];
-    [[button cell] detachQComboBox];
-    HardRelease(_labelFont);
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void PopUpButton::setTitle(NSMenuItem *menuItem, const ListBoxItem &title)
-{
-    if (title.type == ListBoxGroupLabel) {
-        NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:labelFont(), NSFontAttributeName, nil];
-        NSAttributedString *string = [[NSAttributedString alloc] initWithString:title.string.getNSString() attributes:attributes];
-        [menuItem setAttributedTitle:string];
-        [string release];
-        [attributes release];
-        [menuItem setEnabled:NO];
-    } else {
-        [menuItem setTitle:title.string.getNSString()];
-        [menuItem setEnabled:title.enabled];
-    }    
-}
-
-void PopUpButton::appendItem(const DeprecatedString &text, ListBoxItemType type, bool enabled)
-{
-    const ListBoxItem listItem(text, type, enabled);
-    _items.append(listItem);
-    if (_menuPopulated) {
-        WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-        if (![[button cell] isHighlighted]) {
-            _menuPopulated = false;
-        } else {
-            BEGIN_BLOCK_OBJC_EXCEPTIONS;
-            if (type == ListBoxSeparator) {
-                NSMenuItem *separator = [NSMenuItem separatorItem];
-                [[button menu] addItem:separator];
-            } else {
-                // We must add the item with no title and then set the title because
-                // addItemWithTitle does not allow duplicate titles.
-                [button addItemWithTitle:@""];
-                NSMenuItem *menuItem = [button lastItem];
-                setTitle(menuItem, listItem);
-            }
-            END_BLOCK_OBJC_EXCEPTIONS;
-        }
-    }
-    _widthGood = false;
-}
-
-IntSize PopUpButton::sizeHint() const 
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    
-    if (!_widthGood) {
-        float width = 0;
-        DeprecatedValueListConstIterator<ListBoxItem> i = const_cast<const DeprecatedValueList<ListBoxItem> &>(_items).begin();
-        DeprecatedValueListConstIterator<ListBoxItem> e = const_cast<const DeprecatedValueList<ListBoxItem> &>(_items).end();
-        if (i != e) {
-            RenderWidget *client = static_cast<RenderWidget *>(Widget::client());
-            bool isPrinting = client->view()->printingMode();
-            FontPlatformData itemFont([button font]);
-            FontPlatformData labelFont(this->labelFont());
-            Font itemRenderer(itemFont, isPrinting);
-            Font labelRenderer(labelFont, isPrinting);
-            do {
-                const DeprecatedString &s = (*i).string;
-                bool isGroupLabel = ((*i).type == ListBoxGroupLabel);
-                ++i;
-
-                TextRun run(reinterpret_cast<const UniChar *>(s.unicode()), s.length());
-                TextStyle style;
-                style.disableRoundingHacks();
-                Font* renderer = isGroupLabel ? &labelRenderer : &itemRenderer;
-                float textWidth = renderer->floatWidth(run, style);
-                width = max(width, textWidth);
-            } while (i != e);
-        }
-        _width = max(static_cast<int>(ceilf(width)), dimensions()[minimumTextWidth]);
-        _widthGood = true;
-    }
-    
-    return IntSize(_width + dimensions()[widthNotIncludingText],
-        static_cast<int>([[button cell] cellSize].height) - (dimensions()[topMargin] + dimensions()[bottomMargin]));
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return IntSize(0, 0);
-}
-
-IntRect PopUpButton::frameGeometry() const
-{
-    IntRect r = Widget::frameGeometry();
-    return IntRect(r.x() + dimensions()[leftMargin], r.y() + dimensions()[topMargin],
-        r.width() - (dimensions()[leftMargin] + dimensions()[rightMargin]),
-        r.height() - (dimensions()[topMargin] + dimensions()[bottomMargin]));
-}
-
-void PopUpButton::setFrameGeometry(const IntRect& r)
-{
-    Widget::setFrameGeometry(IntRect(-dimensions()[leftMargin] + r.x(), -dimensions()[topMargin] + r.y(),
-        dimensions()[leftMargin] + r.width() + dimensions()[rightMargin],
-        dimensions()[topMargin] + r.height() + dimensions()[bottomMargin]));
-}
-
-int PopUpButton::baselinePosition(int height) const
-{
-    // Menu text is at the top.
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    return static_cast<int>(ceilf(-dimensions()[topMargin] + dimensions()[baselineFudgeFactor] + [[button font] ascender]));
-}
-
-void PopUpButton::clear()
-{
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    [button removeAllItems];
-    _widthGood = false;
-    _currentItem = 0;
-    _items.clear();
-    _menuPopulated = true;
-}
-
-void PopUpButton::setCurrentItem(int index)
-{
-    ASSERT(index < (int)_items.count());
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    if (_menuPopulated) {
-        [button selectItemAtIndex:index];
-    } else {
-        [button removeAllItems];
-        [button addItemWithTitle:@""];
-        NSMenuItem *menuItem = [button itemAtIndex:0];
-        setTitle(menuItem, _items[index]);
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    _currentItem = index;
-}
-
-void PopUpButton::itemSelected()
-{
-    ASSERT(_menuPopulated);
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = (WebCorePopUpButton *)getView();
-    int i = [button indexOfSelectedItem];
-    if (_currentItem == i) {
-        return;
-    }
-    _currentItem = i;
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    if (client())
-        client()->valueChanged(this);
-}
-
-void PopUpButton::setFont(const Font& f)
-{
-    Widget::setFont(f);
-
-    const NSControlSize size = ControlSizeForFont(f);
-    NSControl * const button = static_cast<NSControl *>(getView());
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    if (size != [[button cell] controlSize]) {
-        [[button cell] setControlSize:size];
-        [button setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
-        HardRelease(_labelFont);
-        _labelFont = nil;
-        _widthGood = false;
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-NSFont *PopUpButton::labelFont() const
-{
-    if (_labelFont == nil) {
-        NSControl * const button = static_cast<NSControl *>(getView());
-        _labelFont = HardRetain([NSFont boldSystemFontOfSize:[[button font] pointSize]]);
-    }
-    return _labelFont;
-}
-
-const int *PopUpButton::dimensions() const
-{
-    // We empirically determined these dimensions.
-    // It would be better to get this info from AppKit somehow.
-    static const int w[3][7] = {
-        { 2, 3, 3, 3, 4, 34, 9 },
-        { 1, 3, 3, 3, 3, 31, 5 },
-        { 0, 0, 1, 1, 2, 32, 0 }
-    };
-    NSControl * const button = static_cast<NSControl *>(getView());
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    return  w[[[button cell] controlSize]];
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return w[NSSmallControlSize];
-}
-
-Widget::FocusPolicy PopUpButton::focusPolicy() const
-{
-    FocusPolicy policy = Widget::focusPolicy();
-    return policy == TabFocus ? StrongFocus : policy;
-}
-
-void PopUpButton::setWritingDirection(TextDirection direction)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    WebCorePopUpButton *button = static_cast<WebCorePopUpButton *>(getView());
-    WebCorePopUpButtonCell *cell = [button cell];
-    NSWritingDirection d = direction == RTL ? NSWritingDirectionRightToLeft : NSWritingDirectionLeftToRight;
-    if ([cell baseWritingDirection] != d) {
-        [cell setBaseWritingDirection:d];
-        [button setNeedsDisplay:YES];
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void PopUpButton::populateMenu()
-{
-    if (!_menuPopulated) {
-        BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-        WebCorePopUpButton *button = static_cast<WebCorePopUpButton *>(getView());
-        [button setPopulatingMenu:YES];
-        [button removeAllItems];
-        DeprecatedValueListConstIterator<ListBoxItem> i = const_cast<const DeprecatedValueList<ListBoxItem> &>(_items).begin();
-        DeprecatedValueListConstIterator<ListBoxItem> e = const_cast<const DeprecatedValueList<ListBoxItem> &>(_items).end();
-        for (; i != e; ++i) {
-            if ((*i).type == ListBoxSeparator) {
-                NSMenuItem *separator = [NSMenuItem separatorItem];
-                [[button menu] addItem:separator];
-            } else {
-                // We must add the item with no title and then set the title because
-                // addItemWithTitle does not allow duplicate titles.
-                [button addItemWithTitle:@""];
-                NSMenuItem *menuItem = [button lastItem];
-                setTitle(menuItem, *i);
-            }
-        }
-        [button selectItemAtIndex:_currentItem];
-        [button setPopulatingMenu:NO];
-
-        END_BLOCK_OBJC_EXCEPTIONS;
-
-        _menuPopulated = true;
-    }
-}
-
-void PopUpButton::populate()
-{
-    populateMenu();
-}
-
-@implementation WebCorePopUpButtonCell
-
-- (id)initWithQComboBox:(PopUpButton *)b
-{
-    box = b;
-    return [super init];
-}
-
-- (void)detachQComboBox
-{
-    box = 0;
-}
-
-- (BOOL)trackMouse:(NSEvent *)event inRect:(NSRect)rect ofView:(NSView *)view untilMouseUp:(BOOL)flag
-{
-    WebCoreFrameBridge *bridge = box ? [FrameMac::bridgeForWidget(box) retain] : nil;
-
-    // we need to retain the event because it is the [NSApp currentEvent], which can change
-    // and therefore be released during [super trackMouse:...]
-    [event retain];
-    BOOL result = [super trackMouse:event inRect:rect ofView:view untilMouseUp:flag];
-    if (result && bridge) {
-        // Give KHTML a chance to fix up its event state, since the popup eats all the
-        // events during tracking.  [NSApp currentEvent] is still the original mouseDown
-        // at this point!
-        [bridge impl]->sendFakeEventsAfterWidgetTracking(event);
-    }
-    [event release];
-    [bridge release];
-    return result;
-}
-
-- (Widget *)widget
-{
-    return box;
-}
-
-- (void)setBaseWritingDirection:(NSWritingDirection)direction
-{
-    baseWritingDirection = direction;
-}
-
-- (NSWritingDirection)baseWritingDirection
-{
-    return baseWritingDirection;
-}
-
-- (NSMutableDictionary *)_textAttributes
-{
-    NSMutableDictionary *attributes = [super _textAttributes];
-    NSParagraphStyle *style = [attributes objectForKey:NSParagraphStyleAttributeName];
-    ASSERT(style != nil);
-    if ([style baseWritingDirection] != baseWritingDirection) {
-        NSMutableParagraphStyle *mutableStyle = [style mutableCopy];
-        [mutableStyle setBaseWritingDirection:baseWritingDirection];
-        [attributes setObject:mutableStyle forKey:NSParagraphStyleAttributeName];
-        [mutableStyle release];
-    }
-    return attributes;
-}
-
-- (void)setHighlighted:(BOOL)highlighted
-{
-    if (highlighted && box) {
-        box->populateMenu();
-    }
-    [super setHighlighted:highlighted];
-}
-
-@end
-
-@implementation WebCorePopUpButton
-
-- (void)action:(id)sender
-{
-    PopUpButton *box = static_cast<PopUpButton *>([self widget]);
-    if (box) {
-        box->itemSelected();
-    }
-}
-
-- (Widget *)widget
-{
-    return [[self cell] widget];
-}
-
-- (void)mouseDown:(NSEvent *)event
-{
-    Widget::beforeMouseDown(self);
-    [super mouseDown:event];
-    Widget::afterMouseDown(self);
-}
-
-- (BOOL)becomeFirstResponder
-{
-    BOOL become = [super becomeFirstResponder];
-    if (become) {
-        Widget* widget = [self widget];
-        if (widget && widget->client() && !FrameMac::currentEventIsMouseDownInWidget(widget))
-            widget->client()->scrollToVisible(widget);
-        if (widget && widget->client()) {
-            widget->client()->focusIn(widget);
-            [FrameMac::bridgeForWidget(widget) formControlIsBecomingFirstResponder:self];
-        }
-    }
-    return become;
-}
-
-- (BOOL)resignFirstResponder
-{
-    BOOL resign = [super resignFirstResponder];
-    if (resign) {
-        Widget* widget = [self widget];
-        if (widget && widget->client()) {
-            widget->client()->focusOut(widget);
-            [FrameMac::bridgeForWidget(widget) formControlIsResigningFirstResponder:self];
-        }
-    }
-    return resign;
-}
-
-- (BOOL)needsPanelToBecomeKey
-{
-    // override this NSView method so that <select> elements gain focus when clicked - 4011544
-    return YES;
-}
-
-- (BOOL)canBecomeKeyView
-{
-    // Simplified method from NSView; overridden to replace NSView's way of checking
-    // for full keyboard access with ours.
-    return ([self window] != nil) && ![self isHiddenOrHasHiddenAncestor] && [self acceptsFirstResponder];
-}
-
-- (NSView *)nextKeyView
-{
-    Widget *widget = [self widget];
-    return widget && inNextValidKeyView
-        ? FrameMac::nextKeyViewForWidget(widget, SelectingNext)
-        : [super nextKeyView];
-}
-
-- (NSView *)previousKeyView
-{
-    Widget *widget = [self widget];
-    return widget && inNextValidKeyView
-        ? FrameMac::nextKeyViewForWidget(widget, SelectingPrevious)
-        : [super previousKeyView];
-}
-
-- (NSView *)nextValidKeyView
-{
-    inNextValidKeyView = YES;
-    NSView *view = [super nextValidKeyView];
-    inNextValidKeyView = NO;
-    return view;
-}
-
-- (NSView *)previousValidKeyView
-{
-    inNextValidKeyView = YES;
-    NSView *view = [super previousValidKeyView];
-    inNextValidKeyView = NO;
-    return view;
-}
-
-- (void)setPopulatingMenu:(BOOL)populating
-{
-    populatingMenu = populating;
-}
-
-- (void)setNeedsDisplayInRect:(NSRect)rect
-{
-    if (!populatingMenu) {
-        [super setNeedsDisplayInRect:rect];
-    }
-}
-
-@end
index cab2d780de0f9599abefe394506b6f4c09aa2a26..e75929acb391c6a84dc0fde3c740a0271e0e6da8 100644 (file)
@@ -35,7 +35,7 @@
 #include "TextField.h"
 #include "FileChooser.h"
 #include "Font.h"
-#include "PopUpButton.h"
+#include "ListBox.h"
 #include "IntPoint.h"
 #include "Widget.h"
 #include "GraphicsContext.h"
@@ -79,9 +79,6 @@ using namespace WebCore;
 
 void FrameView::updateBorder() { notImplemented(); }
 
-Widget::FocusPolicy PopUpButton::focusPolicy() const { notImplemented(); return NoFocus; }
-void PopUpButton::populate() { notImplemented(); }
-
 void Widget::enableFlushDrawing() { notImplemented(); }
 bool Widget::isEnabled() const { notImplemented(); return 0; }
 Widget::FocusPolicy Widget::focusPolicy() const { notImplemented(); return NoFocus; }
@@ -331,18 +328,6 @@ IntSize TextField::sizeForCharacterWidth(int) const { return IntSize(); }
 int TextField::baselinePosition(int) const { return 0; }
 void TextField::setLiveSearch(bool) { }
 
-PopUpButton::PopUpButton() { }
-PopUpButton::~PopUpButton() { }
-void PopUpButton::setFont(WebCore::Font const&) { }
-int PopUpButton::baselinePosition(int) const { return 0; }
-void PopUpButton::setWritingDirection(TextDirection) { }
-void PopUpButton::clear() { }
-void PopUpButton::appendItem(DeprecatedString const&,ListBoxItemType,bool) { }
-void PopUpButton::setCurrentItem(int) { }
-IntSize PopUpButton::sizeHint() const { return IntSize(); }
-IntRect PopUpButton::frameGeometry() const { return IntRect(); }
-void PopUpButton::setFrameGeometry(IntRect const&) { }
-
 PlatformScrollBar::PlatformScrollBar(ScrollBarClient* client, ScrollBarOrientation orientation) : ScrollBar(client, orientation) { }
 PlatformScrollBar::~PlatformScrollBar() { }
 int PlatformScrollBar::width() const { return 0; }
index c393f52ca23a605f449c04cd37273937f299f53a..a02731a1f8e75391a272e41f72071e2468db700d 100644 (file)
@@ -30,7 +30,7 @@
 #include "HTMLOptGroupElement.h"
 #include "HTMLOptionElement.h"
 #include "HTMLSelectElement.h"
-#include "PopUpButton.h"
+#include "ListBox.h"
 
 using std::min;