Changeset 39566 in webkit


Ignore:
Timestamp:
Jan 2, 2009 6:04:30 PM (15 years ago)
Author:
Darin Adler
Message:

WebCore:

2009-01-02 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

Bug 23072: REGRESSION (r37371): In the Dictionary application, scroll bar appears
inside its web view when resizing its window
https://bugs.webkit.org/show_bug.cgi?id=23072
rdar://problem/6368028

The first attempt at fixing this did not work.
This time I was able to reproduce the bug and test the fix.

Bug 11212: REGRESSION: Activity window doesn't always list all files until refresh
https://bugs.webkit.org/show_bug.cgi?id=11212
rdar://problem/4959702

I had to fix this second bug because otherwise the WebKit code to trigger the first
fix didn't run.

Also fixes memory use that kept growing as we maintained a set of all URLs loaded in
a particular frame. Bad idea! It's bad enough that we do it for each document, but
the old version kept the set around forever as you moved from one document to the next.

  • html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::parseMappedAttribute): Change this so that we allow turning off scrolling when the quirk is enabled. We just don't allow turning it on. This fixes one of the two problems with the initial patch; the other fix is in WebKit.
  • loader/DocumentLoader.h: Moved didTellClientAboutLoad and haveToldClientAboutLoad here from FrameLoader. The old way meant that a given frame would forever remember the URL of any resources loaded in that frame and never send any "loaded from cache" client calls about those URLs.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::loadResourceSynchronously): Removed call to didTellCientAboutLoad. This is now handled by dispatchWillSendRequest, which is safer since that's the actual function that tells the client about the load. (WebCore::FrameLoader::loadedResourceFromMemoryCache): Changed calls to haveToldClientAboutLoad and didTellClientAboutLoad to call the document loader. Also removed the call in the case where we don't load from the cache, since dispatchWillSendRequest now takes care of it. (WebCore::FrameLoader::dispatchWillSendRequest): Put calls to didTellClientAboutLoad here. Call it both on the URL we pass in and the URL the client returns; we won't tell the client about either if it's loaded from the memory cache.
  • loader/FrameLoader.h: Removed didTellClientAboutLoad, haveToldClientAboutLoad, and m_urlsClientKnowsAbout.
  • loader/SubresourceLoader.cpp: Removed unneeded load function that called didTellClientAboutLoad. That's now taken care of in dispatchWillSendRequest.
  • loader/SubresourceLoader.h: Removed load function. Also made all members private except for create and clearClient.

WebKit/mac:

2009-01-02 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

Bug 23072: REGRESSION (r37371): In the Dictionary application, scroll bar appears
inside its web view when resizing its window
https://bugs.webkit.org/show_bug.cgi?id=23072
rdar://problem/6368028

The first attempt at fixing this did not work.
This time I was able to reproduce the bug and test the fix.

  • WebCoreSupport/WebFrameLoaderClient.mm: (applyAppleDictionaryApplicationQuirkNonInlinePart): Changed the arguments and function names around a bit to make even less code at the call site. (applyAppleDictionaryApplicationQuirk): Put the check for whether this is the Dictionary application in here. (WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache): Put a call to applyAppleDictionaryApplicationQuirk here. This was a case I had missed before, when the script is cached. This fixes one of the two problems with the initial patch; the other fix is in WebCore. (WebFrameLoaderClient::dispatchWillSendRequest): Changed the applyAppleDictionaryApplicationQuirk call here to work the new simpler way.
  • WebView/WebView.mm: Had to add an include due to changes in WebCore header includes.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39564 r39566  
     12009-01-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Bug 23072: REGRESSION (r37371): In the Dictionary application, scroll bar appears
     6        inside its web view when resizing its window
     7        https://bugs.webkit.org/show_bug.cgi?id=23072
     8        rdar://problem/6368028
     9
     10        The first attempt at fixing this did not work.
     11        This time I was able to reproduce the bug and test the fix.
     12
     13        Bug 11212: REGRESSION: Activity window doesn't always list all files until refresh
     14        https://bugs.webkit.org/show_bug.cgi?id=11212
     15        rdar://problem/4959702
     16
     17        I had to fix this second bug because otherwise the WebKit code to trigger the first
     18        fix didn't run.
     19
     20        Also fixes memory use that kept growing as we maintained a set of all URLs loaded in
     21        a particular frame. Bad idea! It's bad enough that we do it for each document, but
     22        the old version kept the set around forever as you moved from one document to the next.
     23
     24        * html/HTMLFrameElementBase.cpp:
     25        (WebCore::HTMLFrameElementBase::parseMappedAttribute): Change this so that we allow
     26        turning off scrolling when the quirk is enabled. We just don't allow turning it on.
     27        This fixes one of the two problems with the initial patch; the other fix is in WebKit.
     28
     29        * loader/DocumentLoader.h: Moved didTellClientAboutLoad and haveToldClientAboutLoad
     30        here from FrameLoader. The old way meant that a given frame would forever remember
     31        the URL of any resources loaded in that frame and never send any "loaded from cache"
     32        client calls about those URLs.
     33
     34        * loader/FrameLoader.cpp:
     35        (WebCore::FrameLoader::loadResourceSynchronously): Removed call to didTellCientAboutLoad.
     36        This is now handled by dispatchWillSendRequest, which is safer since that's the actual
     37        function that tells the client about the load.
     38        (WebCore::FrameLoader::loadedResourceFromMemoryCache): Changed calls to
     39        haveToldClientAboutLoad and didTellClientAboutLoad to call the document loader.
     40        Also removed the call in the case where we don't load from the cache, since
     41        dispatchWillSendRequest now takes care of it.
     42        (WebCore::FrameLoader::dispatchWillSendRequest): Put calls to didTellClientAboutLoad
     43        here. Call it both on the URL we pass in and the URL the client returns; we won't
     44        tell the client about either if it's loaded from the memory cache.
     45
     46        * loader/FrameLoader.h: Removed didTellClientAboutLoad, haveToldClientAboutLoad, and
     47        m_urlsClientKnowsAbout.
     48
     49        * loader/SubresourceLoader.cpp: Removed unneeded load function that called
     50        didTellClientAboutLoad. That's now taken care of in dispatchWillSendRequest.
     51
     52        * loader/SubresourceLoader.h: Removed load function. Also made all members private
     53        except for create and clearClient.
     54
    1552009-01-02  Simon Fraser  <simon.fraser@apple.com>
    256
  • trunk/WebCore/html/HTMLFrameElementBase.cpp

    r39547 r39566  
    44 *           (C) 2000 Simon Hausmann (hausmann@kde.org)
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    6  * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
     6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
    77 *
    88 * This library is free software; you can redistribute it and/or
     
    130130        // FIXME: If we are already attached, this has no effect.
    131131    } else if (attr->name() == scrollingAttr) {
    132         if (document()->frameElementsShouldIgnoreScrolling())
    133             return;
    134132        // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
    135133        if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
    136             m_scrolling = ScrollbarAuto;
     134            m_scrolling = document()->frameElementsShouldIgnoreScrolling() ? ScrollbarAlwaysOff : ScrollbarAuto;
    137135        else if (equalIgnoringCase(attr->value(), "no"))
    138136            m_scrolling = ScrollbarAlwaysOff;
  • trunk/WebCore/loader/DocumentLoader.h

    r39546 r39566  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#define DocumentLoader_h
    3131
    32 #include "IconDatabase.h"
    3332#include "NavigationAction.h"
    34 #include <wtf/RefCounted.h>
    35 #include "PlatformString.h"
    3633#include "ResourceError.h"
    3734#include "ResourceRequest.h"
    3835#include "ResourceResponse.h"
    3936#include "SubstituteData.h"
    40 #include <wtf/HashSet.h>
    41 #include <wtf/RefPtr.h>
    42 #include <wtf/Vector.h>
     37#include "Timer.h"
    4338
    4439namespace WebCore {
    4540
    46 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    4741    class ApplicationCache;
    4842    class ApplicationCacheGroup;
    4943    class ApplicationCacheResource;
    50 #endif
    5144    class Archive;
    5245    class ArchiveResource;
     
    5548    class Frame;
    5649    class FrameLoader;
    57     class HistoryItem;
    58     class KURL;
    5950    class MainResourceLoader;
    6051    class ResourceLoader;
    6152    class SchedulePair;
    6253    class SharedBuffer;
    63     class SubstituteData;
    6454    class SubstituteResource;
    6555
     
    197187        bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
    198188       
     189        void didTellClientAboutLoad(const String& url) { m_resourcesClientKnowsAbout.add(url); }
     190        bool haveToldClientAboutLoad(const String& url) { return m_resourcesClientKnowsAbout.contains(url); }
     191
    199192#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    200193        bool scheduleApplicationCacheLoad(ResourceLoader*, const ResourceRequest&, const KURL& originalURL);
     
    290283        OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
    291284        RefPtr<SharedBuffer> m_parsedArchiveData;
    292        
     285
     286        HashSet<String> m_resourcesClientKnowsAbout;
     287
    293288#if ENABLE(OFFLINE_WEB_APPLICATIONS) 
    294289        // The application cache that the document loader is associated with (if any).
  • trunk/WebCore/loader/FrameLoader.cpp

    r39546 r39566  
    11/*
    2  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
    44 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
     
    805805void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects)
    806806{
    807     // FIXME: Commenting out the below line causes <http://bugs.webkit.org/show_bug.cgi?id=11212>, but putting it
    808     // back causes a measurable performance regression which we will need to fix to restore the correct behavior
    809     // urlsBridgeKnowsAbout.clear();
    810 
    811807    m_frame->editor()->clear();
    812808
     
    33863382}
    33873383
    3388 void FrameLoader::didTellClientAboutLoad(const String& url)
    3389 {
    3390     m_urlsClientKnowsAbout.add(url);
    3391 }
    3392 
    3393 bool FrameLoader::haveToldClientAboutLoad(const String& url)
    3394 {
    3395     return m_urlsClientKnowsAbout.contains(url);
    3396 }
    3397 
    33983384void FrameLoader::handledOnloadEvents()
    33993385{
     
    35863572    if (error.isNull()) {
    35873573        ASSERT(!newRequest.isNull());
    3588         didTellClientAboutLoad(newRequest.url().string());
    35893574       
    35903575#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     
    40384023        page->inspectorController()->didLoadResourceFromMemoryCache(m_documentLoader.get(), request, response, length);
    40394024
    4040     if (!resource->sendResourceLoadCallbacks() || haveToldClientAboutLoad(resource->url()))
     4025    if (!resource->sendResourceLoadCallbacks() || m_documentLoader->haveToldClientAboutLoad(request.url()))
    40414026        return;
    40424027
    40434028    if (m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, response, length)) {
    4044         didTellClientAboutLoad(resource->url());
     4029        m_documentLoader->didTellClientAboutLoad(request.url());
    40454030        return;
    40464031    }
     
    40514036    requestFromDelegate(r, identifier, error);
    40524037    sendRemainingDelegateMessages(identifier, response, length, error);
    4053 
    4054     didTellClientAboutLoad(resource->url());
    40554038}
    40564039
     
    51265109void FrameLoader::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
    51275110{
     5111    m_documentLoader->didTellClientAboutLoad(request.url());
    51285112    m_client->dispatchWillSendRequest(loader, identifier, request, redirectResponse);
     5113    m_documentLoader->didTellClientAboutLoad(request.url());
    51295114
    51305115    if (Page* page = m_frame->page())
  • trunk/WebCore/loader/FrameLoader.h

    r39432 r39566  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
    44 *
     
    3131#define FrameLoader_h
    3232
    33 #include "CachedResource.h"
    3433#include "CachePolicy.h"
    35 #include "FormState.h"
    3634#include "FrameLoaderTypes.h"
    37 #include "KURL.h"
    38 #include "StringHash.h"
     35#include "ResourceRequest.h"
    3936#include "Timer.h"
    40 #include <wtf/Forward.h>
    41 #include <wtf/HashSet.h>
    42 #include <wtf/HashMap.h>
    43 #include <wtf/Noncopyable.h>
    44 #include <wtf/OwnPtr.h>
    45 #include <wtf/RefPtr.h>
    46 #include "ResourceRequest.h"
     37
    4738#if USE(LOW_BANDWIDTH_DISPLAY)
    4839#include "CachedResourceClient.h"
     
    5243
    5344    class Archive;
    54     class ArchiveResource;
    5545    class AuthenticationChallenge;
    5646    class CachedPage;
     47    class CachedResource;
    5748    class Document;
    5849    class DocumentLoader;
     
    6051    class Event;
    6152    class FormData;
     53    class FormState;
    6254    class Frame;
    6355    class FrameLoaderClient;
     
    6860    class IntSize;
    6961    class NavigationAction;
    70     class Node;
    71     class Page;
    7262    class RenderPart;
    7363    class ResourceError;
    7464    class ResourceLoader;
    75     class ResourceRequest;
    7665    class ResourceResponse;
    7766    class ScriptSourceCode;
     
    127116    class FrameLoader : Noncopyable
    128117#if USE(LOW_BANDWIDTH_DISPLAY)
    129     , private CachedResourceClient
     118        , private CachedResourceClient
    130119#endif
    131120    {
     
    405394        KURL completeURL(const String& url);
    406395
    407         void didTellClientAboutLoad(const String& url);
    408         bool haveToldClientAboutLoad(const String& url);
    409 
    410396        KURL originalRequestURL() const;
    411397
     
    619605        String m_outgoingReferrer;
    620606
    621         HashSet<String> m_urlsClientKnowsAbout;
    622 
    623607        OwnPtr<FormSubmission> m_deferredFormSubmission;
    624608
  • trunk/WebCore/loader/SubresourceLoader.cpp

    r39393 r39566  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "SubresourceLoader.h"
    3131
    32 #include "Document.h"
    3332#include "DocumentLoader.h"
    3433#include "Frame.h"
    3534#include "FrameLoader.h"
    36 #include "Logging.h"
    3735#include "ResourceHandle.h"
    38 #include "ResourceRequest.h"
    3936#include "SubresourceLoaderClient.h"
    40 #include "SharedBuffer.h"
    4137#include <wtf/RefCountedLeakCounter.h>
    4238
     
    6359    subresourceLoaderCounter.decrement();
    6460#endif
    65 }
    66 
    67 bool SubresourceLoader::load(const ResourceRequest& r)
    68 {
    69     m_frame->loader()->didTellClientAboutLoad(r.url().string());
    70    
    71     return ResourceLoader::load(r);
    7261}
    7362
  • trunk/WebCore/loader/SubresourceLoader.h

    r39393 r39566  
    11/*
    2  * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131 
    3232#include "ResourceLoader.h"
    33 #include <wtf/PassRefPtr.h>
    3433 
    3534namespace WebCore {
    3635
    37     class FormData;
    38     class String;
    39     class ResourceHandle;
    4036    class ResourceRequest;
    4137    class SubresourceLoaderClient;
     
    4440    public:
    4541        static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true);
    46        
     42
     43        void clearClient() { m_client = 0; }
     44
     45    private:
     46        SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
    4747        virtual ~SubresourceLoader();
    48 
    49         virtual bool load(const ResourceRequest&);
    5048       
    5149        virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
     
    5755        virtual bool shouldUseCredentialStorage();
    5856        virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
    59         virtual void receivedCancellation(const AuthenticationChallenge&);
    60        
    61         void clearClient() { m_client = 0; }
     57        virtual void receivedCancellation(const AuthenticationChallenge&);       
     58        virtual void didCancel(const ResourceError&);
    6259
    63     private:
    64         SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
    65 
    66         virtual void didCancel(const ResourceError&);
    6760        SubresourceLoaderClient* m_client;
    6861        bool m_loadingMultipartContent;
  • trunk/WebKit/mac/ChangeLog

    r39549 r39566  
     12009-01-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Bug 23072: REGRESSION (r37371): In the Dictionary application, scroll bar appears
     6        inside its web view when resizing its window
     7        https://bugs.webkit.org/show_bug.cgi?id=23072
     8        rdar://problem/6368028
     9
     10        The first attempt at fixing this did not work.
     11        This time I was able to reproduce the bug and test the fix.
     12
     13        * WebCoreSupport/WebFrameLoaderClient.mm:
     14        (applyAppleDictionaryApplicationQuirkNonInlinePart): Changed the arguments and
     15        function names around a bit to make even less code at the call site.
     16        (applyAppleDictionaryApplicationQuirk): Put the check for whether this is the
     17        Dictionary application in here.
     18        (WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache): Put a call to
     19        applyAppleDictionaryApplicationQuirk here. This was a case I had missed before,
     20        when the script is cached. This fixes one of the two problems with the initial
     21        patch; the other fix is in WebCore.
     22        (WebFrameLoaderClient::dispatchWillSendRequest): Changed the
     23        applyAppleDictionaryApplicationQuirk call here to work the new simpler way.
     24
     25        * WebView/WebView.mm: Had to add an include due to changes in WebCore header includes.
     26
    1272009-01-02  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
    228
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r39547 r39566  
    11/*
    2  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    157157// This quirk can be removed when Apple Dictionary is fixed (see <rdar://problem/6471058>).
    158158
    159 static bool isAppleDictionaryApplication()
    160 {
    161     return [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Dictionary"];
    162 }
    163 
    164 static void applyAppleDictionaryApplicationQuirk(WebFrame *webFrame, const ResourceRequest& request)
     159static void applyAppleDictionaryApplicationQuirkNonInlinePart(WebFrameLoaderClient* client, const ResourceRequest& request)
    165160{
    166161    if (!request.url().isLocalFile())
     
    168163    if (!request.url().string().endsWith("MainPageJavaScript.js"))
    169164        return;
    170     Frame* frame = core(webFrame);
     165    Frame* frame = core(client->webFrame());
    171166    if (!frame)
    172167        return;
     
    185180        }
    186181    }
     182}
     183
     184static inline void applyAppleDictionaryApplicationQuirk(WebFrameLoaderClient* client, const ResourceRequest& request)
     185{
     186    // Use a one-time-initialized global variable so we can quickly determine there's nothing to do in
     187    // all applications other than Apple Dictionary.
     188    static bool isAppleDictionary = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Dictionary"];
     189    if (isAppleDictionary)
     190        applyAppleDictionaryApplicationQuirkNonInlinePart(client, request);
    187191}
    188192
     
    319323bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
    320324{
     325    applyAppleDictionaryApplicationQuirk(this, request);
     326
    321327    WebView *webView = getWebView(m_webFrame.get());
    322328    WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
     
    350356void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
    351357{
    352     static bool isDictionary = isAppleDictionaryApplication();
    353     if (isDictionary)
    354         applyAppleDictionaryApplicationQuirk(m_webFrame.get(), request);
     358    applyAppleDictionaryApplicationQuirk(this, request);
    355359
    356360    WebView *webView = getWebView(m_webFrame.get());
  • trunk/WebKit/mac/WebView/WebView.mm

    r39452 r39566  
    108108#import <WebCore/HTMLNames.h>
    109109#import <WebCore/HistoryItem.h>
     110#import <WebCore/IconDatabase.h>
    110111#import <WebCore/Logging.h>
    111112#import <WebCore/MIMETypeRegistry.h>
Note: See TracChangeset for help on using the changeset viewer.