Changeset 14030 in webkit


Ignore:
Timestamp:
Apr 23, 2006 8:47:00 PM (18 years ago)
Author:
mjs
Message:

WebCore:

Reviewed by Darin.


  • WebCore.exp:
  • WebCore.xcodeproj/project.pbxproj:
  • bridge/mac/WebCoreFrameBridge.h:
  • bridge/mac/WebCoreStringTruncator.h: Added.
  • bridge/mac/WebCoreStringTruncator.mm: Added. (stringWidth): (truncateString): (+[WebCoreStringTruncator widthOfString:font:]):
  • bridge/mac/WebCoreViewFactory.h:
  • kwq/KWQFileButton.h:
  • kwq/KWQFileButton.mm: (-[WebFileChooserButton initWithWidget::]): (-[WebCoreFileButton positionButton]): (-[WebCoreFileButton initWithWidget:]): (-[WebCoreFileButton initWithFrame:]): (-[WebCoreFileButton dealloc]): (-[WebCoreFileButton isFlipped]): (-[WebCoreFileButton drawRect:]): (-[WebCoreFileButton updateLabel]): (-[WebCoreFileButton setFilename:]): (-[WebCoreFileButton filename]): (-[WebCoreFileButton setFrameSize:]): (-[WebCoreFileButton bestVisualFrameSizeForCharacterCount:]): (-[WebCoreFileButton visualFrame]): (-[WebCoreFileButton setVisualFrame:]): (-[WebCoreFileButton baseline]): (-[WebCoreFileButton beginSheet]): (-[WebCoreFileButton chooseFilename:]): (-[WebCoreFileButton cancel]): (-[WebCoreFileButton chooseButtonPressed:]): (-[WebCoreFileButton mouseDown:]): (-[WebCoreFileButton acceptsFirstResponder]): (-[WebCoreFileButton becomeFirstResponder]): (-[WebCoreFileButton nextKeyView]): (-[WebCoreFileButton previousKeyView]): (-[WebCoreFileButton nextValidKeyView]): (-[WebCoreFileButton previousValidKeyView]): (-[WebCoreFileButton performClick]): (-[WebFileChooserButton initWithWidget:]): (-[WebFileChooserButton nextValidKeyView]): (-[WebFileChooserButton previousValidKeyView]): (-[WebFileChooserButton resignFirstResponder]): (KWQFileButton::KWQFileButton): (KWQFileButton::setFilename): (KWQFileButton::click): (KWQFileButton::sizeForCharacterWidth): (KWQFileButton::frameGeometry): (KWQFileButton::setFrameGeometry): (KWQFileButton::baselinePosition): (KWQFileButton::filenameChanged):

WebKit:

Reviewed by Darin.


  • Misc/WebStringTruncator.m: (+[WebStringTruncator centerTruncateString:toWidth:]): (+[WebStringTruncator centerTruncateString:toWidth:withFont:]): (+[WebStringTruncator rightTruncateString:toWidth:withFont:]): (+[WebStringTruncator widthOfString:font:]):
  • WebCoreSupport/WebFileButton.h: Removed.
  • WebCoreSupport/WebFileButton.m: Removed.
  • WebCoreSupport/WebFrameBridge.h:
  • WebCoreSupport/WebFrameBridge.m: (-[WebFrameBridge runOpenPanelForFileButtonWithResultListener:]):
  • WebCoreSupport/WebViewFactory.m: (-[WebViewFactory fileButtonChooseFileLabel]): (-[WebViewFactory fileButtonNoFileSelectedLabel]):
  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk
Files:
2 deleted
13 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r14029 r14030  
     12006-04-23  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Darin.
     4       
     5        - push WebFileButton and WebStringTruncator code down to WebCore
     6        http://bugzilla.opendarwin.org/show_bug.cgi?id=8552
     7
     8        * WebCore.exp:
     9        * WebCore.xcodeproj/project.pbxproj:
     10        * bridge/mac/WebCoreFrameBridge.h:
     11        * bridge/mac/WebCoreStringTruncator.h: Added.
     12        * bridge/mac/WebCoreStringTruncator.mm: Added.
     13        (stringWidth):
     14        (truncateString):
     15        (+[WebCoreStringTruncator widthOfString:font:]):
     16        * bridge/mac/WebCoreViewFactory.h:
     17        * kwq/KWQFileButton.h:
     18        * kwq/KWQFileButton.mm:
     19        (-[WebFileChooserButton initWithWidget::]):
     20        (-[WebCoreFileButton positionButton]):
     21        (-[WebCoreFileButton initWithWidget:]):
     22        (-[WebCoreFileButton initWithFrame:]):
     23        (-[WebCoreFileButton dealloc]):
     24        (-[WebCoreFileButton isFlipped]):
     25        (-[WebCoreFileButton drawRect:]):
     26        (-[WebCoreFileButton updateLabel]):
     27        (-[WebCoreFileButton setFilename:]):
     28        (-[WebCoreFileButton filename]):
     29        (-[WebCoreFileButton setFrameSize:]):
     30        (-[WebCoreFileButton bestVisualFrameSizeForCharacterCount:]):
     31        (-[WebCoreFileButton visualFrame]):
     32        (-[WebCoreFileButton setVisualFrame:]):
     33        (-[WebCoreFileButton baseline]):
     34        (-[WebCoreFileButton beginSheet]):
     35        (-[WebCoreFileButton chooseFilename:]):
     36        (-[WebCoreFileButton cancel]):
     37        (-[WebCoreFileButton chooseButtonPressed:]):
     38        (-[WebCoreFileButton mouseDown:]):
     39        (-[WebCoreFileButton acceptsFirstResponder]):
     40        (-[WebCoreFileButton becomeFirstResponder]):
     41        (-[WebCoreFileButton nextKeyView]):
     42        (-[WebCoreFileButton previousKeyView]):
     43        (-[WebCoreFileButton nextValidKeyView]):
     44        (-[WebCoreFileButton previousValidKeyView]):
     45        (-[WebCoreFileButton performClick]):
     46        (-[WebFileChooserButton initWithWidget:]):
     47        (-[WebFileChooserButton nextValidKeyView]):
     48        (-[WebFileChooserButton previousValidKeyView]):
     49        (-[WebFileChooserButton resignFirstResponder]):
     50        (KWQFileButton::KWQFileButton):
     51        (KWQFileButton::setFilename):
     52        (KWQFileButton::click):
     53        (KWQFileButton::sizeForCharacterWidth):
     54        (KWQFileButton::frameGeometry):
     55        (KWQFileButton::setFrameGeometry):
     56        (KWQFileButton::baselinePosition):
     57        (KWQFileButton::filenameChanged):
     58
    1592006-04-23  Maciej Stachowiak  <mjs@apple.com>
    260
  • trunk/WebCore/WebCore.exp

    r14029 r14030  
    105105.objc_class_name_WebCoreCache
    106106.objc_class_name_WebCoreEncodings
     107.objc_class_name_WebCoreFileButton
    107108.objc_class_name_WebCoreFrameBridge
    108109.objc_class_name_WebCoreFrameNamespaces
     
    113114.objc_class_name_WebCorePageBridge
    114115.objc_class_name_WebCoreScriptDebugger
     116.objc_class_name_WebCoreStringTruncator
    115117.objc_class_name_WebCoreSettings
    116118.objc_class_name_WebCoreTextDecoder
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r14029 r14030  
    116116                6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */; };
    117117                6582A17809999EA000BEEB6D /* QStringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A17709999EA000BEEB6D /* QStringMac.mm */; };
     118                65901A4409FC6039005BD752 /* WebCoreStringTruncator.h in Headers */ = {isa = PBXBuildFile; fileRef = 65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     119                65901A4509FC6039005BD752 /* WebCoreStringTruncator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65901A4309FC6039005BD752 /* WebCoreStringTruncator.mm */; };
    118120                6593923709AE4346002C531F /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* KURL.cpp */; };
    119121                6593923809AE4346002C531F /* KURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6593923609AE4346002C531F /* KURL.h */; };
     
    13251327                6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SystemTimeMac.cpp; sourceTree = "<group>"; };
    13261328                6582A17709999EA000BEEB6D /* QStringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = QStringMac.mm; sourceTree = "<group>"; };
     1329                65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreStringTruncator.h; sourceTree = "<group>"; };
     1330                65901A4309FC6039005BD752 /* WebCoreStringTruncator.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreStringTruncator.mm; sourceTree = "<group>"; };
    13271331                6593923509AE4346002C531F /* KURL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURL.cpp; sourceTree = "<group>"; };
    13281332                6593923609AE4346002C531F /* KURL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KURL.h; sourceTree = "<group>"; };
     
    28222826                        isa = PBXGroup;
    28232827                        children = (
     2828                                65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */,
     2829                                65901A4309FC6039005BD752 /* WebCoreStringTruncator.mm */,
    28242830                                BCEA4945097F0F770094C9E4 /* BrowserExtensionMac.h */,
    28252831                                BCEA4946097F0F770094C9E4 /* BrowserExtensionMac.mm */,
     
    47484754                                14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */,
    47494755                                93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */,
     4756                                65901A4409FC6039005BD752 /* WebCoreStringTruncator.h in Headers */,
    47504757                        );
    47514758                        runOnlyForDeploymentPostprocessing = 0;
     
    54475454                                14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */,
    54485455                                93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */,
     5456                                65901A4509FC6039005BD752 /* WebCoreStringTruncator.mm in Sources */,
    54495457                        );
    54505458                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r13990 r14030  
    6767@protocol WebCoreResourceHandle;
    6868@protocol WebCoreResourceLoader;
    69 @protocol WebCoreFileButton;
    70 @protocol WebCoreFileButtonDelegate;
    7169
    7270extern NSString *WebCorePageCacheStateKey;
     
    164162} ObjectElementType;
    165163
     164@protocol WebCoreOpenPanelResultListener <NSObject>
     165- (void)chooseFilename:(NSString *)fileName;
     166- (void)cancel;
     167@end
     168
    166169// WebCoreFrameBridge objects are used by WebCore to abstract away operations that need
    167170// to be implemented by library clients, for example WebKit. The objects are also
     
    536539- (BOOL)runBeforeUnloadConfirmPanelWithMessage:(NSString *)message;
    537540- (void)addMessageToConsole:(NSDictionary *)message;
     541- (void)runOpenPanelForFileButtonWithResultListener:(id <WebCoreOpenPanelResultListener>)resultListener;
    538542
    539543- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
     
    607611- (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector;
    608612- (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event;
    609 
    610 - (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
    611613
    612614- (void)setHasBorder:(BOOL)hasBorder;
     
    678680@end
    679681
    680 @protocol WebCoreFileButton <NSObject>
    681 - (void)setFilename:(NSString *)filename;
    682 - (void)performClick;
    683 - (NSString *)filename;
    684 - (float)baseline;
    685 - (void)setVisualFrame:(NSRect)rect;
    686 - (NSRect)visualFrame;
    687 - (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
    688 @end
    689 
    690 @protocol WebCoreFileButtonDelegate <NSObject>
    691 - (void)filenameChanged:(NSString *)filename;
    692 - (void)focusChanged:(BOOL)nowHasFocus;
    693 - (void)clicked;
    694 @end
  • trunk/WebCore/bridge/mac/WebCoreStringTruncator.h

    r14029 r14030  
    3131@class NSFont;
    3232
    33 @interface WebStringTruncator : NSObject
     33@interface WebCoreStringTruncator : NSObject
    3434
    3535+ (NSString *)centerTruncateString:(NSString *)string toWidth:(float)maxWidth withFont:(NSFont *)font;
  • trunk/WebCore/bridge/mac/WebCoreStringTruncator.mm

    r14029 r14030  
    2727 */
    2828
    29 #import <WebKit/WebStringTruncator.h>
     29#import "config.h"
     30#import "WebCoreStringTruncator.h"
    3031
    3132#import <Cocoa/Cocoa.h>
    3233
    33 #import <JavaScriptCore/Assertions.h>
    34 #import <WebKit/WebTextRendererFactory.h>
    35 #import <WebKit/WebTextRenderer.h>
     34#import <kxmlcore/Assertions.h>
     35#import "WebCoreTextRendererFactory.h"
     36#import "WebCoreTextRenderer.h"
    3637
    3738#define STRING_BUFFER_SIZE 2048
     
    3940
    4041static NSFont *currentFont;
    41 static WebTextRenderer *currentRenderer;
     42static id<WebCoreTextRenderer> currentRenderer;
    4243static float currentEllipsisWidth;
    4344
     
    7980}
    8081
    81 static float stringWidth(WebTextRenderer *renderer, const unichar *characters, unsigned length)
     82static float stringWidth(id<WebCoreTextRenderer> renderer, const unichar *characters, unsigned length)
    8283{
    8384    WebCoreTextRun run;
     
    113114        currentFont = [font retain];
    114115        [currentRenderer release];
    115         [WebTextRendererFactory createSharedFactory];
    116116        WebCoreFont f;
    117117        WebCoreInitializeFont(&f);
    118118        f.font = font;
    119         currentRenderer = [[[WebTextRendererFactory sharedFactory] rendererWithFont:f] retain];
     119        currentRenderer = [[[WebCoreTextRendererFactory sharedFactory] rendererWithFont:f] retain];
    120120        ellipsis = ELLIPSIS_CHARACTER;
    121121        currentEllipsisWidth = stringWidth(currentRenderer, &ellipsis, 1);
     
    155155        ratio = (keepCountForSmallestKnownToNotFit - keepCountForLargestKnownToFit)
    156156            / (widthForSmallestKnownToNotFit - widthForLargestKnownToFit);
    157         keepCount = maxWidth * ratio;
     157        keepCount = static_cast<unsigned>(maxWidth * ratio);
    158158       
    159159        if (keepCount <= keepCountForLargestKnownToFit) {
     
    192192}
    193193
    194 @implementation WebStringTruncator
     194@implementation WebCoreStringTruncator
    195195
    196196static NSFont *defaultMenuFont(void)
     
    221221{
    222222    unsigned length = [string length];
    223     unichar *s = malloc(sizeof(unichar) * length);
     223    unichar *s = static_cast<unichar*>(malloc(sizeof(unichar) * length));
    224224    [string getCharacters:s];
    225225    WebCoreFont f;
    226226    WebCoreInitializeFont(&f);
    227227    f.font = font;
    228     float width = stringWidth([[WebTextRendererFactory sharedFactory] rendererWithFont:f], s, length);
     228    float width = stringWidth([[WebCoreTextRendererFactory sharedFactory] rendererWithFont:f], s, length);
    229229    free(s);
    230230    return width;
  • trunk/WebCore/bridge/mac/WebCoreViewFactory.h

    r13064 r14030  
    4141- (NSString *)searchableIndexIntroduction;
    4242- (NSString *)submitButtonDefaultLabel;
     43- (NSString *)fileButtonChooseFileLabel;
     44- (NSString *)fileButtonNoFileSelectedLabel;
    4345
    4446- (NSMenu *)cellMenuForSearchField;
  • trunk/WebCore/kwq/KWQFileButton.h

    r13393 r14030  
    3131
    3232#ifdef __OBJC__
    33 @class KWQFileButtonAdapter;
     33@class WebCoreFileButton;
    3434#else
    35 class KWQFileButtonAdapter;
     35class WebCoreFileButton;
    3636#endif
    3737
     
    4343public:
    4444    KWQFileButton(WebCore::Frame*);
    45     ~KWQFileButton();
    4645   
    4746    void setFilename(const DeprecatedString &);
     
    6059
    6160private:
    62     KWQFileButtonAdapter* _adapter;
     61    WebCoreFileButton* _buttonView;
    6362    WebCore::String m_name;
    6463};
  • trunk/WebCore/kwq/KWQFileButton.mm

    r13821 r14030  
    3131#import "FrameMac.h"
    3232#import "WebCoreFrameBridge.h"
     33#import "WebCoreStringTruncator.h"
     34#import "WebCoreViewFactory.h"
    3335#import "render_form.h"
    3436
    3537using namespace WebCore;
    3638
    37 @interface KWQFileButtonAdapter : NSObject <WebCoreFileButtonDelegate>
    38 {
    39 @public
    40     KWQFileButton *button;
    41 }
    42 
    43 - initWithKWQFileButton:(KWQFileButton *)button;
    44 
    45 - (void)filenameChanged:(NSString *)filename;
    46 - (void)focusChanged:(BOOL)nowHasFocus;
    47 - (void)clicked;
    48 
     39#define NO_FILE_SELECTED
     40
     41#define AFTER_BUTTON_SPACING 4
     42#define ICON_HEIGHT 16
     43#define ICON_WIDTH 16
     44#define ICON_FILENAME_SPACING 2
     45
     46// We empirically determined that buttons have these extra pixels on all
     47// sides. It would be better to get this info from AppKit somehow.
     48#define BUTTON_TOP_MARGIN 4
     49#define BUTTON_BOTTOM_MARGIN 6
     50#define BUTTON_LEFT_MARGIN 5
     51#define BUTTON_RIGHT_MARGIN 5
     52
     53// AppKit calls this kThemePushButtonSmallTextOffset.
     54#define BUTTON_VERTICAL_FUDGE_FACTOR 2
     55
     56@interface WebFileChooserButton : NSButton
     57{
     58    KWQFileButton *_widget;
     59}
     60- (id)initWithWidget:(KWQFileButton *)widget;
    4961@end
    5062
     63@interface WebCoreFileButton : NSView <WebCoreOpenPanelResultListener>
     64{
     65    NSString *_filename;
     66    WebFileChooserButton *_button;
     67    NSImage *_icon;
     68    NSString *_label;
     69    BOOL _inNextValidKeyView;
     70    KWQFileButton *_widget;
     71}
     72- (void)setFilename:(NSString *)filename;
     73- (void)performClick;
     74- (NSString *)filename;
     75- (float)baseline;
     76- (void)setVisualFrame:(NSRect)rect;
     77- (NSRect)visualFrame;
     78- (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
     79- (id)initWithWidget:(KWQFileButton *)widget;
     80@end
     81
     82@implementation WebCoreFileButton
     83
     84- (void)positionButton
     85{
     86    [_button sizeToFit];
     87    [_button setFrameOrigin:NSMakePoint(0, 0)];
     88}
     89
     90- (id)initWithWidget:(KWQFileButton*)widget
     91{
     92    self = [super init];
     93    if (!self)
     94        return nil;
     95
     96    _widget = widget;
     97    return self;
     98}
     99
     100- (id)initWithFrame:(NSRect)frame
     101{
     102    self = [super initWithFrame:frame];
     103    if (self) {
     104        _button = [[WebFileChooserButton alloc] initWithWidget:_widget];
     105       
     106        [_button setTitle:[[WebCoreViewFactory sharedFactory] fileButtonChooseFileLabel]];
     107        [[_button cell] setControlSize:NSSmallControlSize];
     108        [_button setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
     109        [_button setBezelStyle:NSRoundedBezelStyle];
     110        [_button setTarget:self];
     111        [_button setAction:@selector(chooseButtonPressed:)];
     112        [_button setNextResponder:self];
     113       
     114        [self addSubview:_button];
     115       
     116        [self positionButton];
     117        [self setFilename:nil];
     118    }
     119    return self;
     120}
     121
     122- (void)dealloc
     123{
     124    [_filename release];
     125    [_button release];
     126    [_icon release];
     127    [_label release];
     128    [super dealloc];
     129}
     130
     131- (BOOL)isFlipped
     132{
     133    return YES;
     134}
     135       
     136- (void)drawRect:(NSRect)rect
     137{
     138    NSRect bounds = [self bounds];
     139   
     140    [NSGraphicsContext saveGraphicsState];
     141    NSRectClip(NSIntersectionRect(bounds, rect));
     142
     143    float left = NSMaxX([_button frame]) + AFTER_BUTTON_SPACING;
     144
     145    if (_icon) {
     146        float top = (bounds.size.height - BUTTON_BOTTOM_MARGIN - BUTTON_TOP_MARGIN - ICON_HEIGHT) / 2
     147            + BUTTON_TOP_MARGIN;
     148        [_icon drawInRect:NSMakeRect(left, top, ICON_WIDTH, ICON_HEIGHT)
     149            fromRect:NSMakeRect(0, 0, [_icon size].width, [_icon size].height)
     150            operation:NSCompositeSourceOver fraction:1.0];
     151        left += ICON_WIDTH + ICON_FILENAME_SPACING;
     152    }
     153
     154    NSFont *font = [_button font];
     155    NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
     156    [_label drawAtPoint:NSMakePoint(left, [self baseline] - [[_button font] ascender]) withAttributes:attributes];
     157
     158    [NSGraphicsContext restoreGraphicsState];
     159}
     160
     161- (void)updateLabel
     162{
     163    [_label release];
     164   
     165    NSString *label;
     166    if ([_filename length]) {
     167        label = _filename;
     168    } else {
     169        label = [[WebCoreViewFactory sharedFactory] fileButtonNoFileSelectedLabel];
     170    }
     171   
     172    float left = NSMaxX([_button frame]) + AFTER_BUTTON_SPACING;
     173    if (_icon) {
     174        left += ICON_WIDTH + ICON_FILENAME_SPACING;
     175    }
     176    float labelWidth = [self bounds].size.width - left;
     177
     178    _label = labelWidth <= 0 ? nil : [[WebCoreStringTruncator centerTruncateString:
     179        [[NSFileManager defaultManager] displayNameAtPath:label]
     180        toWidth:labelWidth withFont:[_button font]] copy];
     181}
     182
     183- (void)setFilename:(NSString *)filename
     184{
     185    NSString *copy = [filename copy];
     186    [_filename release];
     187    _filename = copy;
     188   
     189    [_icon release];
     190    if ([_filename length] == 0 || [_filename characterAtIndex:0] != '/') {
     191        _icon = nil;
     192    } else {
     193        _icon = [[[NSWorkspace sharedWorkspace] iconForFile:_filename] retain];
     194        // I'm not sure why this has any effect, but including this line of code seems to make
     195        // the image appear right-side-up. As far as I know, the drawInRect method used above
     196        // in our drawRect method should work regardless of whether the image is flipped or not.
     197        [_icon setFlipped:YES];
     198    }
     199   
     200    [self updateLabel];
     201   
     202    [self setNeedsDisplay:YES];
     203}
     204
     205- (NSString *)filename
     206{
     207    return [[_filename copy] autorelease];
     208}
     209
     210- (void)setFrameSize:(NSSize)size
     211{
     212    [super setFrameSize:size];
     213    // FIXME: Can we just springs and struts instead of calling positionButton?
     214    [self positionButton];
     215    [self updateLabel];
     216}
     217
     218- (NSSize)bestVisualFrameSizeForCharacterCount:(int)count
     219{
     220    ASSERT(count > 0);
     221    NSSize size = [[_button cell] cellSize];
     222    size.height -= BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN;
     223    size.width -= BUTTON_LEFT_MARGIN + BUTTON_RIGHT_MARGIN;
     224    size.width += AFTER_BUTTON_SPACING + ICON_WIDTH + ICON_FILENAME_SPACING;
     225    size.width += count * [@"x" sizeWithAttributes:[NSDictionary dictionaryWithObject:[_button font] forKey:NSFontAttributeName]].width;
     226    return size;
     227}
     228
     229- (NSRect)visualFrame
     230{
     231    ASSERT([self superview] == nil || [[self superview] isFlipped]);
     232    NSRect frame = [self frame];
     233    frame.origin.x += BUTTON_LEFT_MARGIN;
     234    frame.size.width -= BUTTON_LEFT_MARGIN;
     235    frame.origin.y += BUTTON_TOP_MARGIN;
     236    frame.size.height -= BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN;
     237    return frame;
     238}
     239
     240- (void)setVisualFrame:(NSRect)frame
     241{
     242    ASSERT([self superview] == nil || [[self superview] isFlipped]);
     243    frame.origin.x -= BUTTON_LEFT_MARGIN;
     244    frame.size.width += BUTTON_LEFT_MARGIN;
     245    frame.origin.y -= BUTTON_TOP_MARGIN;
     246    frame.size.height += BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN;
     247    [self setFrame:frame];
     248}
     249
     250- (float)baseline
     251{
     252    // Button text is centered vertically, with a fudge factor to account for the shadow.
     253    ASSERT(_button);
     254    NSFont *buttonFont = [_button font];
     255    float ascender = [buttonFont ascender];
     256    float descender = [buttonFont descender];
     257    return -BUTTON_TOP_MARGIN
     258        + ([[_button cell] cellSize].height + BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN - (ascender - descender)) / 2.0
     259        + ascender - BUTTON_VERTICAL_FUDGE_FACTOR;
     260}
     261
     262- (void)beginSheet
     263{
     264    WebCoreFrameBridge *bridge = FrameMac::bridgeForWidget(_widget);
     265    [bridge retain];
     266    [bridge runOpenPanelForFileButtonWithResultListener:self];
     267}
     268
     269- (void)chooseFilename:(NSString *)filename
     270{
     271    // The != check here makes sure we don't consider a change from nil to nil as a change.
     272    if (_filename != filename && ![_filename isEqualToString:filename]) {
     273        [self setFilename:filename];
     274        if (_widget)
     275            _widget->filenameChanged(DeprecatedString::fromNSString(filename));
     276    }
     277    WebCoreFrameBridge *bridge = FrameMac::bridgeForWidget(_widget);
     278    [bridge release];
     279}
     280
     281- (void)cancel
     282{
     283    WebCoreFrameBridge *bridge = FrameMac::bridgeForWidget(_widget);
     284    [bridge release];
     285}
     286
     287- (void)chooseButtonPressed:(id)sender
     288{
     289    if (_widget)
     290        _widget->sendConsumedMouseUp();
     291    if (_widget && _widget->client())
     292        _widget->client()->clicked(_widget);
     293    [self beginSheet];
     294}
     295
     296- (void)mouseDown:(NSEvent *)event
     297{
     298    [self beginSheet];
     299}
     300
     301- (BOOL)acceptsFirstResponder
     302{
     303    return YES;
     304}
     305
     306- (BOOL)becomeFirstResponder
     307{
     308    BOOL become = [_button acceptsFirstResponder];
     309    if (become) {
     310        if (_widget && _widget->client() && !FrameMac::currentEventIsMouseDownInWidget(_widget))
     311            _widget->client()->scrollToVisible(_widget);
     312        if (_widget && _widget->client())
     313            _widget->client()->focusIn(_widget);
     314        [[self window] makeFirstResponder:_button];
     315    }
     316    return become;
     317}
     318
     319- (NSView *)nextKeyView
     320{
     321    return _inNextValidKeyView
     322    ? FrameMac::nextKeyViewForWidget(_widget, KWQSelectingNext)
     323    : [super nextKeyView];
     324}
     325
     326- (NSView *)previousKeyView
     327{
     328    return _inNextValidKeyView
     329    ? FrameMac::nextKeyViewForWidget(_widget, KWQSelectingPrevious)
     330    : [super previousKeyView];
     331}
     332
     333- (NSView *)nextValidKeyView
     334{
     335    _inNextValidKeyView = YES;
     336    NSView *view = [super nextValidKeyView];
     337    _inNextValidKeyView = NO;
     338    return view;
     339}
     340
     341- (NSView *)previousValidKeyView
     342{
     343    _inNextValidKeyView = YES;
     344    NSView *view = [super previousValidKeyView];
     345    _inNextValidKeyView = NO;
     346    return view;
     347}
     348
     349- (void)performClick
     350{
     351    [_button performClick:nil];
     352}
     353
     354@end
     355
     356@implementation WebFileChooserButton
     357
     358- (id)initWithWidget:(KWQFileButton *)widget
     359{
     360    [super init];
     361    _widget = widget;
     362    return self;
     363}
     364
     365- (NSView *)nextValidKeyView
     366{
     367    return [[self superview] nextValidKeyView];
     368}
     369
     370- (NSView *)previousValidKeyView
     371{
     372    return [[self superview] previousValidKeyView];
     373}
     374
     375- (BOOL)resignFirstResponder
     376{
     377    if (_widget && _widget->client())
     378        _widget->client()->focusOut(_widget);
     379    return YES;
     380}
     381
     382@end
     383
     384
    51385KWQFileButton::KWQFileButton(Frame *frame)
    52     : _adapter(0)
    53 {
    54     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    55 
    56     _adapter = KWQRetainNSRelease([[KWQFileButtonAdapter alloc] initWithKWQFileButton:this]);
    57     setView([Mac(frame)->bridge() fileButtonWithDelegate:_adapter]);
    58 
    59     END_BLOCK_OBJC_EXCEPTIONS;
    60 }
    61 
    62 KWQFileButton::~KWQFileButton()
    63 {
    64     _adapter->button = 0;
    65     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    66     CFRelease(_adapter);
    67     END_BLOCK_OBJC_EXCEPTIONS;
    68 }
    69    
     386{
     387    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     388
     389    _buttonView = [[WebCoreFileButton alloc] initWithWidget:this];
     390    setView(_buttonView);
     391
     392    END_BLOCK_OBJC_EXCEPTIONS;
     393}
     394
    70395void KWQFileButton::setFilename(const DeprecatedString &f)
    71396{
    72     NSView <WebCoreFileButton> *button = getView();
    73 
    74     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    75     [button setFilename:f.getNSString()];
     397    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     398    [_buttonView setFilename:f.getNSString()];
    76399    END_BLOCK_OBJC_EXCEPTIONS;
    77400}
     
    79402void KWQFileButton::click(bool sendMouseEvents)
    80403{
    81     NSView <WebCoreFileButton> *button = getView();
    82 
    83     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    84     [button performClick];
     404    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     405    [_buttonView performClick];
    85406    END_BLOCK_OBJC_EXCEPTIONS;
    86407}
     
    89410{
    90411    ASSERT(characters > 0);
    91     NSView <WebCoreFileButton> *button = getView();
    92412
    93413    NSSize size = {0,0};
    94414    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    95     size = [button bestVisualFrameSizeForCharacterCount:characters];
     415    size = [_buttonView bestVisualFrameSizeForCharacterCount:characters];
    96416    return IntSize(size);
    97417    END_BLOCK_OBJC_EXCEPTIONS;
     
    101421IntRect KWQFileButton::frameGeometry() const
    102422{
    103     NSView <WebCoreFileButton> *button = getView();
    104 
    105     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    106     return enclosingIntRect([button visualFrame]);
     423    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     424    return enclosingIntRect([_buttonView visualFrame]);
    107425    END_BLOCK_OBJC_EXCEPTIONS;
    108426    return IntRect();
     
    111429void KWQFileButton::setFrameGeometry(const IntRect &rect)
    112430{
    113     NSView <WebCoreFileButton> *button = getView();
    114 
    115     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    116     [button setVisualFrame:rect];
     431    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     432    [_buttonView setVisualFrame:rect];
    117433    END_BLOCK_OBJC_EXCEPTIONS;
    118434}
     
    120436int KWQFileButton::baselinePosition(int height) const
    121437{
    122     NSView <WebCoreFileButton> *button = getView();
    123 
    124     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    125     return (int)([button frame].origin.y + [button baseline] - [button visualFrame].origin.y);
     438    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     439    return (int)([_buttonView frame].origin.y + [_buttonView baseline] - [_buttonView visualFrame].origin.y);
    126440    END_BLOCK_OBJC_EXCEPTIONS;
    127441
     
    149463        client()->valueChanged(this);
    150464}
    151 
    152 @implementation KWQFileButtonAdapter
    153 
    154 - initWithKWQFileButton:(KWQFileButton *)b
    155 {
    156     [super init];
    157     button = b;
    158     return self;
    159 }
    160 
    161 - (void)filenameChanged:(NSString *)filename
    162 {
    163     if (button)
    164         button->filenameChanged(DeprecatedString::fromNSString(filename));
    165 }
    166 
    167 - (void)focusChanged:(BOOL)nowHasFocus
    168 {
    169     if (nowHasFocus) {
    170         if (button && button->client() && !FrameMac::currentEventIsMouseDownInWidget(button))
    171             button->client()->scrollToVisible(button);
    172         if (button && button->client())
    173             button->client()->focusIn(button);
    174     } else {
    175         if (button && button->client())
    176             button->client()->focusOut(button);
    177     }
    178 }
    179 
    180 -(void)clicked
    181 {
    182     if (button)
    183         button->sendConsumedMouseUp();
    184     if (button && button->client())
    185         button->client()->clicked(button);
    186 }
    187 
    188 @end
  • trunk/WebKit/ChangeLog

    r14029 r14030  
     12006-04-23  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Darin.
     4       
     5        - push WebFileButton and WebStringTruncator code down to WebCore
     6        http://bugzilla.opendarwin.org/show_bug.cgi?id=8552
     7
     8        * Misc/WebStringTruncator.m:
     9        (+[WebStringTruncator centerTruncateString:toWidth:]):
     10        (+[WebStringTruncator centerTruncateString:toWidth:withFont:]):
     11        (+[WebStringTruncator rightTruncateString:toWidth:withFont:]):
     12        (+[WebStringTruncator widthOfString:font:]):
     13        * WebCoreSupport/WebFileButton.h: Removed.
     14        * WebCoreSupport/WebFileButton.m: Removed.
     15        * WebCoreSupport/WebFrameBridge.h:
     16        * WebCoreSupport/WebFrameBridge.m:
     17        (-[WebFrameBridge runOpenPanelForFileButtonWithResultListener:]):
     18        * WebCoreSupport/WebViewFactory.m:
     19        (-[WebViewFactory fileButtonChooseFileLabel]):
     20        (-[WebViewFactory fileButtonNoFileSelectedLabel]):
     21        * WebKit.xcodeproj/project.pbxproj:
     22
    1232006-04-23  Maciej Stachowiak  <mjs@apple.com>
    224
  • trunk/WebKit/Misc/WebStringTruncator.m

    r14021 r14030  
    2929#import <WebKit/WebStringTruncator.h>
    3030
    31 #import <Cocoa/Cocoa.h>
    32 
    33 #import <JavaScriptCore/Assertions.h>
     31#import <WebCore/WebCoreStringTruncator.h>
    3432#import <WebKit/WebTextRendererFactory.h>
    35 #import <WebKit/WebTextRenderer.h>
    36 
    37 #define STRING_BUFFER_SIZE 2048
    38 #define ELLIPSIS_CHARACTER 0x2026
    39 
    40 static NSFont *currentFont;
    41 static WebTextRenderer *currentRenderer;
    42 static float currentEllipsisWidth;
    43 
    44 typedef unsigned TruncationFunction(NSString *string, unsigned length, unsigned keepCount, unichar *buffer);
    45 
    46 static unsigned centerTruncateToBuffer(NSString *string, unsigned length, unsigned keepCount, unichar *buffer)
    47 {
    48     ASSERT(keepCount < length);
    49     ASSERT(keepCount < STRING_BUFFER_SIZE);
    50    
    51     unsigned omitStart = (keepCount + 1) / 2;
    52     unsigned omitEnd = NSMaxRange([string rangeOfComposedCharacterSequenceAtIndex:omitStart + (length - keepCount) - 1]);
    53     omitStart = [string rangeOfComposedCharacterSequenceAtIndex:omitStart].location;
    54    
    55     NSRange beforeRange = NSMakeRange(0, omitStart);
    56     NSRange afterRange = NSMakeRange(omitEnd, length - omitEnd);
    57    
    58     unsigned truncatedLength = beforeRange.length + 1 + afterRange.length;
    59     ASSERT(truncatedLength <= length);
    60 
    61     [string getCharacters:buffer range:beforeRange];
    62     buffer[beforeRange.length] = ELLIPSIS_CHARACTER;
    63     [string getCharacters:&buffer[beforeRange.length + 1] range:afterRange];
    64    
    65     return truncatedLength;
    66 }
    67 
    68 static unsigned rightTruncateToBuffer(NSString *string, unsigned length, unsigned keepCount, unichar *buffer)
    69 {
    70     ASSERT(keepCount < length);
    71     ASSERT(keepCount < STRING_BUFFER_SIZE);
    72    
    73     NSRange keepRange = NSMakeRange(0, [string rangeOfComposedCharacterSequenceAtIndex:keepCount].location);
    74    
    75     [string getCharacters:buffer range:keepRange];
    76     buffer[keepRange.length] = ELLIPSIS_CHARACTER;
    77    
    78     return keepRange.length + 1;
    79 }
    80 
    81 static float stringWidth(WebTextRenderer *renderer, const unichar *characters, unsigned length)
    82 {
    83     WebCoreTextRun run;
    84     WebCoreInitializeTextRun (&run, characters, length, 0, length);
    85     WebCoreTextStyle style;
    86     WebCoreInitializeEmptyTextStyle(&style);
    87     style.applyRunRounding = NO;
    88     style.applyWordRounding = NO;
    89     return [renderer floatWidthForRun:&run style:&style];
    90 }
    91 
    92 static NSString *truncateString(NSString *string, float maxWidth, NSFont *font, TruncationFunction truncateToBuffer)
    93 {
    94     unsigned length = [string length];
    95     if (length == 0) {
    96         return string;
    97     }
    98 
    99     unichar stringBuffer[STRING_BUFFER_SIZE];
    100     unsigned keepCount;
    101     unsigned truncatedLength;
    102     float width;
    103     unichar ellipsis;
    104     unsigned keepCountForLargestKnownToFit, keepCountForSmallestKnownToNotFit;
    105     float widthForLargestKnownToFit, widthForSmallestKnownToNotFit;
    106     float ratio;
    107    
    108     ASSERT_ARG(font, font);
    109     ASSERT_ARG(maxWidth, maxWidth >= 0);
    110    
    111     if (![currentFont isEqual:font]) {
    112         [currentFont release];
    113         currentFont = [font retain];
    114         [currentRenderer release];
    115         [WebTextRendererFactory createSharedFactory];
    116         WebCoreFont f;
    117         WebCoreInitializeFont(&f);
    118         f.font = font;
    119         currentRenderer = [[[WebTextRendererFactory sharedFactory] rendererWithFont:f] retain];
    120         ellipsis = ELLIPSIS_CHARACTER;
    121         currentEllipsisWidth = stringWidth(currentRenderer, &ellipsis, 1);
    122     }
    123    
    124     ASSERT(currentRenderer);
    125 
    126     if (length > STRING_BUFFER_SIZE) {
    127         keepCount = STRING_BUFFER_SIZE - 1; // need 1 character for the ellipsis
    128         truncatedLength = centerTruncateToBuffer(string, length, keepCount, stringBuffer);
    129     } else {
    130         keepCount = length;
    131         [string getCharacters:stringBuffer];
    132         truncatedLength = length;
    133     }
    134 
    135     width = stringWidth(currentRenderer, stringBuffer, truncatedLength);
    136     if (width <= maxWidth) {
    137         return string;
    138     }
    139 
    140     keepCountForLargestKnownToFit = 0;
    141     widthForLargestKnownToFit = currentEllipsisWidth;
    142    
    143     keepCountForSmallestKnownToNotFit = keepCount;
    144     widthForSmallestKnownToNotFit = width;
    145    
    146     if (currentEllipsisWidth >= maxWidth) {
    147         keepCountForLargestKnownToFit = 1;
    148         keepCountForSmallestKnownToNotFit = 2;
    149     }
    150    
    151     while (keepCountForLargestKnownToFit + 1 < keepCountForSmallestKnownToNotFit) {
    152         ASSERT(widthForLargestKnownToFit <= maxWidth);
    153         ASSERT(widthForSmallestKnownToNotFit > maxWidth);
    154 
    155         ratio = (keepCountForSmallestKnownToNotFit - keepCountForLargestKnownToFit)
    156             / (widthForSmallestKnownToNotFit - widthForLargestKnownToFit);
    157         keepCount = maxWidth * ratio;
    158        
    159         if (keepCount <= keepCountForLargestKnownToFit) {
    160             keepCount = keepCountForLargestKnownToFit + 1;
    161         } else if (keepCount >= keepCountForSmallestKnownToNotFit) {
    162             keepCount = keepCountForSmallestKnownToNotFit - 1;
    163         }
    164        
    165         ASSERT(keepCount < length);
    166         ASSERT(keepCount > 0);
    167         ASSERT(keepCount < keepCountForSmallestKnownToNotFit);
    168         ASSERT(keepCount > keepCountForLargestKnownToFit);
    169        
    170         truncatedLength = truncateToBuffer(string, length, keepCount, stringBuffer);
    171 
    172         width = stringWidth(currentRenderer, stringBuffer, truncatedLength);
    173         if (width <= maxWidth) {
    174             keepCountForLargestKnownToFit = keepCount;
    175             widthForLargestKnownToFit = width;
    176         } else {
    177             keepCountForSmallestKnownToNotFit = keepCount;
    178             widthForSmallestKnownToNotFit = width;
    179         }
    180     }
    181    
    182     if (keepCountForLargestKnownToFit == 0) {
    183         keepCountForLargestKnownToFit = 1;
    184     }
    185    
    186     if (keepCount != keepCountForLargestKnownToFit) {
    187         keepCount = keepCountForLargestKnownToFit;
    188         truncatedLength = truncateToBuffer(string, length, keepCount, stringBuffer);
    189     }
    190    
    191     return [NSString stringWithCharacters:stringBuffer length:truncatedLength];
    192 }
    19333
    19434@implementation WebStringTruncator
    19535
    196 static NSFont *defaultMenuFont(void)
    197 {
    198     static NSFont *defaultMenuFont = nil;
    199     if (defaultMenuFont == nil) {
    200         defaultMenuFont = [[NSFont menuFontOfSize:0] retain];
    201     }
    202     return defaultMenuFont;
    203 }
    204 
    20536+ (NSString *)centerTruncateString:(NSString *)string toWidth:(float)maxWidth
    20637{
    207     return truncateString(string, maxWidth, defaultMenuFont(), centerTruncateToBuffer);
     38    [WebTextRendererFactory createSharedFactory];
     39    return [WebCoreStringTruncator centerTruncateString:string toWidth:maxWidth];
    20840}
    20941
    21042+ (NSString *)centerTruncateString:(NSString *)string toWidth:(float)maxWidth withFont:(NSFont *)font
    21143{
    212     return truncateString(string, maxWidth, font, centerTruncateToBuffer);
     44    [WebTextRendererFactory createSharedFactory];
     45    return [WebCoreStringTruncator centerTruncateString:string toWidth:maxWidth withFont:font];
    21346}
    21447
    21548+ (NSString *)rightTruncateString:(NSString *)string toWidth:(float)maxWidth withFont:(NSFont *)font
    21649{
    217     return truncateString(string, maxWidth, font, rightTruncateToBuffer);
     50    [WebTextRendererFactory createSharedFactory];
     51    return [WebCoreStringTruncator rightTruncateString:string toWidth:maxWidth withFont:font];
    21852}
    21953
    22054+ (float)widthOfString:(NSString *)string font:(NSFont *)font
    22155{
    222     unsigned length = [string length];
    223     unichar *s = malloc(sizeof(unichar) * length);
    224     [string getCharacters:s];
    225     WebCoreFont f;
    226     WebCoreInitializeFont(&f);
    227     f.font = font;
    228     float width = stringWidth([[WebTextRendererFactory sharedFactory] rendererWithFont:f], s, length);
    229     free(s);
    230     return width;
     56    [WebTextRendererFactory createSharedFactory];
     57    return [WebCoreStringTruncator widthOfString:string font:font];
    23158}
    23259
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.h

    r12791 r14030  
    5454
    5555- (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
    56 - (void)runOpenPanelForFileButtonWithResultListener:(id <WebOpenPanelResultListener>)resultListener;
    5756- (BOOL)inNextKeyViewOutsideWebFrameViews;
    5857
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.m

    r14028 r14030  
    3636#import "WebDefaultUIDelegate.h"
    3737#import "WebEditingDelegate.h"
    38 #import "WebFileButton.h"
    3938#import "WebFormDataStream.h"
    4039#import "WebFormDelegate.h"
     
    409408}
    410409
    411 - (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate
    412 {
    413     return [[[WebFileButton alloc] initWithBridge:self delegate:delegate] autorelease];
    414 }
    415 
    416 - (void)runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
     410- (void)runOpenPanelForFileButtonWithResultListener:(id<WebCoreOpenPanelResultListener>)resultListener
    417411{
    418412    WebView *wv = [self webView];
    419     [[wv _UIDelegateForwarder] webView:wv runOpenPanelForFileButtonWithResultListener:resultListener];
    420 }
    421 
     413    [[wv _UIDelegateForwarder] webView:wv runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener];
     414}
    422415
    423416- (WebDataSource *)dataSource
  • trunk/WebKit/WebCoreSupport/WebViewFactory.m

    r14021 r14030  
    113113}
    114114
     115- (NSString *)fileButtonChooseFileLabel
     116{
     117    return UI_STRING("Choose File", "title for file button used in HTML forms");
     118}
     119
     120- (NSString *)fileButtonNoFileSelectedLabel
     121{
     122    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
     123}
     124
    115125- (NSMenu *)cellMenuForSearchField
    116126{
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r14029 r14030  
    9090                9398103A0824BF01008DF038 /* WebPluginViewFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DFF860365FE6A00CA2ACA /* WebPluginViewFactory.h */; settings = {ATTRIBUTES = (Public, ); }; };
    9191                9398103C0824BF01008DF038 /* WebFrameBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = F5AFB45E02B94DC8018635CA /* WebFrameBridge.h */; };
    92                 9398103E0824BF01008DF038 /* WebFileButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 9311022803667CF1008635CE /* WebFileButton.h */; };
    9392                939810400824BF01008DF038 /* WebImageRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE1F8A002A5C6F30ECA2ACD /* WebImageRenderer.h */; };
    9493                939810410824BF01008DF038 /* WebImageRendererFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE1F8A202A5C6F30ECA2ACD /* WebImageRendererFactory.h */; };
     
    223222                939810DD0824BF01008DF038 /* npapi.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F717230288493C018635CA /* npapi.m */; };
    224223                939810DE0824BF01008DF038 /* WebFrameBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AFB45F02B94DC8018635CA /* WebFrameBridge.m */; };
    225                 939810E00824BF01008DF038 /* WebFileButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9311022903667CF1008635CE /* WebFileButton.m */; };
    226224                939810E20824BF01008DF038 /* WebImageRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE1F8A102A5C6F30ECA2ACD /* WebImageRenderer.m */; };
    227225                939810E30824BF01008DF038 /* WebImageRendererFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */; };
     
    503501                930D02BB06275F640076701E /* WebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    504502                930D02BD06275F710076701E /* WebFrameInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    505                 9311022803667CF1008635CE /* WebFileButton.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFileButton.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    506                 9311022903667CF1008635CE /* WebFileButton.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebFileButton.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    507503                93154EF103A41270008635CE /* WebPanelAuthenticationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPanelAuthenticationHandler.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    508504                93154EF203A41270008635CE /* WebPanelAuthenticationHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPanelAuthenticationHandler.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    10501046                                F5AFB45F02B94DC8018635CA /* WebFrameBridge.m */,
    10511047                                9305892A070868B300E79D96 /* WebDashboardRegion.h */,
    1052                                 9311022803667CF1008635CE /* WebFileButton.h */,
    1053                                 9311022903667CF1008635CE /* WebFileButton.m */,
    10541048                                514C4C2A075E7DE500B89CAD /* WebImageDecodeItem.h */,
    10551049                                514C4C2B075E7DE500B89CAD /* WebImageDecodeItem.m */,
     
    12011195                                9398103A0824BF01008DF038 /* WebPluginViewFactory.h in Headers */,
    12021196                                9398103C0824BF01008DF038 /* WebFrameBridge.h in Headers */,
    1203                                 9398103E0824BF01008DF038 /* WebFileButton.h in Headers */,
    12041197                                939810400824BF01008DF038 /* WebImageRenderer.h in Headers */,
    12051198                                939810410824BF01008DF038 /* WebImageRendererFactory.h in Headers */,
     
    17831776                                939810DD0824BF01008DF038 /* npapi.m in Sources */,
    17841777                                939810DE0824BF01008DF038 /* WebFrameBridge.m in Sources */,
    1785                                 939810E00824BF01008DF038 /* WebFileButton.m in Sources */,
    17861778                                939810E20824BF01008DF038 /* WebImageRenderer.m in Sources */,
    17871779                                939810E30824BF01008DF038 /* WebImageRendererFactory.m in Sources */,
Note: See TracChangeset for help on using the changeset viewer.