Changeset 79827 in webkit
- Timestamp:
- Feb 27, 2011 1:16:50 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r79823 r79827 1 2011-02-27 Adam Roben <aroben@apple.com> 2 3 Make ResourceLoadDelegate print URLs relative to the main resource on Windows 4 5 This matches Mac. (In fact, the code was ported from Mac!) 6 7 Fixes <http://webkit.org/b/55328> URLs printed by ResourceLoadDelegate on Windows don't 8 match Mac 9 10 Reviewed by Anders Carlsson. 11 12 * DumpRenderTree/win/DumpRenderTree.cpp: 13 (substringFromIndex): Added. Emulates -[NSString substringFromIndex:]. 14 (urlSuitableForTestResult): Ported code from -[NSURL(DRTExtras) 15 _drt_descriptionSuitableForTestResult]. 16 (cfStringRefToWString): Moved here from LayoutTestControllerWin.cpp. 17 18 * DumpRenderTree/win/DumpRenderTreeWin.h: Added declaration of cfStringRefToWString. 19 20 * DumpRenderTree/win/LayoutTestControllerWin.cpp: Moved cfStringRefToWString to 21 DumpRenderTree.cpp. 22 1 23 2011-02-27 Adam Roben <aroben@apple.com> 2 24 -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r79793 r79827 41 41 #include "WorkQueue.h" 42 42 43 #include <comutil.h> 43 44 #include <fcntl.h> 44 45 #include <io.h> … … 132 133 } 133 134 134 wstring urlSuitableForTestResult(const wstring& url) 135 { 136 if (url.find(L"file://") == wstring::npos) 137 return url; 138 139 return lastPathComponent(url); 135 static RetainPtr<CFStringRef> substringFromIndex(CFStringRef string, CFIndex index) 136 { 137 return RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index))); 138 } 139 140 wstring urlSuitableForTestResult(const wstring& urlString) 141 { 142 RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); 143 144 RetainPtr<CFStringRef> scheme(AdoptCF, CFURLCopyScheme(url.get())); 145 if (scheme && CFStringCompare(scheme.get(), CFSTR("file"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) 146 return urlString; 147 148 COMPtr<IWebDataSource> dataSource; 149 if (FAILED(frame->dataSource(&dataSource))) { 150 if (FAILED(frame->provisionalDataSource(&dataSource))) 151 return urlString; 152 } 153 154 COMPtr<IWebMutableURLRequest> request; 155 if (FAILED(dataSource->request(&request))) 156 return urlString; 157 158 _bstr_t requestURLString; 159 if (FAILED(request->URL(requestURLString.GetAddress()))) 160 return urlString; 161 162 RetainPtr<CFURLRef> requestURL(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0)); 163 RetainPtr<CFURLRef> baseURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get())); 164 165 RetainPtr<CFStringRef> basePath(AdoptCF, CFURLCopyPath(baseURL.get())); 166 RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyPath(url.get())); 167 168 return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get()); 140 169 } 141 170 … … 167 196 { 168 197 return toUTF8(wideString.c_str(), wideString.length()); 198 } 199 200 wstring cfStringRefToWString(CFStringRef cfStr) 201 { 202 Vector<wchar_t> v(CFStringGetLength(cfStr)); 203 CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data()); 204 205 return wstring(v.data(), v.size()); 169 206 } 170 207 -
trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h
r70540 r79827 53 53 std::string toUTF8(BSTR); 54 54 std::string toUTF8(const std::wstring&); 55 std::wstring cfStringRefToWString(CFStringRef); 56 55 57 IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); 56 58 Vector<HWND>& openWindows(); -
trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
r79783 r79827 712 712 } 713 713 714 static wstring cfStringRefToWString(CFStringRef cfStr)715 {716 Vector<wchar_t> v(CFStringGetLength(cfStr));717 CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data());718 719 return wstring(v.data(), v.size());720 }721 722 714 void LayoutTestController::setUserStyleSheetLocation(JSStringRef jsURL) 723 715 {
Note: See TracChangeset
for help on using the changeset viewer.