Reviewed by Oliver.
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Nov 2006 00:35:26 +0000 (00:35 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Nov 2006 00:35:26 +0000 (00:35 +0000)
        Removed DeprecatedRenderSelect and ListBox classes.

        * WebCore.xcodeproj/project.pbxproj:
        * css/html4.css:
        * html/HTMLOptionElement.h:
        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::recalcStyle):
        (WebCore::HTMLSelectElement::isKeyboardFocusable):
        (WebCore::HTMLSelectElement::isMouseFocusable):
        (WebCore::HTMLSelectElement::createRenderer):
        (WebCore::HTMLSelectElement::setRecalcListItems):
        (WebCore::HTMLSelectElement::notifyOptionSelected):
        (WebCore::HTMLSelectElement::defaultEventHandler):
        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
        (WebCore::HTMLSelectElement::updateListBoxSelection):
        * html/HTMLSelectElement.h:
        * platform/ListBox.h: Removed.
        * platform/mac/FontCacheMac.mm:
        * platform/mac/ListBoxMac.mm: Removed.
        * platform/win/TemporaryLinkStubs.cpp:
        * rendering/DeprecatedRenderSelect.cpp: Removed.
        * rendering/DeprecatedRenderSelect.h: Removed.

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

12 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/html4.css
WebCore/html/HTMLOptionElement.h
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLSelectElement.h
WebCore/platform/ListBox.h [deleted file]
WebCore/platform/mac/FontCacheMac.mm
WebCore/platform/mac/ListBoxMac.mm [deleted file]
WebCore/platform/win/TemporaryLinkStubs.cpp
WebCore/rendering/DeprecatedRenderSelect.cpp [deleted file]
WebCore/rendering/DeprecatedRenderSelect.h [deleted file]

index fca52f0..94a7ca1 100644 (file)
@@ -1,3 +1,30 @@
+2006-11-03  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Oliver.
+
+        Removed DeprecatedRenderSelect and ListBox classes.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/html4.css:
+        * html/HTMLOptionElement.h:
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::recalcStyle):
+        (WebCore::HTMLSelectElement::isKeyboardFocusable):
+        (WebCore::HTMLSelectElement::isMouseFocusable):
+        (WebCore::HTMLSelectElement::createRenderer):
+        (WebCore::HTMLSelectElement::setRecalcListItems):
+        (WebCore::HTMLSelectElement::notifyOptionSelected):
+        (WebCore::HTMLSelectElement::defaultEventHandler):
+        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
+        (WebCore::HTMLSelectElement::updateListBoxSelection):
+        * html/HTMLSelectElement.h:
+        * platform/ListBox.h: Removed.
+        * platform/mac/FontCacheMac.mm:
+        * platform/mac/ListBoxMac.mm: Removed.
+        * platform/win/TemporaryLinkStubs.cpp:
+        * rendering/DeprecatedRenderSelect.cpp: Removed.
+        * rendering/DeprecatedRenderSelect.h: Removed.
+
 2006-11-03  Maciej Stachowiak  <mjs@apple.com>
 
         Not reviewed, fix for accidental commit.
index f3e3e3f..92982fd 100644 (file)
                93F1995008245E59001E9ABC /* CachePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F587864902DE3A9A01EA4122 /* CachePolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1996308245E59001E9ABC /* SSLKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */; };
                93F1996B08245E59001E9ABC /* TextField.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869802DE3B8601EA4122 /* TextField.h */; };
-               93F1996C08245E59001E9ABC /* ListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851302DE375901EA4122 /* ListBox.h */; };
                93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851702DE375901EA4122 /* LoaderFunctions.h */; };
                93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394E0A403AA5BBE008635CE /* WebCorePageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784F002DE375901EA4122 /* CursorMac.mm */; };
                93F19A3108245E59001E9ABC /* LoaderFunctionsMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587850302DE375901EA4122 /* LoaderFunctionsMac.mm */; };
                93F19A3A08245E59001E9ABC /* TextFieldMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587851202DE375901EA4122 /* TextFieldMac.mm */; };
-               93F19A3B08245E59001E9ABC /* ListBoxMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587851402DE375901EA4122 /* ListBoxMac.mm */; };
                93F19A3C08245E59001E9ABC /* DeprecatedPtrListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */; };
                93F19A3F08245E59001E9ABC /* WebCoreTextField.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587851C02DE375901EA4122 /* WebCoreTextField.mm */; };
                93F19A4A08245E59001E9ABC /* RegularExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587852B02DE375901EA4122 /* RegularExpression.cpp */; };
                ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = ABB5419D0ACDDFE4002820EB /* RenderListBox.h */; };
                ABDDFE790A5C6E7000A3E11D /* RenderMenuList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */; };
                ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; };
-               ABE7B5230A489F830031881C /* DeprecatedRenderSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABE7B5210A489F830031881C /* DeprecatedRenderSelect.cpp */; };
-               ABE7B5240A489F830031881C /* DeprecatedRenderSelect.h in Headers */ = {isa = PBXBuildFile; fileRef = ABE7B5220A489F830031881C /* DeprecatedRenderSelect.h */; };
                B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B20111050AB7740500DB0E68 /* JSSVGAElement.cpp */; };
                B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B20111060AB7740500DB0E68 /* JSSVGAElement.h */; };
                B20964BF0AB76EF600E4C740 /* SVGAngle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B20964BD0AB76EF600E4C740 /* SVGAngle.cpp */; };
                ABB5419D0ACDDFE4002820EB /* RenderListBox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderListBox.h; sourceTree = "<group>"; };
                ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMenuList.cpp; sourceTree = "<group>"; };
                ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderMenuList.h; sourceTree = "<group>"; };
-               ABE7B5210A489F830031881C /* DeprecatedRenderSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedRenderSelect.cpp; sourceTree = "<group>"; };
-               ABE7B5220A489F830031881C /* DeprecatedRenderSelect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedRenderSelect.h; sourceTree = "<group>"; };
                B20111050AB7740500DB0E68 /* JSSVGAElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAElement.cpp; sourceTree = "<group>"; };
                B20111060AB7740500DB0E68 /* JSSVGAElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGAElement.h; sourceTree = "<group>"; };
                B20964BD0AB76EF600E4C740 /* SVGAngle.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAngle.cpp; sourceTree = "<group>"; };
                F58784F002DE375901EA4122 /* CursorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CursorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587850302DE375901EA4122 /* LoaderFunctionsMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoaderFunctionsMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587851202DE375901EA4122 /* TextFieldMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextFieldMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F587851302DE375901EA4122 /* ListBox.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ListBox.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F587851402DE375901EA4122 /* ListBoxMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ListBoxMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedPtrListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587851702DE375901EA4122 /* LoaderFunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LoaderFunctions.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */,
                                6593923909AE435C002C531F /* KURLMac.mm */,
                                9352084409BD43B900F2038D /* Language.mm */,
-                               F587851402DE375901EA4122 /* ListBoxMac.mm */,
                                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */,
                                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */,
                                935207BF09BD412000F2038D /* LocalizedStringsMac.mm */,
                                6593923509AE4346002C531F /* KURL.cpp */,
                                6593923609AE4346002C531F /* KURL.h */,
                                85EC9AF90A71A2C600EEEAED /* Language.h */,
-                               F587851302DE375901EA4122 /* ListBox.h */,
                                935207BD09BD410A00F2038D /* LocalizedStrings.h */,
                                A8239DFE09B3CF8A00B60641 /* Logging.cpp */,
                                A8239DFF09B3CF8A00B60641 /* Logging.h */,
                                9392F1490AD1861300691BD4 /* CounterResetNode.cpp */,
                                9392F1450AD1860C00691BD4 /* CounterResetNode.h */,
                                BCEA4817097D93020094C9E4 /* DataRef.h */,
-                               ABE7B5210A489F830031881C /* DeprecatedRenderSelect.cpp */,
-                               ABE7B5220A489F830031881C /* DeprecatedRenderSelect.h */,
                                BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */,
                                BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */,
                                A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
                                93F1995008245E59001E9ABC /* CachePolicy.h in Headers */,
                                93F1996308245E59001E9ABC /* SSLKeyGenerator.h in Headers */,
                                93F1996B08245E59001E9ABC /* TextField.h in Headers */,
-                               93F1996C08245E59001E9ABC /* ListBox.h in Headers */,
                                93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */,
                                93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */,
                                93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */,
                                85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
                                85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
                                85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
-                               ABE7B5240A489F830031881C /* DeprecatedRenderSelect.h in Headers */,
                                DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
                                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */,
                                448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
                                93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */,
                                93F19A3108245E59001E9ABC /* LoaderFunctionsMac.mm in Sources */,
                                93F19A3A08245E59001E9ABC /* TextFieldMac.mm in Sources */,
-                               93F19A3B08245E59001E9ABC /* ListBoxMac.mm in Sources */,
                                93F19A3C08245E59001E9ABC /* DeprecatedPtrListImpl.cpp in Sources */,
                                93F19A3F08245E59001E9ABC /* WebCoreTextField.mm in Sources */,
                                93F19A4A08245E59001E9ABC /* RegularExpression.cpp in Sources */,
                                85031B4B0A44EFC700F992E0 /* RegisteredEventListener.cpp in Sources */,
                                85031B4D0A44EFC700F992E0 /* UIEvent.cpp in Sources */,
                                85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */,
-                               ABE7B5230A489F830031881C /* DeprecatedRenderSelect.cpp in Sources */,
                                51F11E150A48C2920034A24E /* SQLTransaction.cpp in Sources */,
                                DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
                                BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */,
index 0ea36e3..2e50bfb 100644 (file)
@@ -423,19 +423,6 @@ select {
 select[size],
 select[multiple],
 select[size][multiple] {
-    /* FIXME: If we need to switch back to the old listbox implementation, switch the commented style blocks here */
-
-    /* Old listbox appearance */
-    /*
-    -webkit-appearance: none;
-    -webkit-box-align: initial;
-    box-sizing: initial;
-    color: initial;
-    border: initial;
-    background-color: initial;
-    */
-
-    /* New listbox appearance */
     -webkit-appearance: listbox;
     -webkit-box-align: start;
     box-sizing: initial;
index aee5951..82748d8 100644 (file)
@@ -32,11 +32,9 @@ namespace WebCore {
 class HTMLSelectElement;
 class HTMLFormElement;
 class MappedAttribute;
-class DeprecatedRenderSelect;
 
 class HTMLOptionElement : public HTMLGenericFormElement
 {
-    friend class DeprecatedRenderSelect;
     friend class HTMLSelectElement;
     friend class RenderMenuList;
 
index 5428a54..1e4216b 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "CSSPropertyNames.h"
 #include "Document.h"
-#include "DeprecatedRenderSelect.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "FormDataList.h"
@@ -98,10 +97,8 @@ void HTMLSelectElement::recalcStyle( StyleChange ch )
     if (hasChangedChild() && renderer()) {
         if (usesMenuList())
             static_cast<RenderMenuList*>(renderer())->setOptionsChanged(true);
-        else if (renderer() && renderer()->isListBox())
-            static_cast<RenderListBox*>(renderer())->setOptionsChanged(true);
         else
-            static_cast<DeprecatedRenderSelect*>(renderer())->setOptionsChanged(true);
+            static_cast<RenderListBox*>(renderer())->setOptionsChanged(true);
     }
 
     HTMLGenericFormElement::recalcStyle( ch );
@@ -345,14 +342,14 @@ void HTMLSelectElement::parseMappedAttribute(MappedAttribute *attr)
 
 bool HTMLSelectElement::isKeyboardFocusable() const
 {
-    if (renderer() && (usesMenuList() || renderer()->isListBox()))
+    if (renderer())
         return isFocusable();
     return HTMLGenericFormElement::isKeyboardFocusable();
 }
 
 bool HTMLSelectElement::isMouseFocusable() const
 {
-    if (renderer() && (usesMenuList() || renderer()->isListBox()))
+    if (renderer())
         return isFocusable();
     return HTMLGenericFormElement::isMouseFocusable();
 }
@@ -361,12 +358,6 @@ RenderObject *HTMLSelectElement::createRenderer(RenderArena *arena, RenderStyle
 {
     if (usesMenuList())
         return new (arena) RenderMenuList(this);
-#if PLATFORM(MAC)
-    // FIXME: Remove this when DeprecatedRenderSelect is no longer needed.
-    if (style->appearance() == ListboxAppearance)
-        return new (arena) RenderListBox(this);
-    return new (arena) DeprecatedRenderSelect(this);
-#endif
     return new (arena) RenderListBox(this);
 }
 
@@ -486,10 +477,8 @@ void HTMLSelectElement::setRecalcListItems()
     if (renderer()) {
         if (usesMenuList())
             static_cast<RenderMenuList*>(renderer())->setOptionsChanged(true);
-        else if (renderer() && renderer()->isListBox())
-            static_cast<RenderListBox*>(renderer())->setOptionsChanged(true);
         else
-            static_cast<DeprecatedRenderSelect*>(renderer())->setOptionsChanged(true);
+            static_cast<RenderListBox*>(renderer())->setOptionsChanged(true);
     }
     setChanged();
 }
@@ -522,13 +511,9 @@ void HTMLSelectElement::notifyOptionSelected(HTMLOptionElement *selectedOption,
     if (selected && !m_multiple)
         deselectItems(selectedOption);
 
-    if (renderer() && !usesMenuList()) {
-        if (renderer()->isListBox())
-            static_cast<RenderListBox*>(renderer())->setSelectionChanged(true);
-        else
-            static_cast<DeprecatedRenderSelect*>(renderer())->setSelectionChanged(true);
-    }
+    if (renderer() && !usesMenuList())
+        static_cast<RenderListBox*>(renderer())->setSelectionChanged(true);
+
     setChanged(true);
 }
 
@@ -547,7 +532,7 @@ void HTMLSelectElement::defaultEventHandler(Event* evt)
 {
     if (usesMenuList())
         menuListDefaultEventHandler(evt);
-    else if (renderer() && renderer()->isListBox() && renderer()->isListBox()) 
+    else 
         listBoxDefaultEventHandler(evt);
 
     if (!evt->defaultHandled() && evt->type() == keypressEvent && evt->isKeyboardEvent()) {
@@ -627,6 +612,9 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* evt)
 
 void HTMLSelectElement::listBoxDefaultEventHandler(Event* evt)
 {
+    if (!renderer())
+        return;
+
     if (evt->type() == mousedownEvent) {
         MouseEvent* mEvt = static_cast<MouseEvent*>(evt);
         int listIndex = static_cast<RenderListBox*>(renderer())->listIndexAtOffset(mEvt->offsetX(), mEvt->offsetY());
@@ -742,6 +730,8 @@ void HTMLSelectElement::setActiveSelectionAnchorIndex(int index)
 
 void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
 {
+    ASSERT(renderer() && renderer()->isListBox());
+    
     unsigned start;
     unsigned end;
     ASSERT(m_activeSelectionAnchorIndex >= 0);
@@ -762,8 +752,8 @@ void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
             }
         }
     }
-    if (renderer()->isListBox())
-        static_cast<RenderListBox*>(renderer())->setSelectionChanged(true);
+
+    static_cast<RenderListBox*>(renderer())->setSelectionChanged(true);
 }
 
 void HTMLSelectElement::listBoxOnChange()
index 0935195..fa63533 100644 (file)
 
 namespace WebCore {
 
-class DeprecatedRenderSelect;
 class HTMLOptionElement;
 class HTMLOptionsCollection;
 class KeyboardEvent;
 
 class HTMLSelectElement : public HTMLGenericFormElement {
-    friend class DeprecatedRenderSelect;
+
 public:
     HTMLSelectElement(Document*, HTMLFormElement* = 0);
     HTMLSelectElement(const QualifiedName& tagName, Document*, HTMLFormElement* = 0);
diff --git a/WebCore/platform/ListBox.h b/WebCore/platform/ListBox.h
deleted file mode 100644 (file)
index e71ee0e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2004, 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. 
- */
-
-#ifndef ListBox_h
-#define ListBox_h
-
-#include "DeprecatedValueList.h"
-#include "DeprecatedString.h"
-#include "ScrollView.h"
-#include "TextDirection.h"
-
-#if PLATFORM(QT)
-class QListWidget;
-#endif
-
-namespace WebCore {
-
-enum ListBoxItemType {
-    ListBoxOption,
-    ListBoxGroupLabel,
-    ListBoxSeparator
-};
-
-struct ListBoxItem
-{
-    DeprecatedString string;
-    ListBoxItemType type;
-    bool enabled;
-    
-    ListBoxItem(const DeprecatedString &s, ListBoxItemType t, bool e) : string(s), type(t), enabled(e) { }
-};
-
-class ListBox : public ScrollView {
-public:
-    enum SelectionMode { Single, Extended };
-
-    ListBox();
-    ~ListBox();
-
-    IntSize sizeForNumberOfLines(int numLines) const;
-    
-    unsigned count() const { return _items.count(); }
-
-    void setSelectionMode(SelectionMode);
-
-    void clear();
-    void appendItem(const DeprecatedString &s, bool enabled) { appendItem(s, ListBoxOption, enabled); }
-    void appendGroupLabel(const DeprecatedString &s, bool enabled) { appendItem(s, ListBoxGroupLabel, enabled); }
-    void doneAppendingItems();
-
-    void setSelected(int, bool);
-    bool isSelected(int) const;
-
-    void setEnabled(bool enabled);
-    bool isEnabled();
-    
-    const ListBoxItem &itemAtIndex(int index) const { return _items[index]; }
-    
-    void setWritingDirection(TextDirection);
-    
-    bool changingSelection() { return _changingSelection; }
-
-    virtual FocusPolicy focusPolicy() const;
-    virtual bool checksDescendantsForFocus() const;
-    
-    static void clearCachedTextRenderers();
-    void setFont(const Font&);
-
-#if PLATFORM(QT)
-    virtual void setParentWidget(QWidget*);
-#endif
-
-private:
-#if PLATFORM(QT)
-    QListWidget* m_listWidget;
-    SelectionMode m_selectionMode;
-#endif
-
-    void appendItem(const DeprecatedString &, ListBoxItemType, bool);
-
-    // A Vector<ListBoxItem> might be more efficient for large lists.
-    DeprecatedValueList<ListBoxItem> _items;
-
-    bool _changingSelection;
-    bool _enabled;
-
-    mutable float _width;
-    mutable bool _widthGood;
-};
-
-}
-
-#endif
index e3adf94..52203f1 100644 (file)
@@ -32,7 +32,6 @@
 #import "Font.h"
 #import "FontData.h"
 #import "FontPlatformData.h"
-#import "ListBox.h"
 #import "WebCoreStringTruncator.h"
 #import "WebCoreSystemInterface.h"
 #import "WebFontCache.h"
diff --git a/WebCore/platform/mac/ListBoxMac.mm b/WebCore/platform/mac/ListBoxMac.mm
deleted file mode 100644 (file)
index 8bafb02..0000000
+++ /dev/null
@@ -1,744 +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 "ListBox.h"
-
-#import "BlockExceptions.h"
-#import "FontData.h"
-#import "FrameMac.h"
-#import "GraphicsContext.h"
-#import "RenderView.h"
-#import "RenderWidget.h"
-#import "TextStyle.h"
-#import "WebCoreFrameBridge.h"
-#import "WebCoreWidgetHolder.h"
-#import "WidgetClient.h"
-#import <wtf/Assertions.h>
-
-using namespace WebCore;
-
-const int minLines = 4; /* ensures we have a scroll bar */
-const float bottomMargin = 1;
-const float leftMargin = 2;
-const float rightMargin = 2;
-
-@interface WebCoreListBoxScrollView : NSScrollView <WebCoreWidgetHolder>
-@end
-
-@interface WebCoreTableView : NSTableView <WebCoreWidgetHolder>
-{
-@public
-    ListBox *_box;
-    BOOL processingMouseEvent;
-    BOOL clickedDuringMouseEvent;
-    BOOL inNextValidKeyView;
-    NSWritingDirection _direction;
-    BOOL isSystemFont;
-    UCTypeSelectRef typeSelectSelector;
-}
-- (id)initWithListBox:(ListBox *)b;
-- (void)detach;
-- (void)_webcore_setKeyboardFocusRingNeedsDisplay;
-- (Widget *)widget;
-- (void)setBaseWritingDirection:(NSWritingDirection)direction;
-- (NSWritingDirection)baseWritingDirection;
-- (void)fontChanged;
-@end
-
-static Font* itemScreenRenderer = 0;
-static Font* itemPrinterRenderer = 0;
-static Font* groupLabelScreenRenderer = 0;
-static Font* groupLabelPrinterRenderer = 0;
-
-static NSFont *itemFont()
-{
-    static NSFont *font = [[NSFont systemFontOfSize:[NSFont smallSystemFontSize]] retain];
-    return font;
-}
-
-static Font* itemTextRenderer(bool isPrinting)
-{
-    if (!isPrinting) {
-        if (itemScreenRenderer == nil) {
-            FontPlatformData font(itemFont());
-            itemScreenRenderer = new Font(font, isPrinting);
-        }
-        return itemScreenRenderer;
-    } else {
-        if (itemPrinterRenderer == nil) {
-            FontPlatformData font(itemFont(), true);
-            itemPrinterRenderer = new Font(font, isPrinting);
-        }
-        return itemPrinterRenderer;
-    }
-}
-
-static Font* groupLabelTextRenderer(bool isPrinting)
-{
-    if (!isPrinting) {
-        if (groupLabelScreenRenderer == nil) {
-            FontPlatformData font([NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]);
-            groupLabelScreenRenderer = new Font(font, isPrinting);
-        }
-        return groupLabelScreenRenderer;
-    } else {
-        if (groupLabelPrinterRenderer == nil) {
-            FontPlatformData font([NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]], true);
-            groupLabelPrinterRenderer = new Font(font, isPrinting);
-        }
-        return groupLabelPrinterRenderer;
-    }
-}
-
-ListBox::ListBox()
-    : _changingSelection(false)
-    , _enabled(true)
-    , _widthGood(false)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = [[WebCoreListBoxScrollView alloc] initWithFrame:NSZeroRect];
-    setView(scrollView);
-    [scrollView release];
-    
-    [scrollView setBorderType:NSBezelBorder];
-    [scrollView setHasVerticalScroller:YES];
-    [[scrollView verticalScroller] setControlSize:NSSmallControlSize];
-
-    // Another element might overlap this one, so we have to do the slower-style scrolling.
-    [[scrollView contentView] setCopiesOnScroll:NO];
-    
-    // In WebHTMLView, we set a clip. This is not typical to do in an
-    // NSView, and while correct for any one invocation of drawRect:,
-    // it causes some bad problems if that clip is cached between calls.
-    // The cached graphics state, which clip views keep around, does
-    // cache the clip in this undesirable way. Consequently, we want to 
-    // release the GState for all clip views for all views contained in 
-    // a WebHTMLView. Here we do it for list boxes used in forms.
-    // See these bugs for more information:
-    // <rdar://problem/3226083>: REGRESSION (Panther): white box overlaying select lists at nvidia.com drivers page
-    [[scrollView contentView] releaseGState];
-
-    WebCoreTableView *tableView = [[WebCoreTableView alloc] initWithListBox:this];
-    [scrollView setDocumentView:tableView];
-    [tableView release];
-    [scrollView setVerticalLineScroll:[tableView rowHeight]];
-        
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-ListBox::~ListBox()
-{
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    WebCoreTableView *tableView = [scrollView documentView];
-    [tableView detach];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void ListBox::clear()
-{
-    _items.clear();
-    _widthGood = false;
-}
-
-void ListBox::setSelectionMode(SelectionMode mode)
-{
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    NSTableView *tableView = [scrollView documentView];
-    [tableView setAllowsMultipleSelection:mode != Single];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void ListBox::appendItem(const DeprecatedString &text, ListBoxItemType type, bool enabled)
-{
-    _items.append(ListBoxItem(text, type, enabled));
-    _widthGood = false;
-}
-
-void ListBox::doneAppendingItems()
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    NSTableView *tableView = [scrollView documentView];
-    [tableView reloadData];
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void ListBox::setSelected(int index, bool selectIt)
-{
-    ASSERT(index >= 0);
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    NSTableView *tableView = [scrollView documentView];
-    _changingSelection = true;
-    if (selectIt) {
-        [tableView selectRow:index byExtendingSelection:[tableView allowsMultipleSelection]];
-        [tableView scrollRowToVisible:index];
-    } else {
-        [tableView deselectRow:index];
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    _changingSelection = false;
-}
-
-bool ListBox::isSelected(int index) const
-{
-    ASSERT(index >= 0);
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    NSTableView *tableView = [scrollView documentView];
-    return [tableView isRowSelected:index]; 
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return false;
-}
-
-void ListBox::setEnabled(bool enabled)
-{
-    if (enabled != _enabled) {
-        // You would think this would work, but not until AppKit bug 2177792 is fixed.
-        //BEGIN_BLOCK_OBJC_EXCEPTIONS;
-        //NSTableView *tableView = [(NSScrollView *)getView() documentView];
-        //[tableView setEnabled:enabled];
-        //END_BLOCK_OBJC_EXCEPTIONS;
-
-        _enabled = enabled;
-
-        NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-        NSTableView *tableView = [scrollView documentView];
-        [tableView reloadData];
-    }
-}
-
-bool ListBox::isEnabled()
-{
-    return _enabled;
-}
-
-IntSize ListBox::sizeForNumberOfLines(int lines) const
-{
-    NSSize size = {0,0};
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    WebCoreTableView *tableView = [scrollView documentView];
-    
-    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) {
-            TextStyle style;
-            style.disableRoundingHacks();
-            style.setRTL([tableView baseWritingDirection] == NSWritingDirectionRightToLeft);
-
-            const Font* renderer;
-            const Font* groupLabelRenderer;
-            
-            bool needToDeleteLabel = false;
-            if (tableView->isSystemFont) {        
-                RenderWidget *client = static_cast<RenderWidget *>(Widget::client());
-                bool isPrinting = client->view()->printingMode();
-                renderer = itemTextRenderer(isPrinting);
-                groupLabelRenderer = groupLabelTextRenderer(isPrinting);
-            } else {
-                renderer = &font();
-                FontDescription boldDesc = font().fontDescription();
-                boldDesc.setWeight(cBoldWeight);
-                groupLabelRenderer = new Font(boldDesc, font().letterSpacing(), font().wordSpacing());
-                groupLabelRenderer->update();
-                needToDeleteLabel = true;
-            }
-            
-            do {
-                const DeprecatedString &s = (*i).string;
-                TextRun run(reinterpret_cast<const UniChar *>(s.unicode()), s.length(), 0, s.length());
-                float textWidth = (((*i).type == ListBoxGroupLabel) ? groupLabelRenderer : renderer)->floatWidth(run, style);
-                width = max(width, textWidth);
-                ++i;
-            
-            } while (i != e);
-            
-            if (needToDeleteLabel)
-                delete groupLabelRenderer;
-        }
-        _width = ceilf(width);
-        _widthGood = true;
-    }
-    
-    NSSize contentSize = { _width, [tableView rowHeight] * MAX(minLines, lines) };
-    size = [NSScrollView frameSizeForContentSize:contentSize hasHorizontalScroller:NO hasVerticalScroller:YES borderType:NSBezelBorder];
-    size.width += [NSScroller scrollerWidthForControlSize:NSSmallControlSize] - [NSScroller scrollerWidth] + leftMargin + rightMargin;
-
-    return IntSize(size);
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return IntSize(0, 0);
-}
-
-Widget::FocusPolicy ListBox::focusPolicy() const
-{
-    FocusPolicy policy = Widget::focusPolicy();
-    return policy == TabFocus ? StrongFocus : policy;
-}
-
-bool ListBox::checksDescendantsForFocus() const
-{
-    return true;
-}
-
-void ListBox::setWritingDirection(TextDirection d)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    WebCoreTableView *tableView = [scrollView documentView];
-    NSWritingDirection direction = d == RTL ? NSWritingDirectionRightToLeft : NSWritingDirectionLeftToRight;
-    if ([tableView baseWritingDirection] != direction) {
-        [tableView setBaseWritingDirection:direction];
-        [tableView reloadData];
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void ListBox::clearCachedTextRenderers()
-{
-    delete itemScreenRenderer;
-    itemScreenRenderer = 0;
-    
-    delete itemPrinterRenderer;
-    itemPrinterRenderer = 0;
-    
-    delete groupLabelScreenRenderer;
-    groupLabelScreenRenderer = 0;
-    
-    delete groupLabelPrinterRenderer;
-    groupLabelPrinterRenderer = 0;
-}
-
-void ListBox::setFont(const Font& font)
-{
-    Widget::setFont(font);
-
-    NSScrollView *scrollView = static_cast<NSScrollView *>(getView());
-    WebCoreTableView *tableView = [scrollView documentView];
-    [tableView fontChanged];
-}
-
-@implementation WebCoreListBoxScrollView
-
-- (Widget *)widget
-{
-    WebCoreTableView *tableView = [self documentView];
-    
-    assert([tableView isKindOfClass:[WebCoreTableView class]]);
-    
-    return [tableView widget];
-}
-
-- (void)setFrameSize:(NSSize)size
-{
-    [super setFrameSize:size];
-    NSTableColumn *column = [[[self documentView] tableColumns] objectAtIndex:0];
-    [column setWidth:[self contentSize].width];
-    [column setMinWidth:[self contentSize].width];
-    [column setMaxWidth:[self contentSize].width];
-}
-
-- (BOOL)becomeFirstResponder
-{
-    WebCoreTableView *documentView = [self documentView];
-    Widget *widget = [documentView widget];
-    [FrameMac::bridgeForWidget(widget) makeFirstResponder:documentView];
-    return YES;
-}
-
-- (BOOL)autoforwardsScrollWheelEvents
-{
-    return YES;
-}
-
-@end
-
-static Boolean ListBoxTypeSelectCallback(UInt32 index, void *listDataPtr, void *refcon, CFStringRef *outString, UCTypeSelectOptions *tsOptions)
-{
-    WebCoreTableView *self = static_cast<WebCoreTableView *>(refcon);   
-    ListBox *box = static_cast<ListBox *>([self widget]);
-    
-    if (!box)
-        return false;
-    
-    if (index > box->count())
-        return false;
-    
-    if (outString)
-        *outString = box->itemAtIndex(index).string.getCFString();
-    
-    if (tsOptions)
-        *tsOptions = kUCTSOptionsNoneMask;
-    
-    return true;
-}
-
-@implementation WebCoreTableView
-
-- (id)initWithListBox:(ListBox *)b
-{
-    [super init];
-
-    _box = b;
-
-    NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:nil];
-
-    [column setEditable:NO];
-
-    [self addTableColumn:column];
-
-    [column release];
-    
-    [self setAllowsMultipleSelection:NO];
-    [self setHeaderView:nil];
-    [self setIntercellSpacing:NSMakeSize(0, 0)];
-    
-    [self setDataSource:self];
-    [self setDelegate:self];
-
-    return self;
-}
-
-- (void)finalize
-{
-    if (typeSelectSelector)
-        UCTypeSelectReleaseSelector(&typeSelectSelector);
-    
-    [super finalize];
-}
-
-- (void)dealloc
-{
-    if (typeSelectSelector)
-        UCTypeSelectReleaseSelector(&typeSelectSelector);
-    
-    [super dealloc];
-}
-
-- (void)detach
-{
-    _box = 0;
-    [self setDelegate:nil];
-    [self setDataSource:nil];
-}
-
-- (void)mouseDown:(NSEvent *)event
-{
-    if (!_box) {
-        [super mouseDown:event];
-        return;
-    }
-
-    processingMouseEvent = YES;
-    NSView *outerView = [_box->getOuterView() retain];
-    Widget::beforeMouseDown(outerView);
-    [super mouseDown:event];
-    Widget::afterMouseDown(outerView);
-    [outerView release];
-    processingMouseEvent = NO;
-
-    if (clickedDuringMouseEvent) {
-    clickedDuringMouseEvent = false;
-    } else if (_box) {
-    _box->sendConsumedMouseUp();
-    }
-}
-
-- (void)keyDown:(NSEvent *)event
-{
-    if (!_box)
-        return;
-    if (!Mac(Frame::frameForWidget(_box))->keyEvent(event))
-        [super keyDown:event];
-}
-
-- (void)keyUp:(NSEvent *)event
-{
-    if (!_box)
-        return;
-    
-    if (!Mac(Frame::frameForWidget(_box))->keyEvent(event)) {
-        [super keyUp:event];
-        NSString *string = [event characters];
-       
-        if ([string length] == 0)
-           return;
-       
-        // type select should work with any graphic character as defined in D13a of the unicode standard.
-        const uint32_t graphicCharacterMask = U_GC_L_MASK | U_GC_M_MASK | U_GC_N_MASK | U_GC_P_MASK | U_GC_S_MASK | U_GC_ZS_MASK;
-        unichar pressedCharacter = [string characterAtIndex:0];
-        
-        if (!(U_GET_GC_MASK(pressedCharacter) & graphicCharacterMask)) {
-            if (typeSelectSelector)
-                UCTypeSelectFlushSelectorData(typeSelectSelector);
-            return;            
-        }
-        
-        OSStatus err = noErr;
-        if (!typeSelectSelector)
-            err = UCTypeSelectCreateSelector(0, 0, kUCCollateStandardOptions, &typeSelectSelector);
-        
-        if (err || !typeSelectSelector)
-            return;
-        
-        Boolean updateSelector = false;
-        // the timestamp and what the AddKey function want for time are the same thing.
-        err = UCTypeSelectAddKeyToSelector(typeSelectSelector, (CFStringRef)string, [event timestamp], &updateSelector);
-        
-        if (err || !updateSelector)
-            return;
-  
-        UInt32 closestItem = 0;
-        
-        err = UCTypeSelectFindItem(typeSelectSelector, [self numberOfRowsInTableView:self], 0, self, ListBoxTypeSelectCallback, &closestItem); 
-
-        if (err)
-            return;
-        
-        [self selectRowIndexes:[NSIndexSet indexSetWithIndex:closestItem] byExtendingSelection:NO];
-        [self scrollRowToVisible:closestItem];
-    }
-}
-
-- (BOOL)becomeFirstResponder
-{
-    if (!_box) {
-        return NO;
-    }
-
-    BOOL become = [super becomeFirstResponder];
-    
-    if (become) {
-        if (_box && _box->client() && !FrameMac::currentEventIsMouseDownInWidget(_box))
-            _box->client()->scrollToVisible(_box);
-        [self _webcore_setKeyboardFocusRingNeedsDisplay];
-        if (_box && _box->client()) {
-            _box->client()->focusIn(_box);
-            [FrameMac::bridgeForWidget(_box) formControlIsBecomingFirstResponder:self];
-        }
-    }
-
-    return become;
-}
-
-- (BOOL)resignFirstResponder
-{
-    BOOL resign = [super resignFirstResponder];
-    if (resign && _box && _box->client()) {
-        _box->client()->focusOut(_box);
-        [FrameMac::bridgeForWidget(_box) formControlIsResigningFirstResponder:self];
-    }
-    return resign;
-}
-
-- (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
-{
-    return _box && inNextValidKeyView
-        ? FrameMac::nextKeyViewForWidget(_box, SelectingNext)
-        : [super nextKeyView];
-}
-
-- (NSView *)previousKeyView
-{
-    return _box && inNextValidKeyView
-        ? FrameMac::nextKeyViewForWidget(_box, 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;
-}
-
-- (int)numberOfRowsInTableView:(NSTableView *)tableView
-{
-    return _box ? _box->count() : 0;
-}
-
-- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)column row:(int)row
-{
-    return nil;
-}
-
-- (void)tableViewSelectionDidChange:(NSNotification *)notification
-{
-    if (_box && _box->client())
-        _box->client()->selectionChanged(_box);
-    if (_box && !_box->changingSelection()) {
-        if (processingMouseEvent) {
-            clickedDuringMouseEvent = true;
-            _box->sendConsumedMouseUp();
-        }
-        if (_box && _box->client())
-            _box->client()->clicked(_box);
-    }
-}
-
-- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row
-{
-    if (!_box)
-        return NO;
-    
-    const ListBoxItem &item = _box->itemAtIndex(row);
-    
-    return item.type == ListBoxOption && item.enabled;
-}
-
-- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
-{
-    return _box && _box->isEnabled();
-}
-
-- (void)drawRow:(int)row clipRect:(NSRect)clipRect
-{
-    if (!_box)
-        return;
-    
-    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-    ASSERT([[NSGraphicsContext currentContext] isFlipped]);
-    GraphicsContext graphicsContext(context);
-
-    const ListBoxItem &item = _box->itemAtIndex(row);
-
-    NSColor *color;
-    if (_box->isEnabled() && item.enabled) {
-        if ([self isRowSelected:row] && [[self window] firstResponder] == self && ([[self window] isKeyWindow] || ![[self window] canBecomeKeyWindow])) {
-            color = [NSColor alternateSelectedControlTextColor];
-        } else {
-            color = [NSColor controlTextColor];
-        }
-    } else {
-        color = [NSColor disabledControlTextColor];
-    }
-
-    bool rtl = _direction == NSWritingDirectionRightToLeft;
-
-    bool deleteRenderer = false;
-    const Font* renderer;
-    RenderWidget *client = static_cast<RenderWidget *>([self widget]->client());
-    bool isPrinting = client->view()->printingMode();
-    if (isSystemFont)
-        renderer = (item.type == ListBoxGroupLabel) ? groupLabelTextRenderer(isPrinting) : itemTextRenderer(isPrinting);
-    else {
-        if (item.type == ListBoxGroupLabel) {
-            deleteRenderer = true;
-            FontDescription boldDesc = _box->font().fontDescription();
-            boldDesc.setWeight(cBoldWeight);
-            renderer = new Font(boldDesc, _box->font().letterSpacing(), _box->font().wordSpacing());
-            renderer->update();
-        }
-        else
-            renderer = &_box->font();
-    }
-   
-    WebCore::TextStyle style;
-    style.setRTL(rtl);
-    style.disableRoundingHacks();
-
-    TextRun run(reinterpret_cast<const UniChar *>(item.string.unicode()), item.string.length());
-    
-    NSRect cellRect = [self frameOfCellAtColumn:0 row:row];
-    FloatPoint point;
-    if (!rtl)
-        point.setX(NSMinX(cellRect) + leftMargin);
-    else
-        point.setX(NSMaxX(cellRect) - rightMargin - renderer->floatWidth(run, style));
-    point.setY(NSMaxY(cellRect) - renderer->descent() - bottomMargin);
-
-    CGFloat red, green, blue, alpha;
-    [[color colorUsingColorSpaceName:NSDeviceRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
-    graphicsContext.setPen(makeRGBA((int)(red * 255), (int)(green * 255), (int)(blue * 255), (int)(alpha * 255)));
-    renderer->drawText(&graphicsContext, run, style, point);
-}
-
-- (void)_webcore_setKeyboardFocusRingNeedsDisplay
-{
-    [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
-}
-
-- (Widget *)widget
-{
-    return _box;
-}
-
-- (void)setBaseWritingDirection:(NSWritingDirection)direction
-{
-    _direction = direction;
-}
-
-- (NSWritingDirection)baseWritingDirection
-{
-    return _direction;
-}
-
-- (void)fontChanged
-{
-    NSFont *font = _box->font().primaryFont()->getNSFont();
-    isSystemFont = [[font fontName] isEqualToString:[itemFont() fontName]] && [font pointSize] == [itemFont() pointSize];
-    [self setRowHeight:ceilf([font ascender] - [font descender] + bottomMargin)];
-    [self setNeedsDisplay:YES];
-}
-
-@end
index 3ec7d25..f4b759c 100644 (file)
@@ -36,7 +36,6 @@
 #include "TextField.h"
 #include "FileChooser.h"
 #include "Font.h"
-#include "ListBox.h"
 #include "IntPoint.h"
 #include "Widget.h"
 #include "GraphicsContext.h"
@@ -123,16 +122,6 @@ void Slider::setMinValue(double) { notImplemented(); }
 void Slider::setFont(WebCore::Font const&) { notImplemented(); }
 double Slider::value() const { notImplemented(); return 0; }
 
-void ListBox::setSelected(int,bool) { notImplemented(); }
-IntSize ListBox::sizeForNumberOfLines(int) const { notImplemented(); return IntSize(); }
-bool ListBox::isSelected(int) const { notImplemented(); return 0; }
-void ListBox::appendItem(DeprecatedString const&,ListBoxItemType,bool) { notImplemented(); }
-void ListBox::doneAppendingItems() { notImplemented(); }
-void ListBox::setWritingDirection(TextDirection) { notImplemented(); }
-void ListBox::setEnabled(bool) { notImplemented(); }
-void ListBox::clear() { notImplemented(); }
-bool ListBox::checksDescendantsForFocus() const { notImplemented(); return 0; }
-
 FileChooser::FileChooser(Document*, RenderFileUploadControl*) { notImplemented(); }
 FileChooser::~FileChooser() { notImplemented(); }
 PassRefPtr<FileChooser> FileChooser::create(Document*, RenderFileUploadControl*) { notImplemented(); return 0; }
@@ -142,7 +131,6 @@ void FileChooser::disconnectUploadControl() { notImplemented(); }
 void FileChooser::chooseFile(const String& filename) { notImplemented(); }
 
 Widget::FocusPolicy Slider::focusPolicy() const { notImplemented(); return NoFocus; }
-Widget::FocusPolicy ListBox::focusPolicy() const { notImplemented(); return NoFocus; }
 Widget::FocusPolicy TextField::focusPolicy() const { notImplemented(); return NoFocus; }
 
 PlatformMouseEvent::PlatformMouseEvent(const CurrentEventTag&) { notImplemented(); }
@@ -348,11 +336,6 @@ bool Scrollbar::scroll(ScrollDirection, ScrollGranularity, float) { return false
 bool Scrollbar::setValue(int) { return false; }
 void Scrollbar::setProportion(int, int) { }
 
-ListBox::ListBox() { }
-ListBox::~ListBox() { }
-void ListBox::setSelectionMode(ListBox::SelectionMode) { }
-void ListBox::setFont(WebCore::Font const&) { }
-
 Color focusRingColor() { return 0xFF0000FF; }
 void setFocusRingColorChangeFunction(void (*)()) { }
 
diff --git a/WebCore/rendering/DeprecatedRenderSelect.cpp b/WebCore/rendering/DeprecatedRenderSelect.cpp
deleted file mode 100644 (file)
index a02731a..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "DeprecatedRenderSelect.h"
-
-#include "HTMLNames.h"
-#include "HTMLOptGroupElement.h"
-#include "HTMLOptionElement.h"
-#include "HTMLSelectElement.h"
-#include "ListBox.h"
-
-using std::min;
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-DeprecatedRenderSelect::DeprecatedRenderSelect(HTMLSelectElement* element)
-    : RenderFormElement(element)
-    , m_size(element->size())
-    , m_multiple(element->multiple())
-    , m_selectionChanged(true)
-    , m_ignoreSelectEvents(false)
-    , m_optionsChanged(true)
-{
-    setWidget(createListBox());
-}
-
-void DeprecatedRenderSelect::setWidgetWritingDirection()
-{
-    static_cast<ListBox*>(m_widget)->setWritingDirection(style()->direction());
-}
-
-void DeprecatedRenderSelect::setStyle(RenderStyle* s)
-{
-    RenderFormElement::setStyle(s);
-    setWidgetWritingDirection();
-}
-
-void DeprecatedRenderSelect::updateFromElement()
-{
-    m_ignoreSelectEvents = true;
-
-    // change widget type
-    bool oldMultiple = m_multiple;
-    m_multiple = static_cast<HTMLSelectElement*>(node())->multiple();
-
-    if (oldMultiple != m_multiple) {
-        static_cast<ListBox*>(m_widget)->setSelectionMode(m_multiple ? ListBox::Extended : ListBox::Single);
-        m_selectionChanged = true;
-        m_optionsChanged = true;
-    }
-
-    // update contents listbox/combobox based on options in m_element
-    if (m_optionsChanged) {
-        static_cast<HTMLSelectElement*>(node())->recalcListItems();
-        const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node())->listItems();
-        int listIndex;
-
-        static_cast<ListBox*>(m_widget)->clear();
-        
-        bool groupEnabled = true;
-        for (listIndex = 0; listIndex < int(listItems.size()); listIndex++) {
-            if (listItems[listIndex]->hasTagName(optgroupTag)) {
-                HTMLOptGroupElement* optgroupElement = static_cast<HTMLOptGroupElement*>(listItems[listIndex]);
-                DeprecatedString label = optgroupElement->getAttribute(labelAttr).deprecatedString();
-                label.replace('\\', backslashAsCurrencySymbol());
-                
-                // In WinIE, an optgroup can't start or end with whitespace (other than the indent
-                // we give it).  We match this behavior.
-                label = label.stripWhiteSpace();
-                // We want to collapse our whitespace too.  This will match other browsers.
-                label = label.simplifyWhiteSpace();
-
-                groupEnabled = optgroupElement->isEnabled();
-                
-                static_cast<ListBox*>(m_widget)->appendGroupLabel(label, groupEnabled);
-
-            } else if (listItems[listIndex]->hasTagName(optionTag)) {
-                HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(listItems[listIndex]);
-                DeprecatedString itemText = optionElement->text().deprecatedString();
-                if (itemText.isEmpty())
-                    itemText = optionElement->getAttribute(labelAttr).deprecatedString();
-                
-                itemText.replace('\\', backslashAsCurrencySymbol());
-
-                // In WinIE, leading and trailing whitespace is ignored in options. We match this behavior.
-                itemText = itemText.stripWhiteSpace();
-                // We want to collapse our whitespace too.  This will match other browsers.
-                itemText = itemText.simplifyWhiteSpace();
-                
-                if (listItems[listIndex]->parentNode()->hasTagName(optgroupTag))
-                    itemText.prepend("    ");
-
-                static_cast<ListBox*>(m_widget)->appendItem(itemText, groupEnabled && optionElement->isEnabled());
-            } else
-                ASSERT(false);
-            m_selectionChanged = true;
-        }
-        static_cast<ListBox*>(m_widget)->doneAppendingItems();
-        setNeedsLayoutAndMinMaxRecalc();
-        m_optionsChanged = false;
-    }
-
-    // update selection
-    if (m_selectionChanged)
-        updateSelection();
-
-    m_ignoreSelectEvents = false;
-
-    RenderFormElement::updateFromElement();
-}
-
-short DeprecatedRenderSelect::baselinePosition(bool f, bool isRootLineBox) const
-{
-    // FIXME: Should get the hardcoded constant of 7 by calling a ListBox function,
-    // as we do for other widget classes.
-    return RenderWidget::baselinePosition(f, isRootLineBox) - 7;
-}
-
-void DeprecatedRenderSelect::calcMinMaxWidth()
-{
-    ASSERT(!minMaxKnown());
-
-    if (m_optionsChanged)
-        updateFromElement();
-
-    // ### ugly HACK FIXME!!!
-    setMinMaxKnown();
-    layoutIfNeeded();
-    setNeedsLayoutAndMinMaxRecalc();
-    // ### end FIXME
-
-    RenderFormElement::calcMinMaxWidth();
-}
-
-void DeprecatedRenderSelect::layout()
-{
-    ASSERT(needsLayout());
-    ASSERT(minMaxKnown());
-
-    // ### maintain selection properly between type/size changes, and work
-    // out how to handle multiselect->singleselect (probably just select
-    // first selected one)
-
-    // calculate size
-    ListBox* w = static_cast<ListBox*>(m_widget);
-
-
-    int size = m_size;
-    // check if multiple and size was not given or invalid
-    // Internet Exploder sets size to min(number of elements, 4)
-    // Netscape seems to simply set it to "number of elements"
-    // the average of that is IMHO min(number of elements, 10)
-    // so I did that ;-)
-    if (size < 1)
-        size = min(static_cast<ListBox*>(m_widget)->count(), 10U);
-
-    // Let the widget tell us how big it wants to be.
-    IntSize s(w->sizeForNumberOfLines(size));
-    setIntrinsicWidth(s.width());
-    setIntrinsicHeight(s.height());
-
-    RenderFormElement::layout();
-
-    // and now disable the widget in case there is no <option> given
-    const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node())->listItems();
-
-    bool foundOption = false;
-    for (unsigned i = 0; i < listItems.size() && !foundOption; i++)
-        foundOption = (listItems[i]->hasTagName(optionTag));
-
-    m_widget->setEnabled(foundOption && ! static_cast<HTMLSelectElement*>(node())->disabled());
-}
-
-void DeprecatedRenderSelect::selectionChanged(Widget*)
-{
-    if (m_ignoreSelectEvents)
-        return;
-
-    // don't use listItems() here as we have to avoid recalculations - changing the
-    // option list will make use update options not in the way the user expects them
-    const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node())->m_listItems;
-    int j = 0;
-    unsigned size = listItems.size();
-    for (unsigned i = 0; i < size; i++) {
-        // don't use setSelected() here because it will cause us to be called
-        // again with updateSelection.
-        if (listItems[i]->hasTagName(optionTag))
-            static_cast<HTMLOptionElement*>(listItems[i])
-                ->m_selected = static_cast<ListBox*>(m_widget)->isSelected(j);
-        if (listItems[i]->hasTagName(optionTag) || listItems[i]->hasTagName(optgroupTag))
-            ++j;
-    }
-    static_cast<HTMLSelectElement*>(node())->onChange();
-}
-
-void DeprecatedRenderSelect::setOptionsChanged(bool _optionsChanged)
-{
-    m_optionsChanged = _optionsChanged;
-}
-
-ListBox* DeprecatedRenderSelect::createListBox()
-{
-    ListBox *lb = new ListBox();
-    lb->setSelectionMode(m_multiple ? ListBox::Extended : ListBox::Single);
-    m_ignoreSelectEvents = false;
-    return lb;
-}
-
-void DeprecatedRenderSelect::updateSelection()
-{
-    const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node())->listItems();
-    int i;
-    // if multi-select, we select only the new selected index
-    ListBox *listBox = static_cast<ListBox*>(m_widget);
-    int j = 0;
-    for (i = 0; i < int(listItems.size()); i++) {
-        listBox->setSelected(j, listItems[i]->hasTagName(optionTag) &&
-                            static_cast<HTMLOptionElement*>(listItems[i])->selected());
-        if (listItems[i]->hasTagName(optionTag) || listItems[i]->hasTagName(optgroupTag))
-            ++j;
-        
-    }
-
-    m_selectionChanged = false;
-}
-
-} // namespace WebCore
diff --git a/WebCore/rendering/DeprecatedRenderSelect.h b/WebCore/rendering/DeprecatedRenderSelect.h
deleted file mode 100644 (file)
index a4ba94c..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef DeprecatedRenderSelect_h
-#define DeprecatedRenderSelect_h
-
-#include "RenderFormElement.h"
-
-namespace WebCore {
-
-    class HTMLSelectElement;
-    class ListBox;
-
-    class DeprecatedRenderSelect : public RenderFormElement {
-    public:
-        DeprecatedRenderSelect(HTMLSelectElement*);
-
-        virtual const char* renderName() const { return "DeprecatedRenderSelect"; }
-
-        short baselinePosition(bool f, bool b) const;
-        int calcReplacedHeight() const { if (!m_useListBox) return intrinsicHeight(); return RenderFormElement::calcReplacedHeight(); }
-
-        virtual void calcMinMaxWidth();
-        virtual void layout();
-
-        void setOptionsChanged(bool);
-
-        bool selectionChanged() { return m_selectionChanged; }
-        void setSelectionChanged(bool selectionChanged) { m_selectionChanged = selectionChanged; }
-        virtual void updateFromElement();
-        virtual void setStyle(RenderStyle*);
-
-        void updateSelection();
-
-    private:
-        virtual void selectionChanged(Widget*);
-
-    protected:
-        ListBox* createListBox();
-        void setWidgetWritingDirection();
-
-        unsigned m_size;
-        bool m_multiple;
-        bool m_useListBox;
-        bool m_selectionChanged;
-        bool m_ignoreSelectEvents;
-        bool m_optionsChanged;
-    };
-
-} // namespace WebCore
-
-#endif // DeprecatedRenderSelect_h