Changeset 12114 in webkit
- Timestamp:
- Jan 15, 2006, 7:14:52 AM (21 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 deleted
- 21 edited
-
ChangeLog (modified) (1 diff)
-
ForwardingHeaders/q3dict.h (deleted)
-
ForwardingHeaders/qdict.h (deleted)
-
WebCore.vcproj/WebCore/WebCore.vcproj (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (11 diffs)
-
bridge/mac/MacFrame.h (modified) (4 diffs)
-
bridge/mac/MacFrame.mm (modified) (2 diffs)
-
khtml/editing/jsediting.h (modified) (2 diffs)
-
khtml/rendering/render_frames.cpp (modified) (15 diffs, 1 prop)
-
khtml/xml/DocumentImpl.cpp (modified) (25 diffs, 1 prop)
-
khtml/xml/DocumentImpl.h (modified) (2 diffs)
-
ksvg2/svg/SVGDocumentImpl.cpp (modified) (1 diff)
-
kwq/KWQDict.h (deleted)
-
kwq/KWQDictImpl.cpp (deleted)
-
kwq/KWQDictImpl.h (deleted)
-
kwq/KWQKURL.h (modified) (2 diffs)
-
kwq/KWQKURL.mm (modified) (43 diffs, 1 prop)
-
kwq/KWQLoader.mm (modified) (8 diffs, 1 prop)
-
loader/Cache.cpp (modified) (23 diffs)
-
loader/Cache.h (modified) (5 diffs, 1 prop)
-
loader/CachedImage.cpp (modified) (5 diffs)
-
loader/CachedImageCallback.cpp (modified) (5 diffs)
-
loader/CachedObject.h (modified) (3 diffs)
-
loader/DocLoader.cpp (modified) (3 diffs)
-
loader/DocLoader.h (modified) (2 diffs)
-
loader/loader.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r12109 r12114 1 2006-01-15 Darin Adler <darin@apple.com> 2 3 Reviewed by Hyatt. 4 5 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6528 6 remove all use of QDict from WebCore 7 8 I ran performance tests and the change results in a slight improvement. 9 10 * bridge/mac/MacFrame.h: Removed include of KWQDict.h. Changed didTellBridgeAboutLoad 11 and haveToldBridgeAboutLoad functions to take DOMString instead of QString. Changed 12 urlsBridgeKnowsAbout from a QDict to a HashMap. 13 * bridge/mac/MacFrame.mm: 14 (MacFrame::didTellBridgeAboutLoad): Updated to use QDict and DOMString. 15 (MacFrame::haveToldBridgeAboutLoad): Ditto. 16 17 * khtml/editing/jsediting.h: Removed include of qdict.h. 18 19 * khtml/rendering/render_frames.cpp: Removed include of qdict.h. Put file inside the 20 khtml namespace instead of just using the namespace. Changed tabs to spaces. 21 (khtml::RenderPartObject::updateWidget): Changed the local variable uniqueParamNames 22 to be a HashSet instead of a QDict. 23 24 * khtml/xml/DocumentImpl.h: Removed include of qdict.h, changed m_elementsById, m_idCount, 25 and m_elementsByAccessKey to use HashMap and HashCountedSet instead of QDict. 26 * khtml/xml/DocumentImpl.cpp: Changed tabs to spaces. 27 (DocumentImpl::getElementById): Updated to use HashMap for m_elementsById and HashCountedSet 28 for m_idCount. 29 (DocumentImpl::addElementById): Ditto. Remove code to clear m_accessKeyDictValid, 30 since setDocumentChanged already takes care of that. 31 (DocumentImpl::removeElementById): Ditto. 32 (DocumentImpl::getElementByAccessKey): Updated to use HashMap for m_elementsByAccessKey. 33 (DocumentImpl::setDocumentChanged): Rearranged to do a couple fewer branches. Clear out 34 the m_elementsByAccessKey map when clearing m_accessKeyMapValid to avoid keeping stale 35 pointers around. 36 37 * ksvg2/svg/SVGDocumentImpl.cpp: Removed include of q3dict.h. 38 39 * WebCore.vcproj/WebCore/WebCore.vcproj: Removed obsolete QDict sources. 40 * WebCore.xcodeproj/project.pbxproj: Ditto. 41 42 * ForwardingHeaders/q3dict.h: Removed. 43 * ForwardingHeaders/qdict.h: Removed. 44 * kwq/KWQDict.h: Removed. 45 * kwq/KWQDictImpl.cpp: Removed. 46 * kwq/KWQDictImpl.h: Removed. 47 48 * WebCore+SVG/SVGNamesWrapper.cpp: Touched this file just so I could build again. 49 50 * kwq/KWQKURL.h: Removed unused canonicalURL, _path, _user, _pass, and _host functions. 51 * kwq/KWQKURL.mm: Changed tabs to spaces, removed unused functions, replaced NULL with 0. 52 53 * kwq/KWQLoader.mm: Changed tabs to spaces. 54 (KWQServeRequest): Removed QString conversion from call to didTellBridgeAboutLoad. 55 (KWQServeSynchronousRequest): Ditto. 56 (KWQCheckCacheObjectStatus): Ditto. Same for haveToldBridgeAboutLoad. 57 58 * loader/Cache.h: Removed include of qdict.h. Changed declaration of the LRUList struct 59 to just be a forward declaration. Changed tabs to spaces. Removed the static data member 60 called "cache". Added a static member function called get. Renamed removeCacheEntry to remove. 61 * loader/Cache.cpp: Put file inside the khtml namespace instead of just using the 62 namespace. Changed tabs to spaces. Changed the main cache itself to a HashMap and 63 made it a static variable local to this file instead of a static data member of Cache 64 to hide its type from the header. Also made the LRUList type private to this file. 65 (khtml::Cache::init): Create a HashMap instead of a QDict. 66 (khtml::Cache::clear): To replace the use of setAutoDelete, write a loop to delete all the 67 items in the cache map. 68 (khtml::Cache::requestImage): Change code to use HashMap functions instead of QDict. 69 (khtml::Cache::requestStyleSheet): Ditto. 70 (khtml::Cache::preloadStyleSheet): Ditto. 71 (khtml::Cache::requestScript): Ditto. 72 (khtml::Cache::preloadScript): Ditto. 73 (khtml::Cache::requestXSLStyleSheet): Ditto. 74 (khtml::Cache::requestXBLDocument): Ditto. 75 (khtml::Cache::removeCacheEntry): Ditto. 76 (khtml::Cache::FastLog2): Fixed this for 64-bit compiles. 77 (khtml::Cache::getStatistics): Ditto. 78 (khtml::Cache::flushAll): Ditto. 79 (khtml::Cache::get): Added. Function used by the loader. 80 81 * loader/CachedObject.h: Removed include of qdict.h. 82 83 * loader/DocLoader.h: Removed include of qdict.h. 84 * loader/DocLoader.cpp: (khtml::DocLoader::needReload): Changed to use new get function of 85 Cache instead of getting at the map directly. Also changed call to removeCacheEntry 86 to remove because it was renamed. 87 88 * loader/CachedImage.cpp: (khtml::CachedImage::data): Changed call to removeCacheEntry 89 to remove because it was renamed. 90 * loader/CachedImageCallback.cpp: (khtml::CachedImageCallback::handleError): Ditto. 91 * loader/loader.cpp: 92 (khtml::Loader::slotFinished): Ditto. 93 (khtml::Loader::cancelRequests): Ditto. 94 1 95 2006-01-15 Alexander Kellett <lypanov@kde.org> 2 96 -
trunk/WebCore/WebCore.vcproj/WebCore/WebCore.vcproj
r12102 r12114 208 208 </File> 209 209 <File 210 RelativePath="..\..\kwq\KWQDict.h"211 >212 </File>213 <File214 RelativePath="..\..\kwq\KWQDictImpl.h"215 >216 </File>217 <File218 210 RelativePath="..\..\kwq\KWQEditCommand.h" 219 211 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r12106 r12114 176 176 93F1993208245E59001E9ABC /* KWQDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868502DE3B8601EA4122 /* KWQDateTime.h */; }; 177 177 93F1993308245E59001E9ABC /* KWQDef.h in Headers */ = {isa = PBXBuildFile; fileRef = F58784DA02DE375901EA4122 /* KWQDef.h */; }; 178 93F1993408245E59001E9ABC /* KWQDict.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868602DE3B8601EA4122 /* KWQDict.h */; };179 93F1993508245E59001E9ABC /* KWQDictImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F58784DB02DE375901EA4122 /* KWQDictImpl.h */; };180 178 93F1993708245E59001E9ABC /* KWQEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868802DE3B8601EA4122 /* KWQEvent.h */; }; 181 179 93F1993808245E59001E9ABC /* KWQFile.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868902DE3B8601EA4122 /* KWQFile.h */; }; … … 351 349 93F19A1908245E59001E9ABC /* KWQCursor.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784D602DE375901EA4122 /* KWQCursor.mm */; }; 352 350 93F19A1A08245E59001E9ABC /* KWQDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784D702DE375901EA4122 /* KWQDateTime.cpp */; }; 353 93F19A1B08245E59001E9ABC /* KWQDictImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784DC02DE375901EA4122 /* KWQDictImpl.cpp */; };354 351 93F19A1C08245E59001E9ABC /* KWQEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784DE02DE375901EA4122 /* KWQEvent.mm */; }; 355 352 93F19A1D08245E59001E9ABC /* KWQFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784DF02DE375901EA4122 /* KWQFile.mm */; }; … … 737 734 A88AD1790952480A001DD196 /* KWQDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868502DE3B8601EA4122 /* KWQDateTime.h */; }; 738 735 A88AD17A0952480A001DD196 /* KWQDef.h in Headers */ = {isa = PBXBuildFile; fileRef = F58784DA02DE375901EA4122 /* KWQDef.h */; }; 739 A88AD17B0952480A001DD196 /* KWQDict.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868602DE3B8601EA4122 /* KWQDict.h */; };740 A88AD17C0952480A001DD196 /* KWQDictImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F58784DB02DE375901EA4122 /* KWQDictImpl.h */; };741 736 A88AD17E0952480A001DD196 /* KWQEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868802DE3B8601EA4122 /* KWQEvent.h */; }; 742 737 A88AD17F0952480A001DD196 /* KWQFile.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868902DE3B8601EA4122 /* KWQFile.h */; }; … … 954 949 A88AD2760952480A001DD196 /* KWQCursor.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784D602DE375901EA4122 /* KWQCursor.mm */; }; 955 950 A88AD2770952480A001DD196 /* KWQDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784D702DE375901EA4122 /* KWQDateTime.cpp */; }; 956 A88AD2780952480A001DD196 /* KWQDictImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58784DC02DE375901EA4122 /* KWQDictImpl.cpp */; };957 951 A88AD2790952480A001DD196 /* KWQEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784DE02DE375901EA4122 /* KWQEvent.mm */; }; 958 952 A88AD27A0952480A001DD196 /* KWQFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784DF02DE375901EA4122 /* KWQFile.mm */; }; … … 2730 2724 F58784D702DE375901EA4122 /* KWQDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQDateTime.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2731 2725 F58784DA02DE375901EA4122 /* KWQDef.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQDef.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2732 F58784DB02DE375901EA4122 /* KWQDictImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQDictImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };2733 F58784DC02DE375901EA4122 /* KWQDictImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQDictImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };2734 2726 F58784DE02DE375901EA4122 /* KWQEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQEvent.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2735 2727 F58784DF02DE375901EA4122 /* KWQFile.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQFile.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 2829 2821 F587868402DE3B8601EA4122 /* KWQCursor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQCursor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2830 2822 F587868502DE3B8601EA4122 /* KWQDateTime.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQDateTime.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2831 F587868602DE3B8601EA4122 /* KWQDict.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQDict.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };2832 2823 F587868802DE3B8601EA4122 /* KWQEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQEvent.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2833 2824 F587868902DE3B8601EA4122 /* KWQFile.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQFile.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 4367 4358 F587868502DE3B8601EA4122 /* KWQDateTime.h */, 4368 4359 F58784D702DE375901EA4122 /* KWQDateTime.cpp */, 4369 F587868602DE3B8601EA4122 /* KWQDict.h */,4370 F58784DB02DE375901EA4122 /* KWQDictImpl.h */,4371 F58784DC02DE375901EA4122 /* KWQDictImpl.cpp */,4372 4360 F587868802DE3B8601EA4122 /* KWQEvent.h */, 4373 4361 F58784DE02DE375901EA4122 /* KWQEvent.mm */, … … 4548 4536 93F1993208245E59001E9ABC /* KWQDateTime.h in Headers */, 4549 4537 93F1993308245E59001E9ABC /* KWQDef.h in Headers */, 4550 93F1993408245E59001E9ABC /* KWQDict.h in Headers */,4551 93F1993508245E59001E9ABC /* KWQDictImpl.h in Headers */,4552 4538 93F1993708245E59001E9ABC /* KWQEvent.h in Headers */, 4553 4539 93F1993808245E59001E9ABC /* KWQFile.h in Headers */, … … 5076 5062 A88AD1790952480A001DD196 /* KWQDateTime.h in Headers */, 5077 5063 A88AD17A0952480A001DD196 /* KWQDef.h in Headers */, 5078 A88AD17B0952480A001DD196 /* KWQDict.h in Headers */,5079 A88AD17C0952480A001DD196 /* KWQDictImpl.h in Headers */,5080 5064 A88AD17E0952480A001DD196 /* KWQEvent.h in Headers */, 5081 5065 A88AD17F0952480A001DD196 /* KWQFile.h in Headers */, … … 6418 6402 93F19A1908245E59001E9ABC /* KWQCursor.mm in Sources */, 6419 6403 93F19A1A08245E59001E9ABC /* KWQDateTime.cpp in Sources */, 6420 93F19A1B08245E59001E9ABC /* KWQDictImpl.cpp in Sources */,6421 6404 93F19A1C08245E59001E9ABC /* KWQEvent.mm in Sources */, 6422 6405 93F19A1D08245E59001E9ABC /* KWQFile.mm in Sources */, … … 6888 6871 A88AD2760952480A001DD196 /* KWQCursor.mm in Sources */, 6889 6872 A88AD2770952480A001DD196 /* KWQDateTime.cpp in Sources */, 6890 A88AD2780952480A001DD196 /* KWQDictImpl.cpp in Sources */,6891 6873 A88AD2790952480A001DD196 /* KWQEvent.mm in Sources */, 6892 6874 A88AD27A0952480A001DD196 /* KWQFile.mm in Sources */, -
trunk/WebCore/bridge/mac/MacFrame.h
r12095 r12114 1 1 /* 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "Frame.h" 30 30 #include "KWQClipboard.h" 31 #include "KWQScrollBar.h" 32 #include "NodeImpl.h" 33 #include "WebCoreKeyboardAccess.h" 31 34 #include "text_affinity.h" 32 #include "NodeImpl.h" 33 34 #include "WebCoreKeyboardAccess.h" 35 #include <kxmlcore/HashSet.h> 35 36 36 37 #if __APPLE__ 37 38 #import <CoreFoundation/CoreFoundation.h> 38 39 #endif 39 40 #include "KWQDict.h"41 #include "KWQClipboard.h"42 #include "KWQScrollBar.h"43 40 44 41 class FramePrivate; … … 263 260 WebCoreKeyboardUIMode keyboardUIMode() const; 264 261 265 void didTellBridgeAboutLoad(const QString &urlString);266 bool haveToldBridgeAboutLoad(const QString &urlString);262 void didTellBridgeAboutLoad(const DOM::DOMString& URL); 263 bool haveToldBridgeAboutLoad(const DOM::DOMString& URL); 267 264 268 265 KJS::Bindings::Instance *getEmbedInstanceForWidget(QWidget*); … … 366 363 bool _haveUndoRedoOperations; 367 364 368 QDict<char> urlsBridgeKnowsAbout;365 HashSet<RefPtr<DOM::DOMStringImpl> > urlsBridgeKnowsAbout; 369 366 370 367 friend class Frame; -
trunk/WebCore/bridge/mac/MacFrame.mm
r12085 r12114 1 1 /* 2 * Copyright (C) 2004, 2005 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 3076 3076 } 3077 3077 3078 void MacFrame::didTellBridgeAboutLoad(const QString &urlString) 3079 { 3080 static char dummy; 3081 urlsBridgeKnowsAbout.insert(urlString, &dummy); 3082 } 3083 3084 bool MacFrame::haveToldBridgeAboutLoad(const QString &urlString) 3085 { 3086 return urlsBridgeKnowsAbout.find(urlString) != 0; 3078 void MacFrame::didTellBridgeAboutLoad(const DOM::DOMString& URL) 3079 { 3080 urlsBridgeKnowsAbout.insert(URL.impl()); 3081 } 3082 3083 bool MacFrame::haveToldBridgeAboutLoad(const DOM::DOMString& URL) 3084 { 3085 return urlsBridgeKnowsAbout.contains(URL.impl()); 3087 3086 } 3088 3087 -
trunk/WebCore/khtml/editing/jsediting.h
r12020 r12114 1 1 /* 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef __jsediting_h__27 #define __jsediting_h__26 #ifndef jsediting_h__ 27 #define jsediting_h__ 28 28 29 29 #include "dom_string.h" 30 #include "qdict.h"31 30 32 31 class Frame; -
trunk/WebCore/khtml/rendering/render_frames.cpp
- Property allow-tabs deleted
r12085 r12114 5 5 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 6 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 7 * Copyright (C) 2004 Apple Computer, Inc.7 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 8 8 * 9 9 * This library is free software; you can redistribute it and/or … … 23 23 * 24 24 */ 25 //#define DEBUG_LAYOUT26 25 27 26 #include "config.h" 28 27 #include "render_frames.h" 29 #include "render_canvas.h" 28 29 #include "DocumentImpl.h" 30 #include "Frame.h" 31 #include "FrameView.h" 30 32 #include "html/html_baseimpl.h" 31 33 #include "html/html_objectimpl.h" 32 34 #include "html/htmltokenizer.h" 35 #include "render_arena.h" 36 #include "render_canvas.h" 37 #include "xml/EventNames.h" 33 38 #include "xml/dom2_eventsimpl.h" 34 #include "DocumentImpl.h"35 39 #include "xml/dom_textimpl.h" 36 #include "xml/EventNames.h"37 #include "FrameView.h"38 #include "Frame.h"39 #include "render_arena.h"40 41 40 #include <kcursor.h> 41 #include <kdebug.h> 42 42 #include <klocale.h> 43 #include < kdebug.h>43 #include <qpainter.h> 44 44 #include <qtimer.h> 45 #include <qpainter.h> 46 #include "qdict.h" 47 48 using namespace khtml; 45 49 46 using namespace DOM; 50 47 using namespace EventNames; 51 48 using namespace HTMLNames; 49 50 //#define DEBUG_LAYOUT 51 52 namespace khtml { 52 53 53 54 RenderFrameSet::RenderFrameSet( HTMLFrameSetElementImpl *frameSet) … … 331 332 RenderObject *child = firstChild(); 332 333 if ( !child ) 333 goto end2;334 goto end2; 334 335 335 336 if(!m_hSplitVar && !m_vSplitVar) … … 421 422 child->setHeight( m_gridLayout[0][r] ); 422 423 child->setNeedsLayout(true); 423 child->layout();424 child->layout(); 424 425 } 425 426 … … 652 653 { 653 654 if (m_widget && m_widget->inherits("KHTMLView")) { 654 static_cast<KHTMLView *>(m_widget)->deref();655 static_cast<KHTMLView *>(m_widget)->deref(); 655 656 } 656 657 } … … 663 664 664 665 if (widget == m_widget) { 665 return;666 return; 666 667 } 667 668 668 669 if (m_widget && m_widget->inherits("KHTMLView")) { 669 static_cast<KHTMLView *>(m_widget)->deref();670 static_cast<KHTMLView *>(m_widget)->deref(); 670 671 } 671 672 672 if (widget && widget->inherits("KHTMLView")) { 673 static_cast<KHTMLView *>(widget)->ref();674 setQWidget( widget, false );675 connect( widget, SIGNAL( cleared() ), this, SLOT( slotViewCleared() ) );673 if (widget && widget->inherits("KHTMLView")) { 674 static_cast<KHTMLView *>(widget)->ref(); 675 setQWidget( widget, false ); 676 connect( widget, SIGNAL( cleared() ), this, SLOT( slotViewCleared() ) ); 676 677 } else { 677 setQWidget( widget );678 setQWidget( widget ); 678 679 } 679 680 setNeedsLayoutAndMinMaxRecalc(); … … 737 738 738 739 if (doc->frame()->topLevelFrameCount() >= 200) 739 return false;740 return false; 740 741 741 742 // We allow one level of self-reference because some sites depend on that. … … 833 834 } 834 835 835 QDict<bool> uniqueParamNames(5, false);836 HashSet<DOMStringImpl*, CaseInsensitiveHash> uniqueParamNames; 836 837 837 838 // Scan the PARAM children. … … 841 842 while (child && (url.isEmpty() || serviceType.isEmpty() || !embed)) { 842 843 if (child->hasTagName(paramTag)) { 843 HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child);844 HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child); 844 845 DOMString name = p->name().lower(); 845 846 if (url.isEmpty() && (name == "src" || name == "movie" || name == "code" || name == "url")) … … 853 854 } 854 855 if (!embed) { 855 bool dummyValue = true; 856 uniqueParamNames.insert(p->name().qstring(), &dummyValue); 856 uniqueParamNames.insert(p->name().impl()); 857 857 paramNames.append(p->name().qstring()); 858 858 paramValues.append(p->value().qstring()); … … 867 867 // we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM, 868 868 // else our Java plugin will misinterpret it. [4004531] 869 DOMString codebase; 869 870 if (!embed && serviceType.lower() == "application/x-java-applet") { 870 bool dummyValue = true;871 uniqueParamNames.insert( "codebase", &dummyValue); // pretend we found it in a PARAM already871 codebase = "codebase"; 872 uniqueParamNames.insert(codebase.impl()); // pretend we found it in a PARAM already 872 873 } 873 874 … … 877 878 for (unsigned i = 0; i < attributes->length(); ++i) { 878 879 AttributeImpl* it = attributes->attributeItem(i); 879 QString name = it->name().localName().qstring();880 if (embed || uniqueParamNames. find(name) == 0) {881 paramNames.append(name );880 const AtomicString& name = it->name().localName(); 881 if (embed || uniqueParamNames.contains(name.impl())) { 882 paramNames.append(name.qstring()); 882 883 paramValues.append(it->value().qstring()); 883 884 } … … 933 934 return; 934 935 if (url.isEmpty()) 935 url = "about:blank";936 url = "about:blank"; 936 937 KHTMLView *v = static_cast<KHTMLView *>(m_view); 937 938 bool requestSucceeded = v->frame()->requestFrame( this, url, o->m_name.qstring(), QStringList(), QStringList(), true ); 938 939 if (requestSucceeded && url == "about:blank") { 939 Frame *newPart = v->frame()->findFrame( o->m_name.qstring() );940 if (newPart && newPart->xmlDocImpl()) {941 newPart->xmlDocImpl()->setBaseURL( v->frame()->baseURL().url() );942 }940 Frame *newPart = v->frame()->findFrame( o->m_name.qstring() ); 941 if (newPart && newPart->xmlDocImpl()) { 942 newPart->xmlDocImpl()->setBaseURL( v->frame()->baseURL().url() ); 943 } 943 944 } 944 945 } … … 971 972 int marginh = -1; 972 973 if (element()->hasTagName(iframeTag)) { 973 HTMLIFrameElementImpl *frame = static_cast<HTMLIFrameElementImpl *>(element());974 if(frame->m_frameBorder)975 frameStyle = QFrame::Box;974 HTMLIFrameElementImpl *frame = static_cast<HTMLIFrameElementImpl *>(element()); 975 if(frame->m_frameBorder) 976 frameStyle = QFrame::Box; 976 977 scroll = frame->m_scrolling; 977 marginw = frame->m_marginWidth;978 marginh = frame->m_marginHeight;978 marginw = frame->m_marginWidth; 979 marginh = frame->m_marginHeight; 979 980 } 980 981 view->setFrameStyle(frameStyle); … … 1020 1021 } 1021 1022 } 1023 1024 } -
trunk/WebCore/khtml/xml/DocumentImpl.cpp
- Property allow-tabs deleted
r12090 r12114 268 268 269 269 m_cssTarget = 0; 270 m_accessKey DictValid = false;270 m_accessKeyMapValid = false; 271 271 272 272 resetLinkColor(); … … 317 317 KJS::ScriptInterpreter::forgetAllDOMNodesForDocument(this); 318 318 319 if ( changedDocuments && m_docChanged)319 if (m_docChanged && changedDocuments) 320 320 changedDocuments->remove(this); 321 321 delete m_tokenizer; … … 498 498 ElementImpl *oldElement = static_cast<ElementImpl *>(importedNode); 499 499 ElementImpl *newElement = createElementNS(oldElement->namespaceURI(), oldElement->tagName().toString(), exceptioncode); 500 500 501 501 if (exceptioncode != 0) 502 502 return 0; … … 618 618 } 619 619 620 ElementImpl *DocumentImpl::getElementById( const DOMString &elementId ) const 621 { 622 ElementImpl *element; 623 QString qId = elementId.qstring(); 624 625 if (elementId.length() == 0) { 620 ElementImpl *DocumentImpl::getElementById(const DOMString& elementId) const 621 { 622 if (elementId.length() == 0) 626 623 return 0; 627 } 628 629 element = m_elementsById.find(qId); 630 624 625 ElementImpl *element = m_elementsById.get(elementId.impl()); 631 626 if (element) 632 627 return element; 633 628 634 if ( int idCount = (int)m_idCount.find(qId)) {629 if (m_idCount.contains(elementId.impl())) { 635 630 for (NodeImpl *n = traverseNextNode(); n != 0; n = n->traverseNextNode()) { 631 if (n->isElementNode()) { 632 element = static_cast<ElementImpl*>(n); 633 if (element->hasID() && element->getAttribute(idAttr) == elementId) { 634 m_idCount.remove(elementId.impl()); 635 m_elementsById.set(elementId.impl(), element); 636 return element; 637 } 638 } 639 } 640 } 641 return 0; 642 } 643 644 ElementImpl *DocumentImpl::elementFromPoint( const int _x, const int _y ) const 645 { 646 if (!m_render) 647 return 0; 648 649 RenderObject::NodeInfo nodeInfo(true, true); 650 m_render->layer()->hitTest(nodeInfo, _x, _y); 651 652 NodeImpl* n = nodeInfo.innerNode(); 653 while (n && !n->isElementNode()) 654 n = n->parentNode(); 655 return static_cast<ElementImpl*>(n); 656 } 657 658 void DocumentImpl::addElementById(const DOMString& elementId, ElementImpl* element) 659 { 660 if (!m_elementsById.contains(elementId.impl())) 661 m_elementsById.set(elementId.impl(), element); 662 else 663 m_idCount.insert(elementId.impl()); 664 } 665 666 void DocumentImpl::removeElementById(const DOMString& elementId, ElementImpl* element) 667 { 668 if (m_elementsById.get(elementId.impl()) == element) 669 m_elementsById.remove(elementId.impl()); 670 else 671 m_idCount.remove(elementId.impl()); 672 } 673 674 ElementImpl* DocumentImpl::getElementByAccessKey(const DOMString& key) 675 { 676 if (!key.length()) 677 return 0; 678 if (!m_accessKeyMapValid) { 679 for (NodeImpl* n = this; n; n = n->traverseNextNode()) { 636 680 if (!n->isElementNode()) 637 681 continue; 638 639 element = static_cast<ElementImpl *>(n); 640 641 if (element->hasID() && element->getAttribute(idAttr) == elementId) { 642 if (idCount == 1) 643 m_idCount.remove(qId); 644 else 645 m_idCount.insert(qId, (char *)idCount - 1); 646 647 m_elementsById.insert(qId, element); 648 return element; 649 } 650 } 651 } 652 return 0; 653 } 654 655 ElementImpl *DocumentImpl::elementFromPoint( const int _x, const int _y ) const 656 { 657 if (!m_render) return 0; 658 659 RenderObject::NodeInfo nodeInfo(true, true); 660 m_render->layer()->hitTest(nodeInfo, _x, _y); 661 NodeImpl* n = nodeInfo.innerNode(); 662 663 while ( n && !n->isElementNode() ) { 664 n = n->parentNode(); 665 } 666 667 return static_cast<ElementImpl*>(n); 668 } 669 670 void DocumentImpl::addElementById(const DOMString &elementId, ElementImpl *element) 671 { 672 QString qId = elementId.qstring(); 673 674 if (m_elementsById.find(qId) == NULL) { 675 m_elementsById.insert(qId, element); 676 m_accessKeyDictValid = false; 677 } else { 678 int idCount = (int)m_idCount.find(qId); 679 m_idCount.insert(qId, (char *)(idCount + 1)); 680 } 681 } 682 683 void DocumentImpl::removeElementById(const DOMString &elementId, ElementImpl *element) 684 { 685 QString qId = elementId.qstring(); 686 687 if (m_elementsById.find(qId) == element) { 688 m_elementsById.remove(qId); 689 m_accessKeyDictValid = false; 690 } else { 691 int idCount = (int)m_idCount.find(qId); 692 assert(idCount > 0); 693 if (idCount == 1) 694 m_idCount.remove(qId); 695 else 696 m_idCount.insert(qId, (char *)(idCount - 1)); 697 } 698 } 699 700 ElementImpl *DocumentImpl::getElementByAccessKey( const DOMString &key ) 701 { 702 if (!key.length()) 703 return 0; 704 705 if (!m_accessKeyDictValid) { 706 m_elementsByAccessKey.clear(); 707 708 const NodeImpl *n; 709 for (n = this; n != 0; n = n->traverseNextNode()) { 710 if (!n->isElementNode()) 711 continue; 712 const ElementImpl *elementImpl = static_cast<const ElementImpl *>(n); 713 DOMString accessKey(elementImpl->getAttribute(accesskeyAttr));; 714 if (!accessKey.isEmpty()) { 715 QString ak = accessKey.qstring().lower(); 716 if (m_elementsByAccessKey.find(ak) == NULL) 717 m_elementsByAccessKey.insert(ak, elementImpl); 718 } 719 } 720 m_accessKeyDictValid = true; 721 } 722 return m_elementsByAccessKey.find(key.qstring()); 682 ElementImpl* element = static_cast<ElementImpl *>(n); 683 const AtomicString& accessKey = element->getAttribute(accesskeyAttr); 684 if (!accessKey.isEmpty()) 685 m_elementsByAccessKey.set(accessKey.impl(), element); 686 } 687 m_accessKeyMapValid = true; 688 } 689 return m_elementsByAccessKey.get(key.impl()); 723 690 } 724 691 … … 828 795 void DocumentImpl::setDocumentChanged(bool b) 829 796 { 830 if (!changedDocuments) 831 changedDocuments = new QPtrList<DocumentImpl>; 832 833 if (b && !m_docChanged) 834 changedDocuments->append(this); 835 else if (!b && m_docChanged) 836 changedDocuments->remove(this); 797 if (b) { 798 if (!m_docChanged) { 799 if (!changedDocuments) 800 changedDocuments = new QPtrList<DocumentImpl>; 801 changedDocuments->append(this); 802 } 803 if (m_accessKeyMapValid) { 804 m_accessKeyMapValid = false; 805 m_elementsByAccessKey.clear(); 806 } 807 } else { 808 if (m_docChanged && changedDocuments) 809 changedDocuments->remove(this); 810 } 811 837 812 m_docChanged = b; 838 839 if (m_docChanged)840 m_accessKeyDictValid = false;841 813 } 842 814 843 815 void DocumentImpl::recalcStyle( StyleChange change ) 844 816 { 845 // qDebug("recalcStyle(%p)", this);846 // QTime qt;847 // qt.start();848 817 if (m_inStyleRecalc) 849 818 return; // Guard against re-entrancy. -dwh … … 882 851 } 883 852 884 //kdDebug() << "DocumentImpl::attach: setting to charset " << settings->charset() << endl;885 853 _style->setFontDef(fontDef); 886 854 _style->htmlFont().update( paintDeviceMetrics() ); … … 903 871 if ( change>= Inherit || n->hasChangedChild() || n->changed() ) 904 872 n->recalcStyle( change ); 905 //kdDebug( 6020 ) << "TIME: recalcStyle() dt=" << qt.elapsed() << endl;906 873 907 874 if (changed() && m_view) 908 m_view->layout();875 m_view->layout(); 909 876 910 877 bail_out: … … 924 891 void DocumentImpl::updateRendering() 925 892 { 926 if (!hasChangedChild()) return; 927 928 // QTime time; 929 // time.start(); 930 // kdDebug() << "UPDATERENDERING: "<<endl; 931 932 StyleChange change = NoChange; 933 recalcStyle( change ); 934 935 // kdDebug() << "UPDATERENDERING time used="<<time.elapsed()<<endl; 893 if (hasChangedChild()) 894 recalcStyle(NoChange); 936 895 } 937 896 … … 949 908 void DocumentImpl::updateLayout() 950 909 { 951 // FIXME: Dave's pretty sure we can remove this because 952 // layout calls recalcStyle as needed. 910 // FIXME: Dave Hyatt's pretty sure we can remove this because layout calls recalcStyle as needed. 953 911 updateRendering(); 954 912 955 913 // Only do a layout if changes have occurred that make it necessary. 956 914 if (m_view && renderer() && renderer()->needsLayout()) 957 m_view->layout();915 m_view->layout(); 958 916 } 959 917 … … 970 928 if (!haveStylesheetsLoaded()) { 971 929 m_ignorePendingStylesheets = true; 972 updateStyleSelector();930 updateStyleSelector(); 973 931 } 974 932 … … 1418 1376 if ( m_usersheet != sheet ) { 1419 1377 m_usersheet = sheet; 1420 updateStyleSelector();1378 updateStyleSelector(); 1421 1379 } 1422 1380 } … … 1445 1403 1446 1404 if (!fromNode) { 1447 // No starting node supplied; begin with the top of the document1448 NodeImpl *n;1449 1450 int lowestTabIndex = 65535;1451 for (n = this; n != 0; n = n->traverseNextNode()) {1452 if (n->isKeyboardFocusable()) {1453 if ((n->tabIndex() > 0) && (n->tabIndex() < lowestTabIndex))1454 lowestTabIndex = n->tabIndex();1455 }1456 }1457 1458 if (lowestTabIndex == 65535)1459 lowestTabIndex = 0;1460 1461 // Go to the first node in the document that has the desired tab index1462 for (n = this; n != 0; n = n->traverseNextNode()) {1463 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestTabIndex))1464 return n;1465 }1466 1467 return 0;1405 // No starting node supplied; begin with the top of the document 1406 NodeImpl *n; 1407 1408 int lowestTabIndex = 65535; 1409 for (n = this; n != 0; n = n->traverseNextNode()) { 1410 if (n->isKeyboardFocusable()) { 1411 if ((n->tabIndex() > 0) && (n->tabIndex() < lowestTabIndex)) 1412 lowestTabIndex = n->tabIndex(); 1413 } 1414 } 1415 1416 if (lowestTabIndex == 65535) 1417 lowestTabIndex = 0; 1418 1419 // Go to the first node in the document that has the desired tab index 1420 for (n = this; n != 0; n = n->traverseNextNode()) { 1421 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestTabIndex)) 1422 return n; 1423 } 1424 1425 return 0; 1468 1426 } 1469 1427 else { 1470 fromTabIndex = fromNode->tabIndex();1428 fromTabIndex = fromNode->tabIndex(); 1471 1429 } 1472 1430 1473 1431 if (fromTabIndex == 0) { 1474 // Just need to find the next selectable node after fromNode (in document order) that doesn't have a tab index1475 NodeImpl *n = fromNode->traverseNextNode();1476 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))1477 n = n->traverseNextNode();1478 return n;1432 // Just need to find the next selectable node after fromNode (in document order) that doesn't have a tab index 1433 NodeImpl *n = fromNode->traverseNextNode(); 1434 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0)) 1435 n = n->traverseNextNode(); 1436 return n; 1479 1437 } 1480 1438 else { 1481 // Find the lowest tab index out of all the nodes except fromNode, that is greater than or equal to fromNode's1482 // tab index. For nodes with the same tab index as fromNode, we are only interested in those that come after1483 // fromNode in document order.1484 // If we don't find a suitable tab index, the next focus node will be one with a tab index of 0.1485 unsigned short lowestSuitableTabIndex = 65535;1486 NodeImpl *n;1487 1488 bool reachedFromNode = false;1489 for (n = this; n != 0; n = n->traverseNextNode()) {1490 if (n->isKeyboardFocusable() &&1491 ((reachedFromNode && (n->tabIndex() >= fromTabIndex)) ||1492 (!reachedFromNode && (n->tabIndex() > fromTabIndex))) &&1493 (n->tabIndex() < lowestSuitableTabIndex) &&1494 (n != fromNode)) {1495 1496 // We found a selectable node with a tab index at least as high as fromNode's. Keep searching though,1497 // as there may be another node which has a lower tab index but is still suitable for use.1498 lowestSuitableTabIndex = n->tabIndex();1499 }1500 1501 if (n == fromNode)1502 reachedFromNode = true;1503 }1504 1505 if (lowestSuitableTabIndex == 65535) {1506 // No next node with a tab index -> just take first node with tab index of 01507 NodeImpl *n = this;1508 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))1509 n = n->traverseNextNode();1510 return n;1511 }1512 1513 // Search forwards from fromNode1514 for (n = fromNode->traverseNextNode(); n != 0; n = n->traverseNextNode()) {1515 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex))1516 return n;1517 }1518 1519 // The next node isn't after fromNode, start from the beginning of the document1520 for (n = this; n != fromNode; n = n->traverseNextNode()) {1521 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex))1522 return n;1523 }1524 1525 assert(false); // should never get here1526 return 0;1439 // Find the lowest tab index out of all the nodes except fromNode, that is greater than or equal to fromNode's 1440 // tab index. For nodes with the same tab index as fromNode, we are only interested in those that come after 1441 // fromNode in document order. 1442 // If we don't find a suitable tab index, the next focus node will be one with a tab index of 0. 1443 unsigned short lowestSuitableTabIndex = 65535; 1444 NodeImpl *n; 1445 1446 bool reachedFromNode = false; 1447 for (n = this; n != 0; n = n->traverseNextNode()) { 1448 if (n->isKeyboardFocusable() && 1449 ((reachedFromNode && (n->tabIndex() >= fromTabIndex)) || 1450 (!reachedFromNode && (n->tabIndex() > fromTabIndex))) && 1451 (n->tabIndex() < lowestSuitableTabIndex) && 1452 (n != fromNode)) { 1453 1454 // We found a selectable node with a tab index at least as high as fromNode's. Keep searching though, 1455 // as there may be another node which has a lower tab index but is still suitable for use. 1456 lowestSuitableTabIndex = n->tabIndex(); 1457 } 1458 1459 if (n == fromNode) 1460 reachedFromNode = true; 1461 } 1462 1463 if (lowestSuitableTabIndex == 65535) { 1464 // No next node with a tab index -> just take first node with tab index of 0 1465 NodeImpl *n = this; 1466 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0)) 1467 n = n->traverseNextNode(); 1468 return n; 1469 } 1470 1471 // Search forwards from fromNode 1472 for (n = fromNode->traverseNextNode(); n != 0; n = n->traverseNextNode()) { 1473 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex)) 1474 return n; 1475 } 1476 1477 // The next node isn't after fromNode, start from the beginning of the document 1478 for (n = this; n != fromNode; n = n->traverseNextNode()) { 1479 if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex)) 1480 return n; 1481 } 1482 1483 assert(false); // should never get here 1484 return 0; 1527 1485 } 1528 1486 } … … 1532 1490 NodeImpl *lastNode = this; 1533 1491 while (lastNode->lastChild()) 1534 lastNode = lastNode->lastChild();1492 lastNode = lastNode->lastChild(); 1535 1493 1536 1494 if (!fromNode) { 1537 // No starting node supplied; begin with the very last node in the document1538 NodeImpl *n;1539 1540 int highestTabIndex = 0;1541 for (n = lastNode; n != 0; n = n->traversePreviousNode()) {1542 if (n->isKeyboardFocusable()) {1543 if (n->tabIndex() == 0)1544 return n;1545 else if (n->tabIndex() > highestTabIndex)1546 highestTabIndex = n->tabIndex();1547 }1548 }1549 1550 // No node with a tab index of 0; just go to the last node with the highest tab index1551 for (n = lastNode; n != 0; n = n->traversePreviousNode()) {1552 if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex))1553 return n;1554 }1555 1556 return 0;1495 // No starting node supplied; begin with the very last node in the document 1496 NodeImpl *n; 1497 1498 int highestTabIndex = 0; 1499 for (n = lastNode; n != 0; n = n->traversePreviousNode()) { 1500 if (n->isKeyboardFocusable()) { 1501 if (n->tabIndex() == 0) 1502 return n; 1503 else if (n->tabIndex() > highestTabIndex) 1504 highestTabIndex = n->tabIndex(); 1505 } 1506 } 1507 1508 // No node with a tab index of 0; just go to the last node with the highest tab index 1509 for (n = lastNode; n != 0; n = n->traversePreviousNode()) { 1510 if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex)) 1511 return n; 1512 } 1513 1514 return 0; 1557 1515 } 1558 1516 else { 1559 unsigned short fromTabIndex = fromNode->tabIndex();1560 1561 if (fromTabIndex == 0) {1562 // Find the previous selectable node before fromNode (in document order) that doesn't have a tab index1563 NodeImpl *n = fromNode->traversePreviousNode();1564 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))1565 n = n->traversePreviousNode();1566 if (n)1567 return n;1568 1569 // No previous nodes with a 0 tab index, go to the last node in the document that has the highest tab index1570 int highestTabIndex = 0;1571 for (n = this; n != 0; n = n->traverseNextNode()) {1572 if (n->isKeyboardFocusable() && (n->tabIndex() > highestTabIndex))1573 highestTabIndex = n->tabIndex();1574 }1575 1576 if (highestTabIndex == 0)1577 return 0;1578 1579 for (n = lastNode; n != 0; n = n->traversePreviousNode()) {1580 if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex))1581 return n;1582 }1583 1584 assert(false); // should never get here1585 return 0;1586 }1587 else {1588 // Find the lowest tab index out of all the nodes except fromNode, that is less than or equal to fromNode's1589 // tab index. For nodes with the same tab index as fromNode, we are only interested in those before1590 // fromNode.1591 // If we don't find a suitable tab index, then there will be no previous focus node.1592 unsigned short highestSuitableTabIndex = 0;1593 NodeImpl *n;1594 1595 bool reachedFromNode = false;1596 for (n = this; n != 0; n = n->traverseNextNode()) {1597 if (n->isKeyboardFocusable() &&1598 ((!reachedFromNode && (n->tabIndex() <= fromTabIndex)) ||1599 (reachedFromNode && (n->tabIndex() < fromTabIndex))) &&1600 (n->tabIndex() > highestSuitableTabIndex) &&1601 (n != fromNode)) {1602 1603 // We found a selectable node with a tab index no higher than fromNode's. Keep searching though, as1604 // there may be another node which has a higher tab index but is still suitable for use.1605 highestSuitableTabIndex = n->tabIndex();1606 }1607 1608 if (n == fromNode)1609 reachedFromNode = true;1610 }1611 1612 if (highestSuitableTabIndex == 0) {1613 // No previous node with a tab index. Since the order specified by HTML is nodes with tab index > 01614 // first, this means that there is no previous node.1615 return 0;1616 }1617 1618 // Search backwards from fromNode1619 for (n = fromNode->traversePreviousNode(); n != 0; n = n->traversePreviousNode()) {1620 if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))1621 return n;1622 }1623 // The previous node isn't before fromNode, start from the end of the document1624 for (n = lastNode; n != fromNode; n = n->traversePreviousNode()) {1625 if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))1626 return n;1627 }1628 1629 assert(false); // should never get here1630 return 0;1631 }1517 unsigned short fromTabIndex = fromNode->tabIndex(); 1518 1519 if (fromTabIndex == 0) { 1520 // Find the previous selectable node before fromNode (in document order) that doesn't have a tab index 1521 NodeImpl *n = fromNode->traversePreviousNode(); 1522 while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0)) 1523 n = n->traversePreviousNode(); 1524 if (n) 1525 return n; 1526 1527 // No previous nodes with a 0 tab index, go to the last node in the document that has the highest tab index 1528 int highestTabIndex = 0; 1529 for (n = this; n != 0; n = n->traverseNextNode()) { 1530 if (n->isKeyboardFocusable() && (n->tabIndex() > highestTabIndex)) 1531 highestTabIndex = n->tabIndex(); 1532 } 1533 1534 if (highestTabIndex == 0) 1535 return 0; 1536 1537 for (n = lastNode; n != 0; n = n->traversePreviousNode()) { 1538 if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex)) 1539 return n; 1540 } 1541 1542 assert(false); // should never get here 1543 return 0; 1544 } 1545 else { 1546 // Find the lowest tab index out of all the nodes except fromNode, that is less than or equal to fromNode's 1547 // tab index. For nodes with the same tab index as fromNode, we are only interested in those before 1548 // fromNode. 1549 // If we don't find a suitable tab index, then there will be no previous focus node. 1550 unsigned short highestSuitableTabIndex = 0; 1551 NodeImpl *n; 1552 1553 bool reachedFromNode = false; 1554 for (n = this; n != 0; n = n->traverseNextNode()) { 1555 if (n->isKeyboardFocusable() && 1556 ((!reachedFromNode && (n->tabIndex() <= fromTabIndex)) || 1557 (reachedFromNode && (n->tabIndex() < fromTabIndex))) && 1558 (n->tabIndex() > highestSuitableTabIndex) && 1559 (n != fromNode)) { 1560 1561 // We found a selectable node with a tab index no higher than fromNode's. Keep searching though, as 1562 // there may be another node which has a higher tab index but is still suitable for use. 1563 highestSuitableTabIndex = n->tabIndex(); 1564 } 1565 1566 if (n == fromNode) 1567 reachedFromNode = true; 1568 } 1569 1570 if (highestSuitableTabIndex == 0) { 1571 // No previous node with a tab index. Since the order specified by HTML is nodes with tab index > 0 1572 // first, this means that there is no previous node. 1573 return 0; 1574 } 1575 1576 // Search backwards from fromNode 1577 for (n = fromNode->traversePreviousNode(); n != 0; n = n->traversePreviousNode()) { 1578 if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex)) 1579 return n; 1580 } 1581 // The previous node isn't before fromNode, start from the end of the document 1582 for (n = lastNode; n != fromNode; n = n->traversePreviousNode()) { 1583 if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex)) 1584 return n; 1585 } 1586 1587 assert(false); // should never get here 1588 return 0; 1589 } 1632 1590 } 1633 1591 } … … 1639 1597 int absIndex = 0; 1640 1598 for (NodeImpl *n = node; n && n != this; n = n->traversePreviousNode()) 1641 absIndex++;1599 absIndex++; 1642 1600 return absIndex; 1643 1601 } … … 1647 1605 NodeImpl *n = this; 1648 1606 for (int i = 0; n && (i < absIndex); i++) { 1649 n = n->traverseNextNode();1607 n = n->traverseNextNode(); 1650 1608 } 1651 1609 return n; … … 1681 1639 bool ok = false; 1682 1640 int delay = 0; 1683 delay = str.toInt(&ok);1684 // We want a new history item if the refresh timeout > 1 second1685 if(ok && frame) frame->scheduleRedirection(delay, frame->url().url(), delay <= 1);1641 delay = str.toInt(&ok); 1642 // We want a new history item if the refresh timeout > 1 second 1643 if(ok && frame) frame->scheduleRedirection(delay, frame->url().url(), delay <= 1); 1686 1644 } else { 1687 1645 double delay = 0; 1688 1646 bool ok = false; 1689 delay = str.left(pos).stripWhiteSpace().toDouble(&ok);1647 delay = str.left(pos).stripWhiteSpace().toDouble(&ok); 1690 1648 1691 1649 pos++; … … 1884 1842 NodeImpl *n; 1885 1843 for (n = this; n; n = n->traverseNextNode()) { 1886 StyleSheetImpl *sheet = 0;1844 StyleSheetImpl *sheet = 0; 1887 1845 1888 1846 if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) … … 2006 1964 QPtrListIterator<StyleSheetImpl> it(oldStyleSheets); 2007 1965 for (; it.current(); ++it) 2008 it.current()->deref();1966 it.current()->deref(); 2009 1967 2010 1968 // Create a new style selector … … 2012 1970 QString usersheet = m_usersheet; 2013 1971 if ( m_view && m_view->mediaType() == "print" ) 2014 usersheet += m_printSheet;1972 usersheet += m_printSheet; 2015 1973 m_styleSelector = new CSSStyleSelector(this, usersheet, m_styleSheets, !inCompatMode()); 2016 1974 m_styleSelector->setEncodedURL(m_url); … … 2274 2232 // If we already have it we don't want removeWindowEventListener to delete it 2275 2233 if (listener) 2276 listener->ref();2234 listener->ref(); 2277 2235 removeHTMLWindowEventListener(eventType); 2278 2236 if (listener) { 2279 addWindowEventListener(eventType, listener, false);2280 listener->deref();2237 addWindowEventListener(eventType, listener, false); 2238 listener->deref(); 2281 2239 } 2282 2240 } … … 2286 2244 QPtrListIterator<RegisteredEventListener> it(m_windowEventListeners); 2287 2245 for (; it.current(); ++it) 2288 if (it.current()->eventType() == eventType && it.current()->listener()->eventListenerType() == "_khtml_HTMLEventListener")2289 return it.current()->listener();2246 if (it.current()->eventType() == eventType && it.current()->listener()->eventListenerType() == "_khtml_HTMLEventListener") 2247 return it.current()->listener(); 2290 2248 return 0; 2291 2249 } … … 2295 2253 QPtrListIterator<RegisteredEventListener> it(m_windowEventListeners); 2296 2254 for (; it.current(); ++it) 2297 if (it.current()->eventType() == eventType && it.current()->listener()->eventListenerType() == "_khtml_HTMLEventListener") {2298 m_windowEventListeners.removeRef(it.current());2299 return;2300 }2255 if (it.current()->eventType() == eventType && it.current()->listener()->eventListenerType() == "_khtml_HTMLEventListener") { 2256 m_windowEventListeners.removeRef(it.current()); 2257 return; 2258 } 2301 2259 } 2302 2260 … … 2328 2286 QPtrListIterator<RegisteredEventListener> it(m_windowEventListeners); 2329 2287 for (; it.current(); ++it) { 2330 if (it.current()->eventType() == eventType) {2331 return true;2332 }2288 if (it.current()->eventType() == eventType) { 2289 return true; 2290 } 2333 2291 } 2334 2292 … … 2339 2297 { 2340 2298 if (frame()) { 2341 return frame()->createHTMLEventListener(code, node);2299 return frame()->createHTMLEventListener(code, node); 2342 2300 } else { 2343 return NULL;2301 return NULL; 2344 2302 } 2345 2303 } … … 2654 2612 2655 2613 for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) { 2656 result += child->toString();2614 result += child->toString(); 2657 2615 } 2658 2616 -
trunk/WebCore/khtml/xml/DocumentImpl.h
r12101 r12114 27 27 #define DOM_DocumentImpl_h 28 28 29 #include "KWQSignal.h" 30 #include "Shared.h" 31 #include "decoder.h" 32 #include "xml/dom2_traversalimpl.h" 29 33 #include "xml/dom_elementimpl.h" 30 #include "xml/dom2_traversalimpl.h" 31 #include "Shared.h" 32 34 #include <kurl.h> 35 #include <kxmlcore/HashCountedSet.h> 36 #include <kxmlcore/HashMap.h> 37 #include <qcolor.h> 38 #include <qdatetime.h> 39 #include <qmap.h> 40 #include <qobject.h> 41 #include <qptrdict.h> 42 #include <qptrlist.h> 33 43 #include <qstringlist.h> 34 #include <qptrlist.h> 35 #include <qobject.h> 36 #include <qdict.h> 37 #include <qptrdict.h> 38 #include <qmap.h> 39 #include <qdatetime.h> 40 #include <qcolor.h> 41 42 #include <kurl.h> 43 44 #include "KWQSignal.h" 45 #include "decoder.h" 46 47 #include <kxmlcore/HashMap.h> 48 44 45 class Frame; 46 class KHTMLView; 47 class KWQAccObjectCache; 49 48 class QPaintDevice; 50 49 class QPaintDeviceMetrics; 51 class KHTMLView;52 class Frame;53 50 class RenderArena; 54 55 class KWQAccObjectCache;56 51 57 52 namespace khtml { 58 53 class CSSStyleSelector; 59 struct DashboardRegionValue;60 54 class DocLoader; 61 55 class Tokenizer; 56 struct DashboardRegionValue; 62 57 } 63 58 … … 742 737 RefPtr<khtml::Decoder> m_decoder; 743 738 744 mutable QDict<ElementImpl> m_elementsById;745 mutable QDict<char> m_idCount;746 747 QDict<ElementImpl> m_elementsByAccessKey;748 bool m_accessKey DictValid;739 mutable HashMap<DOMStringImpl*, ElementImpl*> m_elementsById; 740 mutable HashCountedSet<DOMStringImpl*> m_idCount; 741 742 HashMap<DOMStringImpl*, ElementImpl*, CaseInsensitiveHash> m_elementsByAccessKey; 743 bool m_accessKeyMapValid; 749 744 750 745 bool m_createRenderers; -
trunk/WebCore/ksvg2/svg/SVGDocumentImpl.cpp
r12101 r12114 23 23 #include "config.h" 24 24 #include <assert.h> 25 26 #include <q3dict.h>27 25 28 26 #include <kurl.h> -
trunk/WebCore/kwq/KWQKURL.h
r11990 r12114 52 52 bool hasPath() const; 53 53 54 QString canonicalURL() const;55 54 QString url() const { return urlString; } 56 55 … … 94 93 void parse(const char *url, const QString *originalString); 95 94 96 #ifdef CONSTRUCT_CANONICAL_STRING97 QString _path() const;98 QString _user() const;99 QString _pass() const;100 QString _host() const;101 #endif102 103 95 QString urlString; 104 96 bool m_isValid; -
trunk/WebCore/kwq/KWQKURL.mm
- Property allow-tabs deleted
r12086 r12114 238 238 KURL::KURL(const char *url) 239 239 { 240 if (url != NULL&& url[0] == '/') {240 if (url && url[0] == '/') { 241 241 char staticBuffer[2048]; 242 242 char *buffer; … … 254 254 buffer[4] = ':'; 255 255 memcpy(&buffer[5], url, urlLength); 256 parse(buffer, NULL);256 parse(buffer, 0); 257 257 if (buffer != staticBuffer) { 258 258 fastFree(buffer); 259 259 } 260 260 } else { 261 parse(url, NULL);261 parse(url, 0); 262 262 } 263 263 } … … 280 280 buffer[4] = ':'; 281 281 url.copyLatin1(&buffer[5]); 282 parse(buffer, NULL);282 parse(buffer, 0); 283 283 if (buffer != staticBuffer) { 284 284 fastFree(buffer); 285 285 } 286 286 } else { 287 parse(url.ascii(), &url);287 parse(url.ascii(), &url); 288 288 } 289 289 } … … 292 292 { 293 293 if (url) { 294 CFIndex bytesLength = CFURLGetBytes((CFURLRef)url, NULL, 0);294 CFIndex bytesLength = CFURLGetBytes((CFURLRef)url, 0, 0); 295 295 size_t bufferLength = bytesLength + 6; // 5 for "file:", 1 for NUL terminator 296 296 char staticBuffer[2048]; … … 303 303 char *bytes = &buffer[5]; 304 304 CFURLGetBytes((CFURLRef)url, (UInt8 *)bytes, bytesLength); 305 bytes[bytesLength] = '\0';305 bytes[bytesLength] = '\0'; 306 306 if (bytes[0] == '/') { 307 307 buffer[0] = 'f'; … … 310 310 buffer[3] = 'e'; 311 311 buffer[4] = ':'; 312 parse(buffer, NULL);312 parse(buffer, 0); 313 313 } else { 314 parse(bytes, NULL);314 parse(bytes, 0); 315 315 } 316 316 if (buffer != staticBuffer) { … … 319 319 } 320 320 else { 321 parse("", NULL);321 parse("", 0); 322 322 } 323 323 } … … 337 337 bool containsBackslash = relative.contains('\\'); 338 338 if (containsBackslash) { 339 substitutedRelative = substituteBackslashes(relative);339 substitutedRelative = substituteBackslashes(relative); 340 340 } 341 341 … … 397 397 398 398 if (absolute) { 399 parse(str, (allASCII && !strippedStart && (charsToChopOffEnd == 0)) ? &rel : 0);399 parse(str, (allASCII && !strippedStart && (charsToChopOffEnd == 0)) ? &rel : 0); 400 400 } else { 401 // if the base is invalid, just append the relative402 // portion. The RFC does not specify what to do in this case.403 if (!base.m_isValid) {404 QString newURL = base.urlString + str;405 parse(newURL.ascii(), &newURL);401 // if the base is invalid, just append the relative 402 // portion. The RFC does not specify what to do in this case. 403 if (!base.m_isValid) { 404 QString newURL = base.urlString + str; 405 parse(newURL.ascii(), &newURL); 406 406 if (strBuffer) { 407 407 fastFree(strBuffer); 408 408 } 409 409 return; 410 }411 412 switch(str[0]) {413 case '\0':414 // the reference must be empty - the RFC says this is a415 // reference to the same document416 {417 *this = base;418 break;419 }420 case '#':421 // must be fragment-only reference422 {423 QString newURL = base.urlString.left(base.queryEndPos) + str;424 parse(newURL.ascii(), &newURL);425 break;426 }427 case '?':410 } 411 412 switch(str[0]) { 413 case '\0': 414 // the reference must be empty - the RFC says this is a 415 // reference to the same document 416 { 417 *this = base; 418 break; 419 } 420 case '#': 421 // must be fragment-only reference 422 { 423 QString newURL = base.urlString.left(base.queryEndPos) + str; 424 parse(newURL.ascii(), &newURL); 425 break; 426 } 427 case '?': 428 428 // query-only reference, special case needed for non-URL results 429 {430 QString newURL = base.urlString.left(base.pathEndPos) + str;431 parse(newURL.ascii(), &newURL);432 break;433 }434 case '/':435 // must be net-path or absolute-path reference436 {437 if (str[1] == '/') {438 // net-path439 QString newURL = base.urlString.left(base.schemeEndPos + 1) + str;440 parse(newURL.ascii(), &newURL);441 } else {442 // abs-path443 QString newURL = base.urlString.left(base.portEndPos) + str;444 parse(newURL.ascii(), &newURL);445 }446 break;447 }448 default:449 {450 // must be relative-path reference451 452 char staticBuffer[2048];453 char *buffer;454 429 { 430 QString newURL = base.urlString.left(base.pathEndPos) + str; 431 parse(newURL.ascii(), &newURL); 432 break; 433 } 434 case '/': 435 // must be net-path or absolute-path reference 436 { 437 if (str[1] == '/') { 438 // net-path 439 QString newURL = base.urlString.left(base.schemeEndPos + 1) + str; 440 parse(newURL.ascii(), &newURL); 441 } else { 442 // abs-path 443 QString newURL = base.urlString.left(base.portEndPos) + str; 444 parse(newURL.ascii(), &newURL); 445 } 446 break; 447 } 448 default: 449 { 450 // must be relative-path reference 451 452 char staticBuffer[2048]; 453 char *buffer; 454 455 455 // Base part plus relative part plus one possible slash added in between plus terminating \0 byte. 456 size_t bufferLength = base.pathEndPos + 1 + strlen(str) + 1;457 458 if (bufferLength > sizeof(staticBuffer)) {459 buffer = (char *)fastMalloc(bufferLength);460 } else {461 buffer = staticBuffer;462 }463 464 char *bufferPos = buffer;465 466 // first copy everything before the path from the base467 const char *baseString = base.urlString.ascii();468 const char *baseStringStart = baseString;469 const char *pathStart = baseStringStart + base.portEndPos;470 while (baseStringStart < pathStart) {471 *bufferPos++ = *baseStringStart++;472 }456 size_t bufferLength = base.pathEndPos + 1 + strlen(str) + 1; 457 458 if (bufferLength > sizeof(staticBuffer)) { 459 buffer = (char *)fastMalloc(bufferLength); 460 } else { 461 buffer = staticBuffer; 462 } 463 464 char *bufferPos = buffer; 465 466 // first copy everything before the path from the base 467 const char *baseString = base.urlString.ascii(); 468 const char *baseStringStart = baseString; 469 const char *pathStart = baseStringStart + base.portEndPos; 470 while (baseStringStart < pathStart) { 471 *bufferPos++ = *baseStringStart++; 472 } 473 473 char *bufferPathStart = bufferPos; 474 474 475 // now copy the base path476 const char *baseStringEnd = baseString + base.pathEndPos;477 478 // go back to the last slash479 while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/') {480 baseStringEnd--;481 }482 483 if (baseStringEnd == baseStringStart) {475 // now copy the base path 476 const char *baseStringEnd = baseString + base.pathEndPos; 477 478 // go back to the last slash 479 while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/') { 480 baseStringEnd--; 481 } 482 483 if (baseStringEnd == baseStringStart) { 484 484 // no path in base, add a path separator if necessary 485 485 if (base.schemeEndPos + 1 != base.pathEndPos && *str != '\0' && *str != '?' && *str != '#') { … … 490 490 } 491 491 492 const char *relStringStart = str;493 const char *relStringPos = relStringStart;494 495 while (*relStringPos != '\0' && *relStringPos != '?' && *relStringPos != '#') {496 if (relStringPos[0] == '.' && bufferPos[-1] == '/') {497 if (isPathSegmentEndChar(relStringPos[1])) {498 // skip over "." segment499 relStringPos += 1;500 if (relStringPos[0] == '/') {501 relStringPos++;502 }503 continue;504 } else if (relStringPos[1] == '.' && isPathSegmentEndChar(relStringPos[2])) {505 // skip over ".." segment and rewind the last segment506 // the RFC leaves it up to the app to decide what to do with excess507 // ".." segments - we choose to drop them since some web content508 // relies on this.509 relStringPos += 2;510 if (relStringPos[0] == '/') {511 relStringPos++;512 }513 if (bufferPos > bufferPathStart + 1) {514 bufferPos--;515 }516 while (bufferPos > bufferPathStart + 1 && bufferPos[-1] != '/') {517 bufferPos--;518 }519 continue;520 }521 }522 523 *bufferPos = *relStringPos;524 relStringPos++;525 bufferPos++;526 }527 528 // all done with the path work, now copy any remainder529 // of the relative reference; this will also add a null terminator530 strcpy(bufferPos, relStringPos);531 532 parse(buffer, NULL);492 const char *relStringStart = str; 493 const char *relStringPos = relStringStart; 494 495 while (*relStringPos != '\0' && *relStringPos != '?' && *relStringPos != '#') { 496 if (relStringPos[0] == '.' && bufferPos[-1] == '/') { 497 if (isPathSegmentEndChar(relStringPos[1])) { 498 // skip over "." segment 499 relStringPos += 1; 500 if (relStringPos[0] == '/') { 501 relStringPos++; 502 } 503 continue; 504 } else if (relStringPos[1] == '.' && isPathSegmentEndChar(relStringPos[2])) { 505 // skip over ".." segment and rewind the last segment 506 // the RFC leaves it up to the app to decide what to do with excess 507 // ".." segments - we choose to drop them since some web content 508 // relies on this. 509 relStringPos += 2; 510 if (relStringPos[0] == '/') { 511 relStringPos++; 512 } 513 if (bufferPos > bufferPathStart + 1) { 514 bufferPos--; 515 } 516 while (bufferPos > bufferPathStart + 1 && bufferPos[-1] != '/') { 517 bufferPos--; 518 } 519 continue; 520 } 521 } 522 523 *bufferPos = *relStringPos; 524 relStringPos++; 525 bufferPos++; 526 } 527 528 // all done with the path work, now copy any remainder 529 // of the relative reference; this will also add a null terminator 530 strcpy(bufferPos, relStringPos); 531 532 parse(buffer, 0); 533 533 534 534 ASSERT(strlen(buffer) + 1 <= bufferLength); 535 536 if (buffer != staticBuffer) {537 fastFree(buffer);538 }539 540 break;541 }542 }535 536 if (buffer != staticBuffer) { 537 fastFree(buffer); 538 } 539 540 break; 541 } 542 } 543 543 } 544 544 … … 556 556 { 557 557 if (!m_isValid) { 558 return QString();558 return QString(); 559 559 } 560 560 … … 565 565 { 566 566 if (!m_isValid) { 567 return QString();567 return QString(); 568 568 } 569 569 … … 575 575 { 576 576 if (!m_isValid) { 577 return 0;577 return 0; 578 578 } 579 579 580 580 if (hostEndPos != portEndPos) { 581 bool ok;582 unsigned short result = urlString.mid(hostEndPos + 1, portEndPos - hostEndPos - 1).toUShort(&ok);583 if (!ok) {584 result = 0;585 }586 return result;581 bool ok; 582 unsigned short result = urlString.mid(hostEndPos + 1, portEndPos - hostEndPos - 1).toUShort(&ok); 583 if (!ok) { 584 result = 0; 585 } 586 return result; 587 587 } 588 588 … … 593 593 { 594 594 if (!m_isValid) { 595 return QString();595 return QString(); 596 596 } 597 597 598 598 if (passwordEndPos == userEndPos) { 599 return QString();599 return QString(); 600 600 } 601 601 … … 606 606 { 607 607 if (!m_isValid) { 608 return QString();608 return QString(); 609 609 } 610 610 … … 615 615 { 616 616 if (!m_isValid || fragmentEndPos == queryEndPos) { 617 return QString();617 return QString(); 618 618 } 619 619 … … 629 629 { 630 630 if (!m_isValid) { 631 return QString();631 return QString(); 632 632 } 633 633 … … 638 638 { 639 639 if (!m_isValid) { 640 return QString();640 return QString(); 641 641 } 642 642 … … 644 644 } 645 645 646 #ifdef CONSTRUCT_CANONICAL_STRING 647 QString KURL::_path() const 646 void KURL::setProtocol(const QString &s) 648 647 { 649 648 if (!m_isValid) { 650 return QString(); 651 } 652 653 return urlString.mid(portEndPos, pathEndPos - portEndPos); 654 } 655 656 QString KURL::_user() const 657 { 658 if (!m_isValid) { 659 return QString(); 660 } 661 662 return urlString.mid(userStartPos, userEndPos - userStartPos); 663 } 664 665 QString KURL::_pass() const 666 { 667 if (!m_isValid) { 668 return QString(); 669 } 670 671 if (passwordEndPos == userEndPos) { 672 return QString(); 673 } 674 675 return urlString.mid(userEndPos + 1, passwordEndPos - userEndPos - 1); 676 } 677 678 QString KURL::_host() const 679 { 680 if (!m_isValid) { 681 return QString(); 682 } 683 684 int start = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1; 685 return urlString.mid(start, hostEndPos - start); 686 } 687 688 #endif 689 690 void KURL::setProtocol(const QString &s) 691 { 692 if (!m_isValid) { 693 QString newURL = s + ":" + urlString; 694 parse(newURL.ascii(), &newURL); 695 return; 649 QString newURL = s + ":" + urlString; 650 parse(newURL.ascii(), &newURL); 651 return; 696 652 } 697 653 … … 703 659 { 704 660 if (m_isValid) { 705 bool slashSlashNeeded = userStartPos == schemeEndPos + 1;706 int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;707 708 QString newURL = urlString.left(hostStart) + (slashSlashNeeded ? "//" : QString()) + s + urlString.mid(hostEndPos);709 parse(newURL.ascii(), &newURL);661 bool slashSlashNeeded = userStartPos == schemeEndPos + 1; 662 int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1; 663 664 QString newURL = urlString.left(hostStart) + (slashSlashNeeded ? "//" : QString()) + s + urlString.mid(hostEndPos); 665 parse(newURL.ascii(), &newURL); 710 666 } 711 667 } … … 714 670 { 715 671 if (m_isValid) { 716 bool colonNeeded = portEndPos == hostEndPos;717 int portStart = (colonNeeded ? hostEndPos : hostEndPos + 1);718 QString newURL = urlString.left(portStart) + (colonNeeded ? ":" : QString()) + QString::number(i) + urlString.mid(portEndPos);719 parse(newURL.ascii(), &newURL);672 bool colonNeeded = portEndPos == hostEndPos; 673 int portStart = (colonNeeded ? hostEndPos : hostEndPos + 1); 674 QString newURL = urlString.left(portStart) + (colonNeeded ? ":" : QString()) + QString::number(i) + urlString.mid(portEndPos); 675 parse(newURL.ascii(), &newURL); 720 676 } 721 677 } … … 782 738 { 783 739 if (m_isValid) { 784 QString newURL = urlString.left(queryEndPos) + (s.isEmpty() ? QString() : "#" + s);785 parse(newURL.ascii(), &newURL);740 QString newURL = urlString.left(queryEndPos) + (s.isEmpty() ? QString() : "#" + s); 741 parse(newURL.ascii(), &newURL); 786 742 } 787 743 } … … 791 747 if (m_isValid) { 792 748 QString q; 793 if (!query.isEmpty() && query[0] != '?') {794 q = "?" + query;795 } else {796 q = query;797 }749 if (!query.isEmpty() && query[0] != '?') { 750 q = "?" + query; 751 } else { 752 q = query; 753 } 798 754 799 755 QString newURL = urlString.left(pathEndPos) + q + urlString.mid(queryEndPos); 800 parse(newURL.ascii(), &newURL);756 parse(newURL.ascii(), &newURL); 801 757 } 802 758 } … … 805 761 { 806 762 if (m_isValid) { 807 QString newURL = urlString.left(portEndPos) + encode_string(s) + urlString.mid(pathEndPos); 808 parse(newURL.ascii(), &newURL); 809 } 810 } 811 812 QString KURL::canonicalURL() const 813 { 814 #ifdef CONSTRUCT_CANONICAL_STRING 815 bool hadPrePathComponent = false; 816 QString canonicalURL; 817 818 if (!protocol().isEmpty()) { 819 canonicalURL += protocol(); 820 canonicalURL += "://"; 821 hadPrePathComponent = true; 822 } 823 if (!_user().isEmpty()) { 824 canonicalURL += _user(); 825 if (!_pass().isEmpty()){ 826 canonicalURL += ":"; 827 canonicalURL += _pass(); 828 } 829 canonicalURL += "@"; 830 hadPrePathComponent = true; 831 } 832 if (!_host().isEmpty()) { 833 canonicalURL += _host(); 834 unsigned short int p = port(); 835 if (p != 0) { 836 canonicalURL += ":"; 837 canonicalURL += QString::number(p); 838 } 839 hadPrePathComponent = true; 840 } 841 if (hadPrePathComponent && (strncasecmp ("http", url, schemeEnd) == 0 || 842 strncasecmp ("https", url, schemeEnd) == 0) && _path().isEmpty()) { 843 canonicalURL += "/"; 844 } 845 if (!_path().isEmpty()) { 846 canonicalURL += _path(); 847 } 848 if (!query().isEmpty()) { 849 canonicalURL += "?"; 850 canonicalURL += query(); 851 } 852 if (!ref().isEmpty()) { 853 canonicalURL += "#"; 854 canonicalURL += ref(); 855 } 856 return canonicalURL; 857 #else 858 return urlString; 859 #endif 860 } 861 763 QString newURL = urlString.left(portEndPos) + encode_string(s) + urlString.mid(pathEndPos); 764 parse(newURL.ascii(), &newURL); 765 } 766 } 862 767 863 768 QString KURL::prettyURL() const … … 872 777 873 778 if (hostEndPos != passwordEndPos) { 874 if (userEndPos != userStartPos) {875 authority += user();876 authority += "@";877 }878 authority += host();879 if (port() != 0) {880 authority += ":";881 authority += QString::number(port());882 }779 if (userEndPos != userStartPos) { 780 authority += user(); 781 authority += "@"; 782 } 783 authority += host(); 784 if (port() != 0) { 785 authority += ":"; 786 authority += QString::number(port()); 787 } 883 788 } 884 789 … … 976 881 const char *strEnd = strStart + length; 977 882 while (str < strEnd) { 978 unsigned char c = *str++;883 unsigned char c = *str++; 979 884 if (isBadChar(c)) { 980 885 if (c == '%' && strEnd - str >= 2 && isHexDigit(str[0]) && isHexDigit(str[1])) { … … 989 894 *p++ = hexDigits[c & 0xF]; 990 895 } 991 } else {992 *p++ = c;993 }896 } else { 897 *p++ = c; 898 } 994 899 } 995 900 … … 1078 983 m_isValid = true; 1079 984 1080 if ( url == NULL|| url[0] == '\0') {1081 // valid URL must be non-empty1082 m_isValid = false;1083 urlString = url;1084 return;985 if (!url || url[0] == '\0') { 986 // valid URL must be non-empty 987 m_isValid = false; 988 urlString = url; 989 return; 1085 990 } 1086 991 1087 992 if (!isSchemeFirstChar(url[0])) { 1088 // scheme must start with an alphabetic character1089 m_isValid = false;1090 urlString = url;1091 return;993 // scheme must start with an alphabetic character 994 m_isValid = false; 995 urlString = url; 996 return; 1092 997 } 1093 998 … … 1095 1000 1096 1001 while (isSchemeChar(url[schemeEnd])) { 1097 schemeEnd++;1002 schemeEnd++; 1098 1003 } 1099 1004 1100 1005 if (url[schemeEnd] != ':') { 1101 m_isValid = false;1102 urlString = url;1103 return;1006 m_isValid = false; 1007 urlString = url; 1008 return; 1104 1009 } 1105 1010 … … 1116 1021 1117 1022 if (hierarchical && url[schemeEnd + 2] == '/') { 1118 // part after the scheme must be a net_path, parse the authority section1119 1120 // FIXME: authority characters may be scanned twice1121 userStart += 2;1122 userEnd = userStart;1123 1124 int colonPos = 0;1125 while (isUserInfoChar(url[userEnd])) {1126 if (url[userEnd] == ':' && colonPos == 0) {1127 colonPos = userEnd;1128 }1129 userEnd++;1130 }1131 1132 if (url[userEnd] == '@') {1133 // actual end of the userinfo, start on the host1134 if (colonPos != 0) {1135 passwordEnd = userEnd;1136 userEnd = colonPos;1137 passwordStart = colonPos + 1;1138 } else {1139 passwordStart = passwordEnd = userEnd;1140 }1141 hostStart = passwordEnd + 1;1142 } else if (url[userEnd] == '[' || isPathSegmentEndChar(url[userEnd])) {1143 // hit the end of the authority, must have been no user1144 // or looks like an IPv6 hostname1145 // either way, try to parse it as a hostname1146 userEnd = userStart;1147 passwordStart = passwordEnd = userEnd;1148 hostStart = userStart;1149 } else {1150 // invalid character1151 m_isValid = false;1152 urlString = url;1153 return;1154 }1155 1156 hostEnd = hostStart;1157 1158 // IPV6 IP address1159 if (url[hostEnd] == '[') {1160 hostEnd++;1161 while (isIPv6Char(url[hostEnd])) {1162 hostEnd++;1163 }1164 if (url[hostEnd] == ']') {1165 hostEnd++;1166 } else {1167 // invalid character1168 m_isValid = false;1169 urlString = url;1170 return;1171 }1172 } else {1173 while (isHostnameChar(url[hostEnd])) {1174 hostEnd++;1175 }1176 }1177 1178 if (url[hostEnd] == ':') {1179 portStart = portEnd = hostEnd + 1;1023 // part after the scheme must be a net_path, parse the authority section 1024 1025 // FIXME: authority characters may be scanned twice 1026 userStart += 2; 1027 userEnd = userStart; 1028 1029 int colonPos = 0; 1030 while (isUserInfoChar(url[userEnd])) { 1031 if (url[userEnd] == ':' && colonPos == 0) { 1032 colonPos = userEnd; 1033 } 1034 userEnd++; 1035 } 1036 1037 if (url[userEnd] == '@') { 1038 // actual end of the userinfo, start on the host 1039 if (colonPos != 0) { 1040 passwordEnd = userEnd; 1041 userEnd = colonPos; 1042 passwordStart = colonPos + 1; 1043 } else { 1044 passwordStart = passwordEnd = userEnd; 1045 } 1046 hostStart = passwordEnd + 1; 1047 } else if (url[userEnd] == '[' || isPathSegmentEndChar(url[userEnd])) { 1048 // hit the end of the authority, must have been no user 1049 // or looks like an IPv6 hostname 1050 // either way, try to parse it as a hostname 1051 userEnd = userStart; 1052 passwordStart = passwordEnd = userEnd; 1053 hostStart = userStart; 1054 } else { 1055 // invalid character 1056 m_isValid = false; 1057 urlString = url; 1058 return; 1059 } 1060 1061 hostEnd = hostStart; 1062 1063 // IPV6 IP address 1064 if (url[hostEnd] == '[') { 1065 hostEnd++; 1066 while (isIPv6Char(url[hostEnd])) { 1067 hostEnd++; 1068 } 1069 if (url[hostEnd] == ']') { 1070 hostEnd++; 1071 } else { 1072 // invalid character 1073 m_isValid = false; 1074 urlString = url; 1075 return; 1076 } 1077 } else { 1078 while (isHostnameChar(url[hostEnd])) { 1079 hostEnd++; 1080 } 1081 } 1082 1083 if (url[hostEnd] == ':') { 1084 portStart = portEnd = hostEnd + 1; 1180 1085 1181 // possible start of port1182 portEnd = portStart;1183 while (isdigit(url[portEnd])) {1184 portEnd++;1185 }1186 } else {1187 portStart = portEnd = hostEnd;1188 }1189 1190 if (!isPathSegmentEndChar(url[portEnd])) {1191 // invalid character1192 m_isValid = false;1193 urlString = url;1194 return;1195 }1086 // possible start of port 1087 portEnd = portStart; 1088 while (isdigit(url[portEnd])) { 1089 portEnd++; 1090 } 1091 } else { 1092 portStart = portEnd = hostEnd; 1093 } 1094 1095 if (!isPathSegmentEndChar(url[portEnd])) { 1096 // invalid character 1097 m_isValid = false; 1098 urlString = url; 1099 return; 1100 } 1196 1101 } else { 1197 // the part after the scheme must be an opaque_part or an abs_path1198 userEnd = userStart;1199 passwordStart = passwordEnd = userEnd;1200 hostStart = hostEnd = passwordEnd;1201 portStart = portEnd = hostEnd;1202 } 1203 1102 // the part after the scheme must be an opaque_part or an abs_path 1103 userEnd = userStart; 1104 passwordStart = passwordEnd = userEnd; 1105 hostStart = hostEnd = passwordEnd; 1106 portStart = portEnd = hostEnd; 1107 } 1108 1204 1109 int pathStart = portEnd; 1205 1110 int pathEnd = pathStart; … … 1213 1118 pathEnd++; 1214 1119 } 1215 queryStart = queryEnd = pathEnd;1120 queryStart = queryEnd = pathEnd; 1216 1121 1217 1122 while (url[queryEnd] != '\0') { … … 1219 1124 } 1220 1125 1221 fragmentStart = fragmentEnd = queryEnd;1126 fragmentStart = fragmentEnd = queryEnd; 1222 1127 } 1223 1128 else { … … 1251 1156 uint bufferLength = fragmentEnd * 3 + 1; 1252 1157 if (bufferLength <= sizeof(staticBuffer)) { 1253 buffer = staticBuffer;1158 buffer = staticBuffer; 1254 1159 } else { 1255 buffer = (char *)fastMalloc(bufferLength);1160 buffer = (char *)fastMalloc(bufferLength); 1256 1161 } 1257 1162 … … 1262 1167 const char *schemeEndPtr = url + schemeEnd; 1263 1168 while (strPtr < schemeEndPtr) { 1264 *p++ = *strPtr++;1169 *p++ = *strPtr++; 1265 1170 } 1266 1171 schemeEndPos = p - buffer; … … 1312 1217 1313 1218 *p++ = '/'; 1314 *p++ = '/';1315 1316 userStartPos = p - buffer;1317 1318 // copy in the user1319 strPtr = url + userStart;1320 const char *userEndPtr = url + userEnd;1321 while (strPtr < userEndPtr) {1322 *p++ = *strPtr++;1323 }1324 userEndPos = p - buffer;1325 1326 // copy in the password1327 if (passwordEnd != passwordStart) {1328 *p++ = ':';1329 strPtr = url + passwordStart;1330 const char *passwordEndPtr = url + passwordEnd;1331 while (strPtr < passwordEndPtr) {1332 *p++ = *strPtr++;1333 }1334 }1335 passwordEndPos = p - buffer;1336 1337 // If we had any user info, add "@"1338 if (p - buffer != userStartPos) {1339 *p++ = '@';1340 }1341 1342 // copy in the host, except in the case of a file URL with authority="localhost"1343 if (!(isFile && hostIsLocalHost && !haveNonHostAuthorityPart)) {1219 *p++ = '/'; 1220 1221 userStartPos = p - buffer; 1222 1223 // copy in the user 1224 strPtr = url + userStart; 1225 const char *userEndPtr = url + userEnd; 1226 while (strPtr < userEndPtr) { 1227 *p++ = *strPtr++; 1228 } 1229 userEndPos = p - buffer; 1230 1231 // copy in the password 1232 if (passwordEnd != passwordStart) { 1233 *p++ = ':'; 1234 strPtr = url + passwordStart; 1235 const char *passwordEndPtr = url + passwordEnd; 1236 while (strPtr < passwordEndPtr) { 1237 *p++ = *strPtr++; 1238 } 1239 } 1240 passwordEndPos = p - buffer; 1241 1242 // If we had any user info, add "@" 1243 if (p - buffer != userStartPos) { 1244 *p++ = '@'; 1245 } 1246 1247 // copy in the host, except in the case of a file URL with authority="localhost" 1248 if (!(isFile && hostIsLocalHost && !haveNonHostAuthorityPart)) { 1344 1249 strPtr = url + hostStart; 1345 1250 const char *hostEndPtr = url + hostEnd; … … 1348 1253 } 1349 1254 } 1350 hostEndPos = p - buffer;1351 1352 // copy in the port1353 if (portEnd != portStart) {1354 *p++ = ':';1355 strPtr = url + portStart;1356 const char *portEndPtr = url + portEnd;1357 while (strPtr < portEndPtr) {1358 *p++ = *strPtr++;1359 }1360 }1361 portEndPos = p - buffer;1255 hostEndPos = p - buffer; 1256 1257 // copy in the port 1258 if (portEnd != portStart) { 1259 *p++ = ':'; 1260 strPtr = url + portStart; 1261 const char *portEndPtr = url + portEnd; 1262 while (strPtr < portEndPtr) { 1263 *p++ = *strPtr++; 1264 } 1265 } 1266 portEndPos = p - buffer; 1362 1267 } else { 1363 userStartPos = userEndPos = passwordEndPos = hostEndPos = portEndPos = p - buffer;1268 userStartPos = userEndPos = passwordEndPos = hostEndPos = portEndPos = p - buffer; 1364 1269 } 1365 1270 … … 1399 1304 // add fragment, escaping bad characters 1400 1305 if (fragmentEnd != queryEnd) { 1401 *p++ = '#';1402 appendEscapingBadChars(p, url + fragmentStart, fragmentEnd - fragmentStart);1306 *p++ = '#'; 1307 appendEscapingBadChars(p, url + fragmentStart, fragmentEnd - fragmentStart); 1403 1308 } 1404 1309 fragmentEndPos = p - buffer; … … 1407 1312 // it started as a QString, just reuse it, to avoid extra 1408 1313 // allocation. 1409 if (originalString != NULL&& strncmp(buffer, url, fragmentEndPos) == 0) {1410 urlString = *originalString;1314 if (originalString && strncmp(buffer, url, fragmentEndPos) == 0) { 1315 urlString = *originalString; 1411 1316 } else { 1412 urlString = QString(buffer, fragmentEndPos);1317 urlString = QString(buffer, fragmentEndPos); 1413 1318 } 1414 1319 1415 1320 ASSERT(p - buffer <= (int)bufferLength); 1416 1321 1417 1322 if (buffer != staticBuffer) { 1418 fastFree(buffer);1323 fastFree(buffer); 1419 1324 } 1420 1325 } … … 1445 1350 uint bufferLength = asUTF8.length() * 3 + 1; 1446 1351 if (bufferLength <= sizeof(staticBuffer)) { 1447 buffer = staticBuffer;1352 buffer = staticBuffer; 1448 1353 } else { 1449 buffer = (char *)fastMalloc(bufferLength);1354 buffer = (char *)fastMalloc(bufferLength); 1450 1355 } 1451 1356 … … 1455 1360 const char *strEnd = str + asUTF8.length(); 1456 1361 while (str < strEnd) { 1457 unsigned char c = *str++;1362 unsigned char c = *str++; 1458 1363 if (isBadChar(c)) { 1459 1364 *p++ = '%'; 1460 1365 *p++ = hexDigits[c >> 4]; 1461 1366 *p++ = hexDigits[c & 0xF]; 1462 } else {1463 *p++ = c;1464 }1367 } else { 1368 *p++ = c; 1369 } 1465 1370 } 1466 1371 … … 1468 1373 1469 1374 ASSERT(p - buffer <= (int)bufferLength); 1470 1375 1471 1376 if (buffer != staticBuffer) { 1472 fastFree(buffer);1377 fastFree(buffer); 1473 1378 } 1474 1379 … … 1507 1412 UErrorCode error = U_ZERO_ERROR; 1508 1413 int32_t numCharactersConverted = uidna_IDNToASCII 1509 (reinterpret_cast<const UChar *>(s.unicode()), s.length(), buffer, hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, NULL, &error);1414 (reinterpret_cast<const UChar *>(s.unicode()), s.length(), buffer, hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, 0, &error); 1510 1415 if (error != U_ZERO_ERROR) { 1511 1416 return s; … … 1730 1635 1731 1636 if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos)) { 1732 pathEnd = hashPos;1637 pathEnd = hashPos; 1733 1638 } else if (questionPos >= 0) { 1734 pathEnd = questionPos;1639 pathEnd = questionPos; 1735 1640 } else { 1736 pathEnd = string.length();1641 pathEnd = string.length(); 1737 1642 } 1738 1643 -
trunk/WebCore/kwq/KWQLoader.mm
- Property allow-tabs deleted
r12086 r12114 68 68 69 69 while (NSString *line = (NSString *)[e nextObject]) { 70 if ([line length]) {70 if ([line length]) { 71 71 unichar firstChar = [line characterAtIndex:0]; 72 72 if ((firstChar == ' ' || firstChar == '\t') && lastHeaderName != nil) { … … 79 79 continue; 80 80 } 81 }82 83 NSRange colonRange = [line rangeOfString:@":"];84 if (colonRange.location != NSNotFound) {85 // don't worry about case, assume lower levels will take care of it86 87 NSString *headerName = [[line substringToIndex:colonRange.location] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \t"]];88 NSString *headerValue = [[line substringFromIndex:colonRange.location + 1] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \t"]];89 90 NSString *oldVal = [headers objectForKey:headerName];91 if (oldVal) {92 headerValue = [NSString stringWithFormat:@"%@, %@", oldVal, headerValue];93 }94 95 [headers setObject:headerValue forKey:headerName];96 97 lastHeaderName = headerName;98 }81 } 82 83 NSRange colonRange = [line rangeOfString:@":"]; 84 if (colonRange.location != NSNotFound) { 85 // don't worry about case, assume lower levels will take care of it 86 87 NSString *headerName = [[line substringToIndex:colonRange.location] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \t"]]; 88 NSString *headerValue = [[line substringFromIndex:colonRange.location + 1] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \t"]]; 89 90 NSString *oldVal = [headers objectForKey:headerName]; 91 if (oldVal) { 92 headerValue = [NSString stringWithFormat:@"%@, %@", oldVal, headerValue]; 93 } 94 95 [headers setObject:headerValue forKey:headerName]; 96 97 lastHeaderName = headerName; 98 } 99 99 } 100 100 … … 124 124 125 125 if (!headerString.isEmpty()) { 126 headerDict = [NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()];126 headerDict = [NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()]; 127 127 } 128 128 129 129 if (job->method() == "POST") { 130 handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL() customHeaders:headerDict130 handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL() customHeaders:headerDict 131 131 postData:arrayFromFormData(job->postData())]; 132 132 } else { 133 handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL() customHeaders:headerDict];133 handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL() customHeaders:headerDict]; 134 134 } 135 135 [resourceLoader setHandle:handle]; … … 152 152 153 153 while ((key = [e nextObject]) != nil) { 154 if (first) {155 first = false;156 } else {157 [headerString appendString:@"\n"];158 }159 [headerString appendString:key];160 [headerString appendString:@": "];161 [headerString appendString:[headers objectForKey:key]];162 } 163 154 if (first) { 155 first = false; 156 } else { 157 [headerString appendString:@"\n"]; 158 } 159 [headerString appendString:key]; 160 [headerString appendString:@": "]; 161 [headerString appendString:[headers objectForKey:key]]; 162 } 163 164 164 return headerString; 165 165 } … … 178 178 179 179 if (!headerString.isEmpty()) { 180 headerDict = [[NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()] retain];180 headerDict = [[NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()] retain]; 181 181 } 182 182 183 183 NSArray *postData = nil; 184 184 if (job->method() == "POST") { 185 postData = arrayFromFormData(job->postData());185 postData = arrayFromFormData(job->postData()); 186 186 } 187 187 … … 244 244 MacFrame *frame = static_cast<MacFrame *>(loader->frame()); 245 245 246 if (!frame->haveToldBridgeAboutLoad(cachedObject->url() .qstring())) {246 if (!frame->haveToldBridgeAboutLoad(cachedObject->url())) { 247 247 WebCoreFrameBridge *bridge = frame->bridge(); 248 248 … … 253 253 KWQ_UNBLOCK_EXCEPTIONS; 254 254 255 frame->didTellBridgeAboutLoad(cachedObject->url() .qstring());255 frame->didTellBridgeAboutLoad(cachedObject->url()); 256 256 } 257 257 } … … 282 282 bool ret = false; 283 283 if(!memcmp(urlStringCharacters, m_url.unicode(), m_url.length()*sizeof(QChar))) 284 ret = true;284 ret = true; 285 285 286 286 if (urlStringCharacters != _buffer) -
trunk/WebCore/loader/Cache.cpp
r12089 r12114 28 28 #include "config.h" 29 29 #include "Cache.h" 30 31 #include "CachedCSSStyleSheet.h" 30 32 #include "CachedImage.h" 31 33 #include "CachedScript.h" 32 34 #include "CachedXSLStyleSheet.h" 33 #include "CachedCSSStyleSheet.h"34 35 #include "DocLoader.h" 36 #include "DocumentImpl.h" 35 37 #include "loader.h" 36 #include "DocumentImpl.h"37 38 #include <qpixmap.h>39 40 // up to which size is a picture for sure cacheable41 #define MAXCACHEABLE 40*102442 // default cache size43 #define DEFCACHESIZE 4096*102444 45 38 #include <kio/job.h> 46 39 #include <kio/jobclasses.h> 47 48 40 #include <kxmlcore/Assertions.h> 49 50 using namespace khtml; 41 #include <qpixmap.h> 42 51 43 using namespace DOM; 52 44 45 namespace khtml { 46 47 const int defaultCacheSize = 4096 * 1024; 48 49 // maxCacheableObjectSize is cache size divided by 128, but with this as a minimum 50 const int minMaxCacheableObjectSize = 40 * 1024; 51 52 const int maxLRULists = 20; 53 54 struct LRUList { 55 CachedObject* m_head; 56 CachedObject* m_tail; 57 LRUList() : m_head(0), m_tail(0) { } 58 }; 59 53 60 static bool cacheDisabled; 54 61 55 LRUList::LRUList() :m_head(0), m_tail(0) 56 { 57 } 58 59 LRUList::~LRUList() 60 { 61 } 62 63 QDict<CachedObject> *Cache::cache = 0; 62 typedef HashMap<RefPtr<DOMStringImpl>, CachedObject*> CacheMap; 63 64 static CacheMap* cache = 0; 65 64 66 QPtrList<DocLoader>* Cache::docloader = 0; 65 67 Loader *Cache::m_loader = 0; 66 68 67 int Cache::maxSize = DEFCACHESIZE;68 int Cache::maxCacheable = MAXCACHEABLE;69 int Cache::maxSize = defaultCacheSize; 70 int Cache::maxCacheable = minMaxCacheableObjectSize; 69 71 int Cache::flushCount = 0; 70 72 … … 79 81 void Cache::init() 80 82 { 81 if ( !cache)82 cache = new QDict<CachedObject>(401, true);83 if (!cache) 84 cache = new CacheMap; 83 85 84 86 if ( !docloader ) … … 100 102 return; 101 103 102 cache->setAutoDelete( true ); 104 CacheMap::iterator e = cache->end(); 105 for (CacheMap::iterator i = cache->begin(); i != e; ++i) 106 delete i->second; 107 103 108 delete cache; cache = 0; 104 109 delete nullPixmap; nullPixmap = 0; … … 135 140 CachedObject *o = 0; 136 141 if (!reload) 137 o = cache-> find(url.url());142 o = cache->get(DOMString(url.url()).impl()); 138 143 if(!o) 139 144 { … … 146 151 im->setFree(true); 147 152 else { 148 cache->insert( url.url(), im);149 moveToHeadOfLRUList(im);153 cache->set(DOMString(url.url()).impl(), im); 154 moveToHeadOfLRUList(im); 150 155 } 151 156 o = im; … … 195 200 // Checking if the URL is malformed is lots of extra work for little benefit. 196 201 197 CachedObject *o = cache-> find(kurl.url());202 CachedObject *o = cache->get(DOMString(kurl.url()).impl()); 198 203 if(!o) 199 204 { … … 205 210 sheet->setFree(true); 206 211 else { 207 cache->insert( kurl.url(), sheet);208 moveToHeadOfLRUList(sheet);212 cache->set(DOMString(kurl.url()).impl(), sheet); 213 moveToHeadOfLRUList(sheet); 209 214 } 210 215 o = sheet; … … 236 241 } 237 242 238 void Cache::preloadStyleSheet( const QString &url, const QString &stylesheet_data) 239 { 240 CachedObject *o = cache->find(url); 241 if(o) 242 removeCacheEntry(o); 243 244 CachedCSSStyleSheet *stylesheet = new CachedCSSStyleSheet(url, stylesheet_data); 245 cache->insert( url, stylesheet ); 243 void Cache::preloadStyleSheet(const QString &url, const QString &stylesheet_data) 244 { 245 CachedObject *o = cache->get(DOMString(url).impl()); 246 if (o) 247 remove(o); 248 cache->set(DOMString(url).impl(), new CachedCSSStyleSheet(url, stylesheet_data)); 246 249 } 247 250 … … 264 267 // Checking if the URL is malformed is lots of extra work for little benefit. 265 268 266 CachedObject *o = cache-> find(kurl.url());269 CachedObject *o = cache->get(DOMString(kurl.url()).impl()); 267 270 if(!o) 268 271 { … … 274 277 script->setFree(true); 275 278 else { 276 cache->insert( kurl.url(), script );277 moveToHeadOfLRUList(script);279 cache->set(DOMString(kurl.url()).impl(), script ); 280 moveToHeadOfLRUList(script); 278 281 } 279 282 o = script; … … 306 309 } 307 310 308 void Cache::preloadScript( const QString &url, const QString &script_data)309 { 310 CachedObject *o = cache-> find(url);311 void Cache::preloadScript(const QString &url, const QString &script_data) 312 { 313 CachedObject *o = cache->get(DOMString(url).impl()); 311 314 if(o) 312 removeCacheEntry(o); 313 314 CachedScript *script = new CachedScript(url, script_data); 315 cache->insert( url, script ); 315 remove(o); 316 cache->set(DOMString(url).impl(), new CachedScript(url, script_data)); 316 317 } 317 318 … … 334 335 // Checking if the URL is malformed is lots of extra work for little benefit. 335 336 336 CachedObject *o = cache-> find(kurl.url());337 CachedObject *o = cache->get(DOMString(kurl.url()).impl()); 337 338 if (!o) { 338 339 #ifdef CACHE_DEBUG … … 343 344 doc->setFree(true); 344 345 else { 345 cache-> insert(kurl.url(), doc);346 cache->set(DOMString(kurl.url()).impl(), doc); 346 347 moveToHeadOfLRUList(doc); 347 348 } … … 392 393 // Checking if the URL is malformed is lots of extra work for little benefit. 393 394 394 CachedObject *o = cache-> find(kurl.url());395 CachedObject *o = cache->get(DOMString(kurl.url()).impl()); 395 396 if(!o) 396 397 { … … 402 403 doc->setFree(true); 403 404 else { 404 cache-> insert(kurl.url(), doc);405 cache->set(DOMString(kurl.url()).impl(), doc); 405 406 moveToHeadOfLRUList(doc); 406 407 } … … 445 446 446 447 while (m_headOfUncacheableList) 447 remove CacheEntry(m_headOfUncacheableList);448 449 for (int i = MAX_LRU_LISTS-1; i>=0; i--) {448 remove(m_headOfUncacheableList); 449 450 for (int i = maxLRULists-1; i>=0; i--) { 450 451 if (m_totalSizeOfLRULists <= maxSize) 451 452 break; 452 453 453 454 while (m_totalSizeOfLRULists > maxSize && m_LRULists[i].m_tail) 454 remove CacheEntry(m_LRULists[i].m_tail);455 remove(m_LRULists[i].m_tail); 455 456 } 456 457 … … 459 460 460 461 461 void Cache::setSize( int bytes)462 void Cache::setSize(int bytes) 462 463 { 463 464 maxSize = bytes; 464 maxCacheable = kMax(maxSize / 128, MAXCACHEABLE);465 maxCacheable = kMax(maxSize / 128, minMaxCacheableObjectSize); 465 466 466 467 // may be we need to clear parts of the cache … … 469 470 } 470 471 471 void Cache::removeCacheEntry( CachedObject *object ) 472 { 473 QString key = object->url().qstring(); 474 472 void Cache::remove( CachedObject *object ) 473 { 475 474 // this indicates the deref() method of CachedObject to delete itself when the reference counter 476 475 // drops down to zero 477 object->setFree( true);478 479 cache->remove( key);476 object->setFree(true); 477 478 cache->remove(object->url().impl()); 480 479 removeFromLRUList(object); 481 480 … … 488 487 } 489 488 490 #define FAST_LOG2(_log2,_n) \ 491 unsigned int j_ = (unsigned int)(_n); \ 492 (_log2) = 0; \ 493 if ((j_) & ((j_)-1)) \ 494 (_log2) += 1; \ 495 if ((j_) >> 16) \ 496 (_log2) += 16, (j_) >>= 16; \ 497 if ((j_) >> 8) \ 498 (_log2) += 8, (j_) >>= 8; \ 499 if ((j_) >> 4) \ 500 (_log2) += 4, (j_) >>= 4; \ 501 if ((j_) >> 2) \ 502 (_log2) += 2, (j_) >>= 2; \ 503 if ((j_) >> 1) \ 504 (_log2) += 1; 505 506 static int FastLog2(unsigned int i) { 507 int log2; 508 FAST_LOG2(log2,i); 489 static inline int FastLog2(uint32_t i) 490 { 491 int log2 = 0; 492 if (i & (i - 1)) 493 log2 += 1; 494 if (i >> 16) 495 log2 += 16, i >>= 16; 496 if (i >> 8) 497 log2 += 8, i >>= 8; 498 if (i >> 4) 499 log2 += 4, i >>= 4; 500 if (i >> 2) 501 log2 += 2, i >>= 2; 502 if (i >> 1) 503 log2 += 1; 509 504 return log2; 510 505 } … … 518 513 } else { 519 514 int sizeLog = FastLog2(o->size()); 520 queueIndex = sizeLog /o->accessCount() - 1;515 queueIndex = sizeLog / o->accessCount() - 1; 521 516 if (queueIndex < 0) 522 517 queueIndex = 0; 523 if (queueIndex >= MAX_LRU_LISTS) 524 queueIndex = MAX_LRU_LISTS-1; 525 } 526 if (m_LRULists == 0) { 527 m_LRULists = new LRUList [MAX_LRU_LISTS]; 528 } 518 if (queueIndex >= maxLRULists) 519 queueIndex = maxLRULists-1; 520 } 521 if (!m_LRULists) 522 m_LRULists = new LRUList [maxLRULists]; 529 523 return &m_LRULists[queueIndex]; 530 524 } … … 613 607 return stats; 614 608 615 QDictIterator<CachedObject> i(*cache);616 for ( i.toFirst(); i.current(); ++i) {617 CachedObject *o = i .current();609 CacheMap::iterator e = cache->end(); 610 for (CacheMap::iterator i = cache->begin(); i != e; ++i) { 611 CachedObject *o = i->second; 618 612 switch (o->type()) { 619 613 case CachedObject::Image: … … 658 652 659 653 for (;;) { 660 QDictIterator<CachedObject> i(*cache); 661 CachedObject *o = i.toFirst(); 662 if (!o) 654 CacheMap::iterator i = cache->begin(); 655 if (i == cache->end()) 663 656 break; 664 remove CacheEntry(o);657 remove(i->second); 665 658 } 666 659 } … … 672 665 flushAll(); 673 666 } 667 668 CachedObject* Cache::get(const DOMString& s) 669 { 670 return (cache && s.impl()) ? cache->get(s.impl()) : 0; 671 } 672 673 } -
trunk/WebCore/loader/Cache.h
- Property allow-tabs deleted
r12089 r12114 24 24 pages from the web. It has a memory cache for these objects. 25 25 */ 26 26 27 #ifndef KHTML_Cache_h 27 28 #define KHTML_Cache_h 28 29 29 #include <qptrdict.h> 30 #include "dom/dom_string.h" 31 #include <kio/global.h> 30 32 #include <qptrlist.h> 31 #include <qdict.h>32 33 #include <qstring.h> 33 34 #include <kio/global.h>35 36 #include <dom/dom_string.h>37 34 38 35 class QPixmap; … … 41 38 namespace khtml 42 39 { 40 class CachedCSSStyleSheet; 41 class CachedImage; 43 42 class CachedObject; 44 class CachedImage;45 43 class CachedScript; 46 class CachedCSSStyleSheet;47 44 class CachedXSLStyleSheet; 45 class DocLoader; 48 46 class Loader; 49 class DocLoader; 50 51 #define MAX_LRU_LISTS 20 52 53 struct LRUList { 54 CachedObject* m_head; 55 CachedObject* m_tail; 56 57 LRUList(); 58 ~LRUList(); 59 }; 47 struct LRUList; 60 48 61 49 /** … … 65 53 class Cache 66 54 { 67 friend class DocLoader;55 friend class DocLoader; 68 56 public: 69 /**70 * init the cache in case it's not already. This needs to get called once71 * before using it.72 */73 static void init();57 /** 58 * init the cache in case it's not already. This needs to get called once 59 * before using it. 60 */ 61 static void init(); 74 62 75 /**76 * Ask the cache for some url. Will return a cachedObject, and77 * load the requested data in case it's not cahced63 /** 64 * Ask the cache for some url. Will return a cachedObject, and 65 * load the requested data in case it's not cahced 78 66 * if the DocLoader is zero, the url must be full-qualified. 79 67 * Otherwise, it is automatically base-url expanded 80 */81 static CachedImage *requestImage( DocLoader* l, const DOM::DOMString &url, bool reload=false, time_t _expireDate=0);82 static CachedImage *requestImage( DocLoader* l, const KURL &url, bool reload=false, time_t _expireDate=0);68 */ 69 static CachedImage* requestImage(DocLoader*, const DOM::DOMString& URL, bool reload = false, time_t expireDate = 0); 70 static CachedImage* requestImage(DocLoader*, const KURL& url, bool reload = false, time_t expireDate = 0); 83 71 84 /** 85 * Ask the cache for some url. Will return a cachedObject, and 86 * load the requested data in case it's not cached 87 */ 88 static CachedCSSStyleSheet *requestStyleSheet( DocLoader* l, const DOM::DOMString &url, bool reload=false, time_t _expireDate=0, const QString& charset = QString::null); 89 90 #ifdef KHTML_XSLT 91 // Ask the cache for an XSL stylesheet. 92 static CachedXSLStyleSheet* requestXSLStyleSheet(DocLoader* l, const DOM::DOMString &url, 93 bool reload=false, time_t _expireDate=0); 94 #endif 95 #ifndef KHTML_NO_XBL 96 // Ask the cache for an XBL document. 97 static CachedXBLDocument* requestXBLDocument(DocLoader* l, const DOM::DOMString &url, 98 bool reload=false, time_t _expireDate=0); 99 #endif 72 /** 73 * Ask the cache for some url. Will return a cachedObject, and 74 * load the requested data in case it's not cached 75 */ 76 static CachedCSSStyleSheet* requestStyleSheet(DocLoader*, const DOM::DOMString& URL, bool reload = false, time_t expireDate = 0, const QString& charset = QString::null); 100 77 101 78 /** 102 79 * Pre-loads a stylesheet into the cache. 103 80 */ 104 static void preloadStyleSheet(const QString &url, const QString &stylesheet_data);81 static void preloadStyleSheet(const QString &url, const QString& stylesheetData); 105 82 106 /**107 * Ask the cache for some url. Will return a cachedObject, and108 * load the requested data in case it's not cahced109 */110 static CachedScript *requestScript( DocLoader* l, const DOM::DOMString &url, bool reload=false, time_t _expireDate=0, const QString& charset=QString::null);83 /** 84 * Ask the cache for some url. Will return a cachedObject, and 85 * load the requested data in case it's not cahced 86 */ 87 static CachedScript* requestScript(DocLoader*, const DOM::DOMString& URL, bool reload = false, time_t expireDate = 0, const QString& charset = QString::null); 111 88 112 89 /** 113 90 * Pre-loads a script into the cache. 114 91 */ 115 static void preloadScript(const QString &url, const QString &script_data);92 static void preloadScript(const QString &url, const QString& scriptData); 116 93 117 /** 118 * sets the size of the cache. This will only hod approximately, since the size some 119 * cached objects (like stylesheets) take up in memory is not exaclty known. 120 */ 121 static void setSize( int bytes ); 122 /** 123 * returns the size of the cache 124 */ 125 static int size() { return maxSize; }; 94 #ifdef KHTML_XSLT 95 // Ask the cache for an XSL stylesheet. 96 static CachedXSLStyleSheet* requestXSLStyleSheet(DocLoader*, const DOM::DOMString& URL, bool reload = false, time_t expireDate = 0); 97 #endif 98 99 #ifndef KHTML_NO_XBL 100 // Ask the cache for an XBL document. 101 static CachedXBLDocument* requestXBLDocument(DocLoader*, const DOM::DOMString& URL, bool reload = false, time_t expireDate = 0); 102 #endif 103 104 /** 105 * Sets the size of the cache. This will only hod approximately, since the size some 106 * cached objects (like stylesheets) take up in memory is not exaclty known. 107 */ 108 static void setSize(int bytes); 109 /** 110 * returns the size of the cache 111 */ 112 static int size() { return maxSize; }; 126 113 127 114 static int maxCacheableObjectSize() { return maxCacheable; } 128 115 129 /** 130 * clean up cache 131 */ 132 static void flush(bool force=false); 116 // Get an existing cache entry by URL. 117 static CachedObject* get(const DOM::DOMString& URL); 133 118 134 /** 135 * clears the cache 136 * Warning: call this only at the end of your program, to clean 137 * up memory (useful for finding memory holes) 138 */ 139 static void clear(); 119 // Remove an existing cache entry. 120 static void remove(CachedObject*); 140 121 141 static Loader *loader() { return m_loader; } 122 /** 123 * clean up cache 124 */ 125 static void flush(bool force = false); 142 126 143 static QPixmap *nullPixmap; 144 static QPixmap *brokenPixmap; 127 /** 128 * clears the cache 129 * Warning: call this only at the end of your program, to clean 130 * up memory (useful for finding memory holes) 131 */ 132 static void clear(); 145 133 146 static void removeCacheEntry( CachedObject *object ); 134 static Loader* loader() { return m_loader; } 135 136 static QPixmap* nullPixmap; 137 static QPixmap* brokenPixmap; 147 138 148 139 struct TypeStatistic { … … 170 161 static void setCacheDisabled(bool); 171 162 172 static void insertInLRUList(CachedObject *);173 static void removeFromLRUList(CachedObject *);174 static bool adjustSize(CachedObject *, int sizeDelta);163 static void insertInLRUList(CachedObject*); 164 static void removeFromLRUList(CachedObject*); 165 static bool adjustSize(CachedObject*, int sizeDelta); 175 166 176 static LRUList* getLRUListFor(CachedObject* o);167 static LRUList* getLRUListFor(CachedObject*); 177 168 178 169 static void checkLRUAndUncacheableListIntegrity(); 179 170 180 protected: 181 static QDict<CachedObject> *cache; 171 private: 182 172 static QPtrList<DocLoader>* docloader; 183 173 … … 186 176 static int flushCount; 187 177 188 static Loader *m_loader;178 static Loader* m_loader; 189 179 190 static void moveToHeadOfLRUList(CachedObject *);180 static void moveToHeadOfLRUList(CachedObject*); 191 181 192 static LRUList *m_LRULists;182 static LRUList* m_LRULists; 193 183 static int m_totalSizeOfLRULists; 194 184 195 static CachedObject *m_headOfUncacheableList;185 static CachedObject* m_headOfUncacheableList; 196 186 197 187 static int m_countOfLRUAndUncacheableLists; 198 188 }; 199 } ;189 } 200 190 201 191 #endif -
trunk/WebCore/loader/CachedImage.cpp
r12089 r12114 28 28 #include "config.h" 29 29 #include "CachedImage.h" 30 31 #include "Cache.h" 30 32 #include "CachedImageCallback.h" 31 33 #include "CachedObjectClientWalker.h" 32 #include "Cache.h"33 34 #include "DocLoader.h" 34 35 #include "KWQLoader.h" … … 78 79 Cache::flush(); 79 80 CachedObject::deref(c); 80 if ( canDelete() && m_free)81 if (canDelete() && m_free) 81 82 delete this; 82 83 } … … 135 136 } 136 137 137 void CachedImage::data ( QBuffer &_buffer, bool eof)138 void CachedImage::data(QBuffer& _buffer, bool eof) 138 139 { 139 140 #ifdef CACHE_DEBUG … … 170 171 errorOccured = true; 171 172 QPixmap ep = pixmap(); 172 do_notify (ep, ep.rect());173 Cache::remove CacheEntry(this);173 do_notify(ep, ep.rect()); 174 Cache::remove(this); 174 175 } 175 176 else … … 205 206 } 206 207 207 } ;208 } -
trunk/WebCore/loader/CachedImageCallback.cpp
r12090 r12114 28 28 #include "config.h" 29 29 #include "CachedImageCallback.h" 30 30 31 #include "Cache.h" 31 #include "loader.h"32 32 #include "CachedImage.h" 33 33 #include "Request.h" 34 35 #include <qpainter.h> 36 34 #include "loader.h" 35 #include <kdebug.h> 37 36 #include <kio/job.h> 38 37 #include <kio/jobclasses.h> 39 #include <kdebug.h> 40 #include "decoder.h" 38 #include <qpainter.h> 41 39 42 40 using namespace DOM; … … 47 45 { 48 46 if (cachedImage) { 49 cachedImage->do_notify (cachedImage->pixmap(), cachedImage->pixmap().rect());47 cachedImage->do_notify(cachedImage->pixmap(), cachedImage->pixmap().rect()); 50 48 IntSize s = cachedImage->pixmap_size(); 51 49 cachedImage->setSize(s.width() * s.height() * 2); … … 80 78 { 81 79 if (cachedImage) { 82 cachedImage->do_notify (cachedImage->pixmap(), cachedImage->pixmap().rect());80 cachedImage->do_notify(cachedImage->pixmap(), cachedImage->pixmap().rect()); 83 81 cachedImage->m_loading = false; 84 82 cachedImage->checkNotify(); … … 110 108 cachedImage->errorOccured = true; 111 109 QPixmap ep = cachedImage->pixmap(); 112 cachedImage->do_notify (ep, ep.rect());113 Cache::remove CacheEntry(cachedImage);110 cachedImage->do_notify(ep, ep.rect()); 111 Cache::remove(cachedImage); 114 112 115 113 clear(); … … 133 131 } 134 132 135 } ;133 } -
trunk/WebCore/loader/CachedObject.h
r12092 r12114 24 24 pages from the web. It has a memory cache for these objects. 25 25 */ 26 26 27 #ifndef KHTML_CachedObject_h 27 28 #define KHTML_CachedObject_h … … 35 36 #include <qobject.h> 36 37 #include <qptrdict.h> 37 #include <qdict.h>38 38 #include <qpixmap.h> 39 39 #include <qbuffer.h> … … 226 226 }; 227 227 228 } ;229 230 #endif 228 } 229 230 #endif -
trunk/WebCore/loader/DocLoader.cpp
r12089 r12114 75 75 if (!m_reloadedURLs.contains(fullURL.url())) 76 76 { 77 CachedObject *existing = Cache::cache->find(fullURL.url());77 CachedObject* existing = Cache::get(fullURL.url()); 78 78 if (existing && existing->isExpired()) 79 79 { 80 Cache::remove CacheEntry(existing);80 Cache::remove(existing); 81 81 m_reloadedURLs.append(fullURL.url()); 82 82 reload = true; … … 88 88 if (!m_reloadedURLs.contains(fullURL.url())) 89 89 { 90 CachedObject *existing = Cache::cache->find(fullURL.url());90 CachedObject* existing = Cache::get(fullURL.url()); 91 91 if (existing) 92 { 93 Cache::removeCacheEntry(existing); 94 } 92 Cache::remove(existing); 95 93 m_reloadedURLs.append(fullURL.url()); 96 94 reload = true; … … 100 98 } 101 99 102 CachedImage *DocLoader::requestImage( const DOM::DOMString &url)100 CachedImage *DocLoader::requestImage(const DOM::DOMString &url) 103 101 { 104 102 KURL fullURL = m_doc->completeURL(url.qstring()); -
trunk/WebCore/loader/DocLoader.h
r12089 r12114 24 24 pages from the web. It has a memory cache for these objects. 25 25 */ 26 26 27 #ifndef KHTML_DocLoader_h 27 28 #define KHTML_DocLoader_h 28 29 29 30 #include <qptrlist.h> 30 #include <qdict.h>31 31 #include <qbuffer.h> 32 32 #include <qstringlist.h> … … 107 107 }; 108 108 109 } ;109 } 110 110 111 111 #endif -
trunk/WebCore/loader/loader.cpp
r12089 r12114 5 5 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 6 6 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 7 Copyright (C) 2004 Apple Computer, Inc.7 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 8 8 9 9 This library is free software; you can redistribute it and/or … … 28 28 #include "config.h" 29 29 #include "loader.h" 30 30 31 #include "Cache.h" 31 #include "DocLoader.h"32 #include "CachedObject.h"33 32 #include "CachedImage.h" 34 33 #include "CachedImageCallback.h" 35 34 #include "CachedObject.h" 35 #include "DocLoader.h" 36 #include "Frame.h" 37 #include "KWQLoader.h" 38 #include "html_documentimpl.h" 36 39 #include <kio/job.h> 37 40 #include <kio/jobclasses.h> 38 39 41 #include <kxmlcore/Assertions.h> 40 #include "KWQLoader.h"41 #include "html_documentimpl.h"42 #include "Frame.h"43 42 44 43 using namespace DOM; … … 160 159 docLoader->setLoadInProgress(false); 161 160 emit requestFailed( docLoader, object ); 162 Cache::remove CacheEntry( object );161 Cache::remove( object ); 163 162 } 164 163 } … … 262 261 { 263 262 if (pIt.current()->m_docLoader == dl) { 264 Cache::remove CacheEntry( pIt.current()->object );263 Cache::remove( pIt.current()->object ); 265 264 m_requestsPending.remove( pIt ); 266 265 } … … 274 273 if (lIt.current()->m_docLoader == dl) { 275 274 KIO::Job *job = static_cast<KIO::Job *>( lIt.currentKey() ); 276 Cache::remove CacheEntry( lIt.current()->object );275 Cache::remove( lIt.current()->object ); 277 276 m_requestsLoading.remove( lIt.currentKey() ); 278 277 job->kill(); … … 285 284 while (bdIt.current()) { 286 285 if (bdIt.current()->m_docLoader == dl) { 287 Cache::remove CacheEntry( bdIt.current()->object );286 Cache::remove( bdIt.current()->object ); 288 287 m_requestsBackgroundDecoding.remove( bdIt ); 289 288 }
Note:
See TracChangeset
for help on using the changeset viewer.