Changeset 89039 in webkit
- Timestamp:
- Jun 16, 2011, 10:33:18 AM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 deleted
- 23 edited
-
CMakeListsEfl.txt (modified) (1 diff)
-
CMakeListsWinCE.txt (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
GNUmakefile.list.am (modified) (1 diff)
-
WebCore.gypi (modified) (10 diffs)
-
WebCore.order (modified) (1 diff)
-
WebCore.pro (modified) (1 diff)
-
WebCore.vcproj/WebCore.vcproj (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
platform/FileChooser.h (modified) (1 diff)
-
platform/FileSystem.h (modified) (1 diff)
-
platform/android/FileChooserAndroid.cpp (deleted)
-
platform/brew/FileChooserBrew.cpp (deleted)
-
platform/chromium/FileChooserChromium.cpp (deleted)
-
platform/chromium/FileSystemChromiumLinux.cpp (modified) (1 diff)
-
platform/chromium/FileSystemChromiumMac.mm (modified) (1 diff)
-
platform/chromium/FileSystemChromiumWin.cpp (modified) (1 diff)
-
platform/efl/FileChooserEfl.cpp (deleted)
-
platform/gtk/FileChooserGtk.cpp (deleted)
-
platform/gtk/RenderThemeGtk.cpp (modified) (4 diffs)
-
platform/gtk/RenderThemeGtk.h (modified) (1 diff)
-
platform/haiku/FileChooserHaiku.cpp (deleted)
-
platform/mac/FileChooserMac.mm (deleted)
-
platform/qt/FileChooserQt.cpp (deleted)
-
platform/qt/RenderThemeQt.cpp (modified) (3 diffs)
-
platform/qt/RenderThemeQt.h (modified) (1 diff)
-
platform/win/FileChooserWin.cpp (deleted)
-
platform/wx/FileChooserWx.cpp (deleted)
-
rendering/RenderFileUploadControl.cpp (modified) (1 diff)
-
rendering/RenderTheme.cpp (modified) (4 diffs)
-
rendering/RenderTheme.h (modified) (1 diff)
-
rendering/RenderThemeMac.h (modified) (1 diff)
-
rendering/RenderThemeMac.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeListsEfl.txt
r88711 r89039 31 31 platform/efl/DragImageEfl.cpp 32 32 platform/efl/EventLoopEfl.cpp 33 platform/efl/FileChooserEfl.cpp34 33 platform/efl/FileSystemEfl.cpp 35 34 platform/efl/KURLEfl.cpp -
trunk/Source/WebCore/CMakeListsWinCE.txt
r88711 r89039 56 56 platform/win/EditorWin.cpp 57 57 platform/win/EventLoopWin.cpp 58 platform/win/FileChooserWin.cpp59 58 platform/win/KeyEventWin.cpp 60 59 platform/win/LanguageWin.cpp -
trunk/Source/WebCore/ChangeLog
r89036 r89039 1 2011-06-15 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 Move FileChooser::basenameForWidth to RenderTheme::fileListNameForWidth, eliminate gnarly FileChooserFoo proliferation. 6 https://bugs.webkit.org/show_bug.cgi?id=62748 7 8 Refactoring, covered by existing tests. 9 10 * CMakeListsEfl.txt: Removed FileChooserFoo from build system. 11 * CMakeListsWinCE.txt: Ditto. 12 * GNUmakefile.list.am: Ditto. 13 * WebCore.gypi: Ditto. 14 * WebCore.order: Ditto. 15 * WebCore.pro: Ditto. 16 * WebCore.vcproj/WebCore.vcproj: Ditto. 17 * WebCore.xcodeproj/project.pbxproj: Ditto. 18 * platform/FileChooser.h: Removed baseNameForWidth decl. 19 * platform/FileSystem.h: Removed now-unnecessary Chromium-specific cruft. 20 * platform/android/FileChooserAndroid.cpp: Removed. 21 * platform/brew/FileChooserBrew.cpp: Removed. 22 * platform/chromium/FileChooserChromium.cpp: Removed. 23 * platform/chromium/FileSystemChromiumLinux.cpp: Removed now-unnecessary code. 24 * platform/chromium/FileSystemChromiumMac.mm: Ditto. 25 * platform/chromium/FileSystemChromiumWin.cpp: Ditto. 26 * platform/efl/FileChooserEfl.cpp: Removed. 27 * platform/gtk/FileChooserGtk.cpp: Removed. 28 * platform/gtk/RenderThemeGtk.cpp: 29 (WebCore::stringByAdoptingFileSystemRepresentation): Moved from FileChooserGtk. 30 (WebCore::RenderThemeGtk::fileListNameForWidth): Ditto. 31 * platform/gtk/RenderThemeGtk.h: Added decl. 32 * platform/haiku/FileChooserHaiku.cpp: Removed. 33 * platform/mac/FileChooserMac.mm: Removed. 34 * platform/qt/FileChooserQt.cpp: Removed. 35 * platform/qt/RenderThemeQt.cpp: 36 (WebCore::RenderThemeQt::RenderThemeQt): Moved from FileChooserQt. 37 (WebCore::RenderThemeQt::fileListNameForWidth): Ditto. 38 * platform/qt/RenderThemeQt.h: Adde decl. 39 * platform/win/FileChooserWin.cpp: Removed. 40 * platform/wx/FileChooserWx.cpp: Removed. 41 * rendering/RenderFileUploadControl.cpp: 42 (WebCore::RenderFileUploadControl::fileTextValue): Changed to use RenderTheme. 43 * rendering/RenderTheme.cpp: 44 (WebCore::RenderTheme::fileListNameForWidth): Added default impl. 45 * rendering/RenderTheme.h: Added decl. 46 * rendering/RenderThemeMac.h: Ditto. 47 * rendering/RenderThemeMac.mm: 48 (WebCore::RenderThemeMac::fileListNameForWidth): Added default Mac impl. 49 1 50 2011-06-16 Vsevolod Vlasov <vsevik@chromium.org> 2 51 -
trunk/Source/WebCore/GNUmakefile.list.am
r89036 r89039 3805 3805 Source/WebCore/platform/gtk/DragImageGtk.cpp \ 3806 3806 Source/WebCore/platform/gtk/EventLoopGtk.cpp \ 3807 Source/WebCore/platform/gtk/FileChooserGtk.cpp \3808 3807 Source/WebCore/platform/gtk/FileSystemGtk.cpp \ 3809 3808 Source/WebCore/platform/gtk/GtkClickCounter.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r89036 r89039 3660 3660 'platform/android/DragDataAndroid.cpp', 3661 3661 'platform/android/EventLoopAndroid.cpp', 3662 'platform/android/FileChooserAndroid.cpp',3663 3662 'platform/android/FileSystemAndroid.cpp', 3664 3663 'platform/android/GeolocationServiceAndroid.cpp', … … 3767 3766 'platform/brew/DragDataBrew.cpp', 3768 3767 'platform/brew/EventLoopBrew.cpp', 3769 'platform/brew/FileChooserBrew.cpp',3770 3768 'platform/brew/FileSystemBrew.cpp', 3771 3769 'platform/brew/KURLBrew.cpp', … … 3822 3820 'platform/chromium/DragImageChromiumSkia.cpp', 3823 3821 'platform/chromium/DragImageRef.h', 3824 'platform/chromium/FileChooserChromium.cpp',3825 3822 'platform/chromium/FileSystemChromium.cpp', 3826 3823 'platform/chromium/FileSystemChromiumLinux.cpp', … … 3886 3883 'platform/efl/DragImageEfl.cpp', 3887 3884 'platform/efl/EventLoopEfl.cpp', 3888 'platform/efl/FileChooserEfl.cpp',3889 3885 'platform/efl/FileSystemEfl.cpp', 3890 3886 'platform/efl/KURLEfl.cpp', … … 4592 4588 'platform/gtk/DragImageGtk.cpp', 4593 4589 'platform/gtk/EventLoopGtk.cpp', 4594 'platform/gtk/FileChooserGtk.cpp',4595 4590 'platform/gtk/FileSystemGtk.cpp', 4596 4591 'platform/gtk/GOwnPtrGtk.cpp', … … 4645 4640 'platform/haiku/DragImageHaiku.cpp', 4646 4641 'platform/haiku/EventLoopHaiku.cpp', 4647 'platform/haiku/FileChooserHaiku.cpp',4648 4642 'platform/haiku/FileSystemHaiku.cpp', 4649 4643 'platform/haiku/LocalizedStringsHaiku.cpp', … … 4713 4707 'platform/mac/DragImageMac.mm', 4714 4708 'platform/mac/EventLoopMac.mm', 4715 'platform/mac/FileChooserMac.mm',4716 4709 'platform/mac/FileSystemMac.mm', 4717 4710 'platform/mac/HTMLConverter.h', … … 4930 4923 'platform/qt/DragImageQt.cpp', 4931 4924 'platform/qt/EventLoopQt.cpp', 4932 'platform/qt/FileChooserQt.cpp',4933 4925 'platform/qt/FileSystemQt.cpp', 4934 4926 'platform/qt/KURLQt.cpp', … … 5062 5054 'platform/win/EditorWin.cpp', 5063 5055 'platform/win/EventLoopWin.cpp', 5064 'platform/win/FileChooserWin.cpp',5065 5056 'platform/win/FileSystemWin.cpp', 5066 5057 'platform/win/GDIObjectCounter.cpp', … … 5119 5110 'platform/wx/DragImageWx.cpp', 5120 5111 'platform/wx/EventLoopWx.cpp', 5121 'platform/wx/FileChooserWx.cpp',5122 5112 'platform/wx/FileSystemWx.cpp', 5123 5113 'platform/wx/KURLWx.cpp', -
trunk/Source/WebCore/WebCore.order
r88952 r89039 7565 7565 __ZNK7WebCore13FileInputType12isFileUploadEv 7566 7566 __ZN7WebCore23RenderFileUploadControl11paintObjectERNS_9PaintInfoEii 7567 __ZNK7WebCore11FileChooser16basenameForWidthERKNS_4FontEi7568 7567 __ZN7WebCore29fileButtonNoFileSelectedLabelEv 7569 7568 __ZN7WebCore27DefaultLocalizationStrategy29fileButtonNoFileSelectedLabelEv -
trunk/Source/WebCore/WebCore.pro
r89036 r89039 2538 2538 platform/qt/DragImageQt.cpp \ 2539 2539 platform/qt/EventLoopQt.cpp \ 2540 platform/qt/FileChooserQt.cpp \2541 2540 platform/qt/FileSystemQt.cpp \ 2542 2541 platform/qt/SharedBufferQt.cpp \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r89036 r89039 26878 26878 </File> 26879 26879 <File 26880 RelativePath="..\platform\win\FileChooserWin.cpp"26881 >26882 </File>26883 <File26884 26880 RelativePath="..\platform\win\FileSystemWin.cpp" 26885 26881 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r89036 r89039 61 61 0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */; }; 62 62 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772A0AB603B700238CC4 /* FileChooser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 63 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 066C772C0AB603D200238CC4 /* FileChooserMac.mm */; };64 63 066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 066C772E0AB603FD00238CC4 /* RenderFileUploadControl.cpp */; }; 65 64 066C77310AB603FD00238CC4 /* RenderFileUploadControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772F0AB603FD00238CC4 /* RenderFileUploadControl.h */; }; … … 6363 6362 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PopupMenuMac.mm; sourceTree = "<group>"; }; 6364 6363 066C772A0AB603B700238CC4 /* FileChooser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FileChooser.h; sourceTree = "<group>"; }; 6365 066C772C0AB603D200238CC4 /* FileChooserMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FileChooserMac.mm; sourceTree = "<group>"; };6366 6364 066C772E0AB603FD00238CC4 /* RenderFileUploadControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFileUploadControl.cpp; sourceTree = "<group>"; }; 6367 6365 066C772F0AB603FD00238CC4 /* RenderFileUploadControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFileUploadControl.h; sourceTree = "<group>"; }; … … 14172 14170 5DC87EEF11716DF2001C0E6D /* EmptyProtocolDefinitions.h */, 14173 14171 1CA19E030DC255950065A994 /* EventLoopMac.mm */, 14174 066C772C0AB603D200238CC4 /* FileChooserMac.mm */,14175 14172 514B3F750C722055000530DF /* FileSystemMac.mm */, 14176 14173 935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */, … … 23865 23862 976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */, 23866 23863 934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */, 23867 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */,23868 23864 89878561122CA064003AABDA /* FileEntry.cpp in Sources */, 23869 23865 893C480E1248BD3A002B3D86 /* FileEntrySync.cpp in Sources */, -
trunk/Source/WebCore/platform/FileChooser.h
r88977 r89039 62 62 63 63 const Vector<String>& filenames() const { return m_filenames; } 64 String basenameForWidth(const Font&, int width) const;65 64 66 65 Icon* icon() const { return m_icon.get(); } -
trunk/Source/WebCore/platform/FileSystem.h
r84059 r89039 202 202 #endif 203 203 204 #if PLATFORM(CHROMIUM)205 String pathGetDisplayFileName(const String&);206 #endif207 208 204 #if PLATFORM(GTK) 209 205 String filenameToString(const char*); -
trunk/Source/WebCore/platform/chromium/FileSystemChromiumLinux.cpp
r48095 r89039 39 39 } 40 40 41 String pathGetDisplayFileName(const String& path)42 {43 return pathGetFileName(path);44 }45 46 41 } // namespace WebCore -
trunk/Source/WebCore/platform/chromium/FileSystemChromiumMac.mm
r48095 r89039 42 42 } 43 43 44 String pathGetDisplayFileName(const String& path)45 {46 return [[NSFileManager defaultManager] displayNameAtPath:path];47 }48 49 44 } // namespace WebCore -
trunk/Source/WebCore/platform/chromium/FileSystemChromiumWin.cpp
r48095 r89039 42 42 } 43 43 44 String pathGetDisplayFileName(const String& path)45 {46 return pathGetFileName(path);47 }48 49 44 } // namespace WebCore -
trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
r88405 r89039 27 27 28 28 #include "CSSValueKeywords.h" 29 #include "FileSystem.h" 29 30 #include "GOwnPtr.h" 30 31 #include "Gradient.h" … … 33 34 #include "HTMLMediaElement.h" 34 35 #include "HTMLNames.h" 36 #include "LocalizedStrings.h" 35 37 #include "MediaControlElements.h" 36 38 #include "PaintInfo.h" … … 38 40 #include "RenderBox.h" 39 41 #include "RenderObject.h" 42 #include "StringTruncator.h" 40 43 #include "TimeRanges.h" 41 44 #include "UserAgentStyleSheets.h" 42 45 #include <gdk/gdk.h> 46 #include <glib.h> 43 47 #include <gtk/gtk.h> 48 #include <wtf/text/CString.h> 44 49 45 50 #if ENABLE(PROGRESS_TAG) … … 678 683 #endif 679 684 680 } 685 static bool stringByAdoptingFileSystemRepresentation(gchar* systemFilename, String& result) 686 { 687 if (!systemFilename) 688 return false; 689 690 result = filenameToString(systemFilename); 691 g_free(systemFilename); 692 693 return true; 694 } 695 696 String RenderThemeGtk::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width) 697 { 698 if (width <= 0) 699 return String(); 700 701 String string = fileButtonNoFileSelectedLabel(); 702 703 if (filenames.size() == 1) { 704 CString systemFilename = fileSystemRepresentation(filenames[0]); 705 gchar* systemBasename = g_path_get_basename(systemFilename.data()); 706 stringByAdoptingFileSystemRepresentation(systemBasename, string); 707 } else if (filenames.size() > 1) 708 return StringTruncator::rightTruncate(multipleFileUploadText(filenames.size()), width, font); 709 710 return StringTruncator::centerTruncate(string, width, font); 711 } 712 713 } -
trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h
r88405 r89039 176 176 177 177 private: 178 virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width); 179 178 180 void platformInit(); 179 181 static void setTextInputBorders(RenderStyle*); -
trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp
r88787 r89039 48 48 #include "QtMobileWebStyle.h" 49 49 #endif 50 #include "LocalizedStrings.h" 50 51 #if ENABLE(VIDEO) 51 52 #include "MediaControlElements.h" … … 70 71 #include <QApplication> 71 72 #include <QColor> 73 #include <QCoreApplication> 72 74 #include <QFile> 75 #include <QFontMetrics> 73 76 #include <QLineEdit> 74 77 #include <QMacStyle> … … 1501 1504 } 1502 1505 1506 String RenderThemeQt::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width) 1507 { 1508 if (width <= 0) 1509 return String(); 1510 1511 String string; 1512 if (filenames.isEmpty()) 1513 string = fileButtonNoFileSelectedLabel(); 1514 else if (filenames.size() == 1) { 1515 String fname = filenames[0]; 1516 QFontMetrics fm(f.font()); 1517 string = fm.elidedText(fname, Qt::ElideLeft, width); 1518 } else { 1519 int n = filenames.size(); 1520 string = QCoreApplication::translate("QWebPage", "%n file(s)", 1521 "number of chosen file", 1522 QCoreApplication::CodecForTr, n); 1523 } 1524 1525 return string; 1526 } 1527 1503 1528 } 1504 1529 -
trunk/Source/WebCore/platform/qt/RenderThemeQt.h
r88410 r89039 161 161 virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; } 162 162 private: 163 virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width); 164 163 165 void paintMediaBackground(QPainter* painter, const IntRect& r) const; 164 166 double mediaControlsBaselineOpacity() const; -
trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp
r88622 r89039 316 316 String RenderFileUploadControl::fileTextValue() const 317 317 { 318 return m_fileChooser->basenameForWidth(style()->font(), maxFilenameWidth());318 return theme()->fileListNameForWidth(m_fileChooser->filenames(), style()->font(), maxFilenameWidth()); 319 319 } 320 320 -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r88757 r89039 25 25 #include "CSSValueKeywords.h" 26 26 #include "Document.h" 27 #include "FileSystem.h" 27 28 #include "FloatConversion.h" 28 29 #include "FocusController.h" … … 33 34 #include "HTMLInputElement.h" 34 35 #include "HTMLNames.h" 36 #include "LocalizedStrings.h" 35 37 #include "MediaControlElements.h" 36 38 #include "Page.h" … … 39 41 #include "RenderView.h" 40 42 #include "Settings.h" 43 #include "StringTruncator.h" 41 44 #include "TextControlInnerElements.h" 42 45 … … 1092 1095 } 1093 1096 1097 String RenderTheme::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width) 1098 { 1099 if (width <= 0) 1100 return String(); 1101 1102 String string; 1103 if (filenames.isEmpty()) 1104 string = fileButtonNoFileSelectedLabel(); 1105 else if (filenames.size() == 1) 1106 string = pathGetFileName(filenames[0]); 1107 else 1108 return StringTruncator::rightTruncate(multipleFileUploadText(filenames.size()), width, font); 1109 1110 return StringTruncator::centerTruncate(string, width, font); 1111 } 1112 1113 1094 1114 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderTheme.h
r88405 r89039 204 204 virtual bool shouldShowPlaceholderWhenFocused() const { return false; } 205 205 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; 206 207 virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width); 206 208 207 209 protected: -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r88405 r89039 178 178 179 179 private: 180 virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width) const; 180 181 181 182 IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r88469 r89039 35 35 #import "ImageBuffer.h" 36 36 #import "LocalCurrentGraphicsContext.h" 37 #import "LocalizedStrings.h" 37 38 #import "MediaControlElements.h" 38 39 #import "PaintInfo.h" … … 42 43 #import "RenderView.h" 43 44 #import "SharedBuffer.h" 45 #import "StringTruncator.h" 44 46 #import "TimeRanges.h" 45 47 #import "ThemeMac.h" … … 2050 2052 } 2051 2053 2054 String RenderThemeMac::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width) const 2055 { 2056 if (width <= 0) 2057 return String(); 2058 2059 String strToTruncate; 2060 if (filenames.isEmpty()) 2061 strToTruncate = fileButtonNoFileSelectedLabel(); 2062 else if (filenames.size() == 1) 2063 strToTruncate = [[NSFileManager defaultManager] displayNameAtPath:(filenames[0])]; 2064 else 2065 return StringTruncator::rightTruncate(multipleFileUploadText(filenames.size()), width, font); 2066 2067 return StringTruncator::centerTruncate(strToTruncate, width, font); 2068 } 2069 2052 2070 } // namespace WebCore
Note:
See TracChangeset
for help on using the changeset viewer.