[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:37:25 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 1740b472e47b7535fd5cf328e9a6426e2c591676
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 28 01:00:47 2004 +0000

    WebCore:
    	<rdar://problem/3564519>: API: please add a way to set the media type for a WebView
    
    
            Reviewed by Chris.
    
            * khtml/khtmlview.cpp:
            (KHTMLView::mediaType):
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::overrideMediaType):
            * kwq/WebCoreBridge.h:
    
    
    WebKit:
    	<rdar://problem/3279301>: API: WebKitErrorCannotFindPlugin and WebKitErrorCannotLoadPlugin should use PlugIn
    
    	<rdar://problem/3278513>: API: Need API to control the size of WebHistory
    
    	<rdar://problem/3564519>: API: please add a way to set the media type for a WebView
    	<rdar://problem/3565642>: API: allow a way to extend the MIME types that a WebView will display
    	<rdar://problem/3577693>: API: add ability to subclass WebView but still use it with Carbon
    
    	Reviewed by Chris.
    
            * Carbon.subproj/HIWebView.h:
            * Carbon.subproj/HIWebView.m:
            (HIWebViewCreate):
            (HIWebViewCreateWithClass):
            (HIWebViewConstructor):
            * History.subproj/WebHistory.h:
            * History.subproj/WebHistory.m:
            (-[WebHistoryPrivate setHistoryAgeInDaysLimit:]):
            (-[WebHistoryPrivate historyAgeInDaysLimit]):
            (-[WebHistoryPrivate setHistoryItemLimit:]):
            (-[WebHistoryPrivate historyItemLimit]):
            (-[WebHistoryPrivate _ageLimitDate]):
            (-[WebHistoryPrivate arrayRepresentation]):
            (-[WebHistory setHistoryItemLimit:]):
            (-[WebHistory historyItemLimit]):
            (-[WebHistory setHistoryAgeInDaysLimit:]):
            (-[WebHistory historyAgeInDaysLimit]):
            * History.subproj/WebHistoryPrivate.h:
            * Misc.subproj/WebKitErrors.h:
            * Misc.subproj/WebKitErrors.m:
            (registerErrors):
            * Plugins.subproj/WebNetscapePluginDocumentView.m:
            (-[WebNetscapePluginDocumentView setDataSource:]):
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge isViewSelected:]):
            (-[WebBridge overrideMediaType]):
            * WebView.subproj/WebView.h:
            * WebView.subproj/WebView.m:
            (-[WebViewPrivate dealloc]):
            (+[WebView MIMETypesShownAsHTML]):
            (+[WebView setMIMETypesShownAsHTML:]):
            (-[WebView customUserAgent]):
            (-[WebView setMediaStyle:]):
            (-[WebView mediaStyle]):
            * WebView.subproj/WebViewPrivate.h:
    
    WebBrowser:
    		<rdar://problem/3279301>: API: WebKitErrorCannotFindPlugin and WebKitErrorCannotLoadPlugin should use PlugIn
    
    
            Reviewed by Chris.
    
            * LoadProgressMonitor.m:
            (-[LoadProgressMonitor webView:plugInFailedWithError:dataSource:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6498 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7d26e7d..7413c81 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,16 @@
+2004-04-27  Richard Williamson   <rjw at apple.com>
+
+	<rdar://problem/3564519>: API: please add a way to set the media type for a WebView
+
+        Reviewed by Chris.
+
+        * khtml/khtmlview.cpp:
+        (KHTMLView::mediaType):
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::overrideMediaType):
+        * kwq/WebCoreBridge.h:
+
 2004-04-27  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Hyatt
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 0815908..628b5df 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -1325,6 +1325,12 @@ void KHTMLView::setMediaType( const QString &medium )
 
 QString KHTMLView::mediaType() const
 {
+#if APPLE_CHANGES
+    // See if we have an override type.
+    QString overrideType = KWQ(m_part)->overrideMediaType();
+    if (!overrideType.isNull())
+        return overrideType;
+#endif
     return m_medium;
 }
 
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 99ede75..214e54c 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -243,6 +243,8 @@ public:
 
     KWQWindowWidget *topLevelWidget();
     
+    QString overrideMediaType();
+    
     void setMediaType(const QString &);
 
     void setUsesInactiveTextBackgroundColor(bool u) { _usesInactiveTextBackgroundColor = u; }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 1dca482..73a1065 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2753,6 +2753,14 @@ void KWQKHTMLPart::setBridge(WebCoreBridge *p)
     _windowWidget = new KWQWindowWidget(_bridge);
 }
 
+QString KWQKHTMLPart::overrideMediaType()
+{
+    NSString *overrideType = [_bridge overrideMediaType];
+    if (overrideType)
+        return QString::fromNSString(overrideType);
+    return QString();
+}
+
 void KWQKHTMLPart::setMediaType(const QString &type)
 {
     if (d->m_view) {
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 90899fc..e699763 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -445,6 +445,8 @@ typedef enum {
 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
 - (BOOL)isViewSelected:(NSView *)view;
 
+- (NSString *)overrideMediaType;
+
 @end
 
 // This interface definition allows those who hold a WebCoreBridge * to call all the methods
diff --git a/WebKit/Carbon.subproj/HIWebView.h b/WebKit/Carbon.subproj/HIWebView.h
index 51added..17dfd8c 100644
--- a/WebKit/Carbon.subproj/HIWebView.h
+++ b/WebKit/Carbon.subproj/HIWebView.h
@@ -44,6 +44,27 @@ HIWebViewCreate(HIViewRef * outControl);
 
 
 /*
+ *  HIWebViewCreateWithClass(HIViewRef * outControl, Class aClass)
+ *  
+ *  Summary:
+ *    Creates a new web view using the specified subclass of WebView.
+ *  
+ *  Parameters:
+ *    
+ *    outControl:
+ *      The new web view.
+ *  
+ *  Result:
+ *    An operating system status code.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.4 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ */
+extern OSStatus HIWebViewCreateWithClass(Class aClass, HIViewRef * outControl);
+
+/*
  *  HIWebViewGetWebView()
  *  
  *  Summary:
diff --git a/WebKit/Carbon.subproj/HIWebView.m b/WebKit/Carbon.subproj/HIWebView.m
index 2b2fb50..c57af56 100644
--- a/WebKit/Carbon.subproj/HIWebView.m
+++ b/WebKit/Carbon.subproj/HIWebView.m
@@ -202,6 +202,8 @@ static inline void HIRectToQDRect( const HIRect* inRect, Rect* outRect )
     outRect->right = CGRectGetMaxX( *inRect );
 }
 
+static Class webViewClass;
+
 //----------------------------------------------------------------------------------
 // HIWebViewCreate
 //----------------------------------------------------------------------------------
@@ -213,6 +215,23 @@ HIWebViewCreate( HIViewRef* outControl )
     
 	HIWebViewRegisterClass();
 
+    webViewClass = [WebView class];
+	err = HIObjectCreate( kHIWebViewClassID, NULL, (HIObjectRef*)outControl );
+
+	return err;
+}
+
+//----------------------------------------------------------------------------------
+// HIWebViewCreateWithClass
+//----------------------------------------------------------------------------------
+//
+OSStatus HIWebViewCreateWithClass(Class aClass, HIViewRef * outControl)
+{
+	OSStatus			err;
+    
+	HIWebViewRegisterClass();
+
+    webViewClass = aClass;
 	err = HIObjectCreate( kHIWebViewClassID, NULL, (HIObjectRef*)outControl );
 
 	return err;
@@ -238,6 +257,7 @@ HIWebViewGetWebView( HIViewRef inView )
 // HIWebViewConstructor
 //----------------------------------------------------------------------------------
 //
+
 static HIWebView*
 HIWebViewConstructor( HIViewRef inView )
 {
@@ -249,7 +269,7 @@ HIWebViewConstructor( HIViewRef inView )
 	
 		view->fViewRef = inView;
 
-		view->fWebView = [[WebView alloc] initWithFrame: frame];
+		view->fWebView = [[webViewClass alloc] initWithFrame: frame];
 		[HIViewAdapter bindHIViewToNSView:inView nsView:view->fWebView];
 		
 		view->fFirstResponder = NULL;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9a5e0c6..2adcb88 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,51 @@
+2004-04-27  Richard Williamson   <rjw at apple.com>
+
+	Fixes for:
+
+	<rdar://problem/3279301>: API: WebKitErrorCannotFindPlugin and WebKitErrorCannotLoadPlugin should use PlugIn
+	<rdar://problem/3278513>: API: Need API to control the size of WebHistory
+	<rdar://problem/3564519>: API: please add a way to set the media type for a WebView
+	<rdar://problem/3565642>: API: allow a way to extend the MIME types that a WebView will display
+	<rdar://problem/3577693>: API: add ability to subclass WebView but still use it with Carbon
+        
+	Reviewed by Chris.
+
+        * Carbon.subproj/HIWebView.h:
+        * Carbon.subproj/HIWebView.m:
+        (HIWebViewCreate):
+        (HIWebViewCreateWithClass):
+        (HIWebViewConstructor):
+        * History.subproj/WebHistory.h:
+        * History.subproj/WebHistory.m:
+        (-[WebHistoryPrivate setHistoryAgeInDaysLimit:]):
+        (-[WebHistoryPrivate historyAgeInDaysLimit]):
+        (-[WebHistoryPrivate setHistoryItemLimit:]):
+        (-[WebHistoryPrivate historyItemLimit]):
+        (-[WebHistoryPrivate _ageLimitDate]):
+        (-[WebHistoryPrivate arrayRepresentation]):
+        (-[WebHistory setHistoryItemLimit:]):
+        (-[WebHistory historyItemLimit]):
+        (-[WebHistory setHistoryAgeInDaysLimit:]):
+        (-[WebHistory historyAgeInDaysLimit]):
+        * History.subproj/WebHistoryPrivate.h:
+        * Misc.subproj/WebKitErrors.h:
+        * Misc.subproj/WebKitErrors.m:
+        (registerErrors):
+        * Plugins.subproj/WebNetscapePluginDocumentView.m:
+        (-[WebNetscapePluginDocumentView setDataSource:]):
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge isViewSelected:]):
+        (-[WebBridge overrideMediaType]):
+        * WebView.subproj/WebView.h:
+        * WebView.subproj/WebView.m:
+        (-[WebViewPrivate dealloc]):
+        (+[WebView MIMETypesShownAsHTML]):
+        (+[WebView setMIMETypesShownAsHTML:]):
+        (-[WebView customUserAgent]):
+        (-[WebView setMediaStyle:]):
+        (-[WebView mediaStyle]):
+        * WebView.subproj/WebViewPrivate.h:
+
 2004-04-27  David Hyatt  <hyatt at apple.com>
 
 	Eliminate the preferences for timed/resource layouts.  Accessing them is now taking 0.5% on the cvs-base
diff --git a/WebKit/History.subproj/WebHistory.h b/WebKit/History.subproj/WebHistory.h
index b0d06ae..0ba34e5 100644
--- a/WebKit/History.subproj/WebHistory.h
+++ b/WebKit/History.subproj/WebHistory.h
@@ -117,4 +117,31 @@ extern NSString *WebHistoryItemsKey;
 */
 - (WebHistoryItem *)itemForURL:(NSURL *)URL;
 
+/*!
+    @method setHistoryItemLimit:
+    @discussion Limits the number of items that will be stored by the WebHistory.
+    @param limit The maximum number of items that will be stored by the WebHistory.
+*/
+- (void)setHistoryItemLimit:(int)limit;
+
+/*!
+    @method historyItemLimit
+    @result The maximum number of items that will be stored by the WebHistory.
+*/
+- (int)historyItemLimit;
+
+/*!
+    @method setHistoryAgeInDaysLimit:
+    @discussion setHistoryAgeInDaysLimit: sets the maximum number of days to be read from
+    stored history.
+    @param limit The maximum number of days to be read from stored history.
+*/
+- (void)setHistoryAgeInDaysLimit:(int)limit;
+
+/*!
+    @method historyAgeInDaysLimit
+    @return Returns the maximum number of days to be read from stored history.
+*/
+- (int)historyAgeInDaysLimit;
+
 @end
diff --git a/WebKit/History.subproj/WebHistory.m b/WebKit/History.subproj/WebHistory.m
index 1d1d6fd..d311e4e 100644
--- a/WebKit/History.subproj/WebHistory.m
+++ b/WebKit/History.subproj/WebHistory.m
@@ -288,15 +288,38 @@ NSString *DatesArrayKey = @"WebHistoryDates";
 
 #pragma mark ARCHIVING/UNARCHIVING
 
+- (void)setHistoryAgeInDaysLimit:(int)limit
+{
+    ageInDaysLimitSet = YES;
+    ageInDaysLimit = limit;
+}
+
+- (int)historyAgeInDaysLimit
+{
+    if (ageInDaysLimitSet)
+        return ageInDaysLimit;
+    return [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryAgeInDaysLimit"];
+}
+
+- (void)setHistoryItemLimit:(int)limit
+{
+    itemLimitSet = YES;
+    itemLimit = limit;
+}
+
+- (int)historyItemLimit
+{
+    if (itemLimitSet)
+        return itemLimit;
+    return [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+}
+
 // Return a date that marks the age limit for history entries saved to or
 // loaded from disk. Any entry on this day or older should be rejected,
 // as tested with -[NSCalendarDate compareDay:]
 - (NSCalendarDate *)_ageLimitDate
 {
-    int ageInDaysLimit;
-
-    ageInDaysLimit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryAgeInDaysLimit"];
-    return [[NSCalendarDate calendarDate] dateByAddingYears:0 months:0 days:-ageInDaysLimit
+    return [[NSCalendarDate calendarDate] dateByAddingYears:0 months:0 days:-[self historyAgeInDaysLimit]
                                                       hours:0 minutes:0 seconds:0];
 }
 
@@ -313,7 +336,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
 
     arrayRep = [NSMutableArray array];
 
-    limit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+    limit = [self historyItemLimit];
     ageLimitDate = [self _ageLimitDate];
     totalSoFar = 0;
     
@@ -780,4 +803,25 @@ static inline bool matchUnicodeLetter(UniChar c, UniChar lowercaseLetter)
 {
     return [_historyPrivate _ageLimitDate];
 }
+
+- (void)setHistoryItemLimit:(int)limit
+{
+    [_historyPrivate setHistoryItemLimit:limit];
+}
+
+- (int)historyItemLimit
+{
+    return [_historyPrivate historyItemLimit];
+}
+
+- (void)setHistoryAgeInDaysLimit:(int)limit
+{
+    [_historyPrivate setHistoryAgeInDaysLimit:limit];
+}
+
+- (int)historyAgeInDaysLimit
+{
+    return [_historyPrivate historyAgeInDaysLimit];
+}
+
 @end
diff --git a/WebKit/History.subproj/WebHistoryPrivate.h b/WebKit/History.subproj/WebHistoryPrivate.h
index bb0c9a0..29cd736 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.h
+++ b/WebKit/History.subproj/WebHistoryPrivate.h
@@ -18,6 +18,10 @@
     NSMutableDictionary *_entriesByURL;
     NSMutableArray *_datesWithEntries;
     NSMutableArray *_entriesByDate;
+    BOOL itemLimitSet;
+    int itemLimit;
+    BOOL ageInDaysLimitSet;
+    int ageInDaysLimit;
 }
 
 - (void)addItem:(WebHistoryItem *)entry;
@@ -38,6 +42,11 @@
 
 - (NSCalendarDate*)_ageLimitDate;
 
+- (void)setHistoryItemLimit:(int)limit;
+- (int)historyItemLimit;
+- (void)setHistoryAgeInDaysLimit:(int)limit;
+- (int)historyAgeInDaysLimit;
+
 @end
 
 @interface WebHistory (WebPrivate)
diff --git a/WebKit/Misc.subproj/WebKitErrors.h b/WebKit/Misc.subproj/WebKitErrors.h
index 28d2ef6..667488b 100644
--- a/WebKit/Misc.subproj/WebKitErrors.h
+++ b/WebKit/Misc.subproj/WebKitErrors.h
@@ -27,12 +27,12 @@ enum {
 /*!
     @enum
     @abstract Plug-in and java errors
-    @constant WebKitErrorCannotFindPlugin
-    @constant WebKitErrorCannotLoadPlugin
+    @constant WebKitErrorCannotFindPlugIn
+    @constant WebKitErrorCannotLoadPlugIn
     @constant WebKitErrorJavaUnavailable
 */
 enum {
-    WebKitErrorCannotFindPlugin = 				200,
-    WebKitErrorCannotLoadPlugin = 				201,
+    WebKitErrorCannotFindPlugIn = 				200,
+    WebKitErrorCannotLoadPlugIn = 				201,
     WebKitErrorJavaUnavailable = 				202,
 };
diff --git a/WebKit/Misc.subproj/WebKitErrors.m b/WebKit/Misc.subproj/WebKitErrors.m
index 7afd956..62ee45d 100644
--- a/WebKit/Misc.subproj/WebKitErrors.m
+++ b/WebKit/Misc.subproj/WebKitErrors.m
@@ -115,8 +115,8 @@ static void registerErrors()
         WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange,[NSNumber numberWithInt: WebKitErrorFrameLoadInterruptedByPolicyChange],
 
         // Plug-in and java errors
-        WebKitErrorDescriptionCannotFindPlugin,		[NSNumber numberWithInt: WebKitErrorCannotFindPlugin],
-        WebKitErrorDescriptionCannotLoadPlugin,		[NSNumber numberWithInt: WebKitErrorCannotLoadPlugin],
+        WebKitErrorDescriptionCannotFindPlugin,		[NSNumber numberWithInt: WebKitErrorCannotFindPlugIn],
+        WebKitErrorDescriptionCannotLoadPlugin,		[NSNumber numberWithInt: WebKitErrorCannotLoadPlugIn],
         WebKitErrorDescriptionJavaUnavailable,		[NSNumber numberWithInt: WebKitErrorJavaUnavailable],
         nil];
 
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m b/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
index 1467263..20202b7 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
@@ -79,7 +79,7 @@
     thePlugin = (WebNetscapePluginPackage *)[[WebPluginDatabase installedPlugins] pluginForMIMEType:MIME];
 
     if (![thePlugin load]) {
-        NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorCannotLoadPlugin
+        NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorCannotLoadPlugIn
                                                         contentURL:[[theDataSource request] URL]
                                                      pluginPageURL:nil
                                                         pluginName:[thePlugin name]
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 3819c87..98b0452 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -796,11 +796,11 @@
             ASSERT_NOT_REACHED();
         }
     } else {
-        errorCode = WebKitErrorCannotFindPlugin;
+        errorCode = WebKitErrorCannotFindPlugIn;
     }
 
     if (!errorCode && !view) {
-        errorCode = WebKitErrorCannotLoadPlugin;
+        errorCode = WebKitErrorCannotLoadPlugIn;
     }
 
     if (errorCode) {
@@ -1230,4 +1230,9 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
     return [view conformsToProtocol:@protocol(WebPluginSelection)] ? [(id <WebPluginSelection>)view isSelected] : NO;
 }
 
+- (NSString *)overrideMediaType
+{
+    return [[_frame webView] mediaStyle];
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 391a9d9..8985d7c 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -102,6 +102,22 @@ extern NSString *WebViewProgressFinishedNotification;
 + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType;
 
 /*!
+    @method MIMETypesShownAsHTML
+    @result Returns an array of NSStrings that describe the MIME types
+    WebKit will attempt to render as HTML.
+*/
++ (NSArray *)MIMETypesShownAsHTML;
+
+/*!
+    @method setMIMETypesShownAsHTML:
+    @discussion Sets the array of NSString MIME types that WebKit will
+    attempt to render as HTML.  Typically you will retrieve the built-in
+    array using MIMETypesShownAsHTML and add additional MIME types to that
+    array.
+*/
++ (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes;
+
+/*!
     @method initWithFrame:frameName:groupName:
     @abstract The designated initializer for WebView.
     @discussion Initialize a WebView with the supplied parameters. This method will 
@@ -309,6 +325,21 @@ extern NSString *WebViewProgressFinishedNotification;
 - (NSString *)customTextEncodingName;
 
 /*!
+    @method setMediaStyle:
+    @discussion Set the media style for the WebView.  The mediaStyle will override the normal value
+    of the CSS media property.  Setting the value to nil will restore the normal value.
+    @param mediaStyle The value to use for the CSS media property.
+*/
+- (void)setMediaStyle:(NSString *)mediaStyle;
+
+/*!
+    @method mediaStyle
+    @result mediaStyle The value to use for the CSS media property, as set by setMediaStyle:.  It
+    will be nil unless set by that method.
+*/
+- (NSString *)mediaStyle;
+
+/*!
     @method stringByEvaluatingJavaScriptFromString:
     @param script The text of the JavaScript.
     @result The result of the script, converted to a string, or nil for failure.
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index ee0fce0..9ec2fcb 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -28,6 +28,7 @@
 #import <WebKit/WebFrameInternal.h>
 #import <WebKit/WebFrameViewPrivate.h>
 #import <WebKit/WebHistoryItemPrivate.h>
+#import <WebKit/WebHTMLRepresentation.h>
 #import <WebKit/WebHTMLView.h>
 #import <WebKit/WebHTMLViewPrivate.h>
 #import <WebKit/WebIconDatabase.h>
@@ -140,6 +141,8 @@ NSString *_WebMainFrameURLKey =         @"mainFrameURL";
     
     [draggedTypes release];
     
+    [mediaStyle release];
+    
     [super dealloc];
 }
 
@@ -1157,6 +1160,44 @@ NSMutableDictionary *countInvocations;
     return [WebFrameView _canShowMIMETypeAsHTML:MIMEType];
 }
 
++ (NSArray *)MIMETypesShownAsHTML
+{
+    NSMutableDictionary *viewTypes = [WebFrameView _viewTypesAllowImageTypeOmission:YES];
+    NSEnumerator *enumerator = [viewTypes keyEnumerator];
+    id key;
+    NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease];
+    
+    while ((key = [enumerator nextObject])) {
+        if ([viewTypes objectForKey:key] == [WebHTMLView class]) {
+            [array addObject:key];
+        }
+    }
+    
+    return array;
+}
+
++ (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes
+{
+    NSEnumerator *enumerator;
+    id key;
+    
+    NSMutableDictionary *viewTypes = [WebFrameView _viewTypesAllowImageTypeOmission:YES];
+    enumerator = [viewTypes keyEnumerator];
+    while ((key = [enumerator nextObject])) {
+        if ([viewTypes objectForKey:key] == [WebHTMLView class]) {
+            [WebView _unregisterViewClassAndRepresentationClassForMIMEType:key];
+        }
+    }
+    
+    int i, count = [MIMETypes count];
+    for (i = 0; i < count; i++) {
+        [WebView registerViewClass:[WebHTMLView class] 
+                representationClass:[WebHTMLRepresentation class] 
+                forMIMEType:[MIMETypes objectAtIndex:i]];
+    }
+}
+
+
 - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName
 {
     _private->drawsBackground = YES;
@@ -1484,6 +1525,19 @@ NS_ENDHANDLER
     return _private->userAgentOverridden ? [[_private->userAgent retain] autorelease] : nil;
 }
 
+- (void)setMediaStyle:(NSString *)mediaStyle
+{
+    if (_private->mediaStyle != mediaStyle) {
+        [_private->mediaStyle release];
+        _private->mediaStyle = [mediaStyle copy];
+    }
+}
+
+- (NSString *)mediaStyle
+{
+    return _private->mediaStyle;
+}
+
 - (BOOL)supportsTextEncoding
 {
     id documentView = [[[self mainFrame] frameView] documentView];
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 45b0551..19a31b9 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -100,6 +100,8 @@ extern NSString *_WebMainFrameURLKey;
     NSArray *draggedTypes;
     BOOL drawsBackground;
     BOOL editable;
+    
+    NSString *mediaStyle;
 }
 @end
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list