Changeset 25140 in webkit


Ignore:
Timestamp:
Aug 17, 2007 7:00:40 PM (17 years ago)
Author:
aroben
Message:

Fix <rdar://5192578> Inspect Element should not appear in context menu in non-debug mode

We now follow the same logic as Mac WebKit for displaying the Inspect Element item:

1) If DisableWebKitDeveloperExtras is set to true, don't display it
2) If not, and we're in a debug build, display it
3) If not, and we're in a release build, display it if

WebKitDeveloperExtras is set to true

Reviewed by Ada.

  • Interfaces/IWebPreferencesPrivate.idl: Added.
  • WebKit.vcproj/Interfaces.vcproj: Add new IWebPreferencesPrivate.idl file to project.
  • WebKit.vcproj/WebKitGUID.vcproj: Added generated .c file for IWebPreferencesPrivate to project.
  • WebPreferenceKeysPrivate.h: Added new keys.
  • WebPreferences.cpp: Added IID_WebPreferences. (WebPreferences::postPreferencesChangesNotification): Added an explicit cast needed now that WebPreferences implements two interfaces. (WebPreferences::QueryInterface): Added new cases. (WebPreferences::setDeveloperExtrasEnabled): Added. (WebPreferences::developerExtrasEnabled): Added. (WebPreferences::developerExtrasDisabledByOverride): Added.
  • WebPreferences.h: Now implements IWebPreferencesPrivate.
  • WebView.cpp: (WebView::updateWebCoreSettingsFromPreferences): Call developerExtrasEnabled. (WebView::developerExtrasEnabled): Ported from -[WebView _developerExtrasEnabled].
  • WebView.h:
Location:
trunk/WebKit/win
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r25139 r25140  
     12007-08-17  Adam Roben  <aroben@apple.com>
     2
     3        Fix <rdar://5192578> Inspect Element should not appear in context menu in non-debug mode
     4
     5        We now follow the same logic as Mac WebKit for displaying the Inspect Element item:
     6            1) If DisableWebKitDeveloperExtras is set to true, don't display it
     7            2) If not, and we're in a debug build, display it
     8            3) If not, and we're in a release build, display it if
     9               WebKitDeveloperExtras is set to true
     10
     11        Reviewed by Ada.
     12
     13        * Interfaces/IWebPreferencesPrivate.idl: Added.
     14        * WebKit.vcproj/Interfaces.vcproj: Add new IWebPreferencesPrivate.idl
     15        file to project.
     16        * WebKit.vcproj/WebKitGUID.vcproj: Added generated .c file for
     17        IWebPreferencesPrivate to project.
     18        * WebPreferenceKeysPrivate.h: Added new keys.
     19        * WebPreferences.cpp: Added IID_WebPreferences.
     20        (WebPreferences::postPreferencesChangesNotification): Added an explicit
     21        cast needed now that WebPreferences implements two interfaces.
     22        (WebPreferences::QueryInterface): Added new cases.
     23        (WebPreferences::setDeveloperExtrasEnabled): Added.
     24        (WebPreferences::developerExtrasEnabled): Added.
     25        (WebPreferences::developerExtrasDisabledByOverride): Added.
     26        * WebPreferences.h: Now implements IWebPreferencesPrivate.
     27        * WebView.cpp:
     28        (WebView::updateWebCoreSettingsFromPreferences): Call developerExtrasEnabled.
     29        (WebView::developerExtrasEnabled): Ported from -[WebView _developerExtrasEnabled].
     30        * WebView.h:
     31
    1322007-08-17  Adam Roben  <aroben@apple.com>
    233
  • trunk/WebKit/win/WebKit.vcproj/Interfaces.vcproj

    r23398 r25140  
    349349                </File>
    350350                <File
     351                        RelativePath="..\Interfaces\IWebPreferencesPrivate.idl"
     352                        >
     353                </File>
     354                <File
    351355                        RelativePath="..\Interfaces\IWebResource.idl"
    352356                        >
  • trunk/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj

    r23357 r25140  
    210210                        >
    211211                </File>
    212     <File
     212                <File
    213213                        RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebDebugProgram_i.c"
    214214                        >
    215     </File>
    216     <File
     215                </File>
     216                <File
    217217                        RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebDocument_i.c"
    218218                        >
     
    308308                <File
    309309                        RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebPreferences_i.c"
     310                        >
     311                </File>
     312                <File
     313                        RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebPreferencesPrivate_i.c"
    310314                        >
    311315                </File>
  • trunk/WebKit/win/WebPreferenceKeysPrivate.h

    r25074 r25140  
    9797// If this key is present and has a value of true, we have already removed the default values from the user's preferences <rdar://problem/5214504>
    9898#define WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey "WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey"
     99
     100#define WebKitDeveloperExtrasEnabledPreferenceKey "WebKitDeveloperExtras"
     101#define DisableWebKitDeveloperExtrasPreferenceKey "DisableWebKitDeveloperExtras"
  • trunk/WebKit/win/WebPreferences.cpp

    r25139 r25140  
    4747#include <wtf/Vector.h>
    4848
     49#include <initguid.h>
     50// {A20B5645-692D-4147-BF80-E8CD84BE82A1}
     51DEFINE_GUID(IID_WebPreferences, 0xa20b5645, 0x692d, 0x4147, 0xbf, 0x80, 0xe8, 0xcd, 0x84, 0xbe, 0x82, 0xa1);
     52
    4953static unsigned long long WebSystemMainMemory()
    5054{
     
    97101{
    98102    IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
    99     HRESULT hr = nc->postNotificationName(webPreferencesChangedNotification(), this, 0);
     103    HRESULT hr = nc->postNotificationName(webPreferencesChangedNotification(), static_cast<IWebPreferences*>(this), 0);
    100104    if (FAILED(hr))
    101105        return hr;
     
    551555    else if (IsEqualGUID(riid, IID_IWebPreferences))
    552556        *ppvObject = static_cast<IWebPreferences*>(this);
     557    else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate))
     558        *ppvObject = static_cast<IWebPreferencesPrivate*>(this);
     559    else if (IsEqualGUID(riid, IID_WebPreferences))
     560        *ppvObject = static_cast<WebPreferences*>(this);
    553561    else
    554562        return E_NOINTERFACE;
     
    11491157    return S_OK;
    11501158}
     1159
     1160HRESULT WebPreferences::setDeveloperExtrasEnabled(BOOL enabled)
     1161{
     1162    setBoolValue(CFSTR(WebKitDeveloperExtrasEnabledPreferenceKey), enabled);
     1163    return S_OK;
     1164}
     1165
     1166HRESULT WebPreferences::developerExtrasEnabled(BOOL* enabled)
     1167{
     1168    if (!enabled)
     1169        return E_POINTER;
     1170
     1171    *enabled = boolValueForKey(CFSTR(WebKitDeveloperExtrasEnabledPreferenceKey));
     1172    return S_OK;
     1173}
     1174
     1175bool WebPreferences::developerExtrasDisabledByOverride()
     1176{
     1177    return !!boolValueForKey(CFSTR(DisableWebKitDeveloperExtrasPreferenceKey));
     1178}
  • trunk/WebKit/win/WebPreferences.h

    r25139 r25140  
    2828
    2929#include "IWebPreferences.h"
     30#include "IWebPreferencesPrivate.h"
    3031#include <CoreFoundation/CoreFoundation.h>
    3132#include <WebCore/BString.h>
    3233#include <wtf/RetainPtr.h>
    3334
    34 class WebPreferences : public IWebPreferences {
     35// {A20B5645-692D-4147-BF80-E8CD84BE82A1}
     36DEFINE_GUID(IID_WebPreferences, 0xa20b5645, 0x692d, 0x4147, 0xbf, 0x80, 0xe8, 0xcd, 0x84, 0xbe, 0x82, 0xa1);
     37
     38class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate {
    3539public:
    3640    static WebPreferences* createInstance();
     
    272276        /* [in] */ BOOL enabled);
    273277
     278    // IWebPreferencesPrivate
     279    virtual HRESULT STDMETHODCALLTYPE setDeveloperExtrasEnabled(
     280        /* [in] */ BOOL);
     281
     282    virtual HRESULT STDMETHODCALLTYPE developerExtrasEnabled(
     283        /* [retval][out] */ BOOL*);
     284
     285
    274286    // WebPreferences
     287
     288    // This method accesses a different preference key than developerExtrasEnabled.
     289    // See <rdar://5343767> for the justification.
     290    bool developerExtrasDisabledByOverride();
     291
    275292    static BSTR webPreferencesChangedNotification();
    276293    static void setInstance(WebPreferences* instance, BSTR identifier);
  • trunk/WebKit/win/WebView.cpp

    r25139 r25140  
    15211521    settings->setForceFTPDirectoryListings(true);
    15221522
    1523     // FIXME: make this read a preference like the Mac's WebKitDeveloperExtras
    1524     // or when Safari's IncludeDebugMenu is set
    1525     settings->setDeveloperExtrasEnabled(true);
     1523    settings->setDeveloperExtrasEnabled(developerExtrasEnabled());
    15261524
    15271525    m_mainFrame->invalidate(); // FIXME
    15281526
    15291527    return S_OK;
     1528}
     1529
     1530bool WebView::developerExtrasEnabled() const
     1531{
     1532    COMPtr<WebPreferences> webPrefs;
     1533    if (SUCCEEDED(m_preferences->QueryInterface(IID_WebPreferences, (void**)&webPrefs)) && webPrefs->developerExtrasDisabledByOverride())
     1534        return false;
     1535
     1536#ifdef NDEBUG
     1537    BOOL enabled = FALSE;
     1538    COMPtr<IWebPreferencesPrivate> prefsPrivate;
     1539    return SUCCEEDED(m_preferences->QueryInterface(&prefsPrivate)) && SUCCEEDED(prefsPrivate->developerExtrasEnabled(&enabled)) && enabled;
     1540#else
     1541    return true;
     1542#endif
    15301543}
    15311544
  • trunk/WebKit/win/WebView.h

    r24469 r25140  
    682682    bool onIMERequestCharPosition(WebCore::Frame*, IMECHARPOSITION*, LRESULT*);
    683683    bool onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*, LRESULT*);
     684    bool developerExtrasEnabled() const;
    684685
    685686    ULONG m_refCount;
Note: See TracChangeset for help on using the changeset viewer.