Changeset 57775 in webkit
- Timestamp:
- Apr 16, 2010 9:40:14 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.mk
r57469 r57775 175 175 dom/UIEventWithKeyState.cpp \ 176 176 dom/UserGestureIndicator.cpp \ 177 dom/ViewportArguments.cpp \ 177 178 dom/WebKitAnimationEvent.cpp \ 178 179 dom/WebKitTransitionEvent.cpp \ -
trunk/WebCore/ChangeLog
r57770 r57775 1 2010-04-16 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Adam Treat. 4 5 https://bugs.webkit.org/show_bug.cgi?id=36312 6 7 Adds support for the viewport meta tag. The code is largely derived in whole 8 or in part from the WebCore-528.15 source published as part of the iPhone 3.1.3 9 source code <http://www.opensource.apple.com/source/WebCore/WebCore-528.15/>. 10 11 * Android.mk: Added file ViewportArguments.cpp. 12 * GNUmakefile.am: Added files ViewportArguments.cpp and ViewportArguments.h. 13 * WebCore.gypi: Ditto. 14 * WebCore.pro: Ditto. 15 * WebCore.vcproj/WebCore.vcproj: Ditto. 16 * WebCore.xcodeproj/project.pbxproj: Ditto. 17 * dom/Document.cpp: 18 (WebCore::isSeparator): Added. 19 (WebCore::Document::processArguments): Added. 20 (WebCore::Document::processViewport): Added. 21 * dom/Document.h: 22 * dom/ViewportArguments.cpp: Added. 23 (WebCore::setViewportFeature): 24 (WebCore::viewportErrorMessageTemplate): 25 (WebCore::viewportErrorMessageLevel): 26 (WebCore::reportViewportWarning): 27 * dom/ViewportArguments.h: Added. 28 (WebCore::): 29 (WebCore::ViewportArguments::): 30 (WebCore::ViewportArguments::ViewportArguments): 31 (WebCore::ViewportArguments::hasCustomArgument): 32 * html/HTMLMetaElement.cpp: 33 (WebCore::HTMLMetaElement::process): Modified to call Document::processViewport. 34 * page/ChromeClient.h: 35 (WebCore::ChromeClient::didReceiveViewportArguments): Added. 36 1 37 2010-04-16 No'am Rosenthal <noam.rosenthal@nokia.com> 2 38 -
trunk/WebCore/GNUmakefile.am
r57749 r57775 877 877 WebCore/dom/UserGestureIndicator.cpp \ 878 878 WebCore/dom/UserGestureIndicator.h \ 879 WebCore/dom/ViewportArguments.cpp \ 880 WebCore/dom/ViewportArguments.h \ 879 881 WebCore/dom/WebKitAnimationEvent.cpp \ 880 882 WebCore/dom/WebKitAnimationEvent.h \ -
trunk/WebCore/WebCore.gypi
r57749 r57775 1236 1236 'dom/UserGestureIndicator.cpp', 1237 1237 'dom/UserGestureIndicator.h', 1238 'dom/ViewportArguments.cpp', 1239 'dom/ViewportArguments.h', 1238 1240 'dom/WebKitAnimationEvent.cpp', 1239 1241 'dom/WebKitAnimationEvent.h', -
trunk/WebCore/WebCore.pro
r57749 r57775 538 538 dom/UIEventWithKeyState.cpp \ 539 539 dom/UserGestureIndicator.cpp \ 540 dom/ViewportArguments.cpp \ 540 541 dom/WebKitAnimationEvent.cpp \ 541 542 dom/WebKitTransitionEvent.cpp \ … … 1260 1261 dom/UIEventWithKeyState.h \ 1261 1262 dom/UserGestureIndicator.h \ 1263 dom/ViewportArguments.h \ 1262 1264 dom/WebKitAnimationEvent.h \ 1263 1265 dom/WebKitTransitionEvent.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r57749 r57775 29550 29550 </File> 29551 29551 <File 29552 RelativePath="..\dom\ViewportArguments.cpp" 29553 > 29554 </File> 29555 <File 29556 RelativePath="..\dom\ViewportArguments.h" 29557 > 29558 </File> 29559 <File 29552 29560 RelativePath="..\dom\WebKitAnimationEvent.cpp" 29553 29561 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r57749 r57775 4719 4719 CE4C00E610F6F7C100CA38F5 /* HTMLNoScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */; }; 4720 4720 CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4721 CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEF418CC1179678C009D112C /* ViewportArguments.cpp */; }; 4722 CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = CEF418CD1179678C009D112C /* ViewportArguments.h */; }; 4721 4723 D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */; }; 4722 4724 D01A27AE10C9BFD800026A42 /* SpaceSplitString.h in Headers */ = {isa = PBXBuildFile; fileRef = D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10092 10094 CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLNoScriptElement.h; sourceTree = "<group>"; }; 10093 10095 CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceProvider.h; sourceTree = "<group>"; }; 10096 CEF418CC1179678C009D112C /* ViewportArguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportArguments.cpp; sourceTree = "<group>"; }; 10097 CEF418CD1179678C009D112C /* ViewportArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportArguments.h; sourceTree = "<group>"; }; 10094 10098 D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceSplitString.cpp; sourceTree = "<group>"; }; 10095 10099 D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; }; … … 16289 16293 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */, 16290 16294 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */, 16295 CEF418CC1179678C009D112C /* ViewportArguments.cpp */, 16296 CEF418CD1179678C009D112C /* ViewportArguments.h */, 16291 16297 31C0FF1B0E4CEB6E007D6FE5 /* WebKitAnimationEvent.cpp */, 16292 16298 31C0FF1C0E4CEB6E007D6FE5 /* WebKitAnimationEvent.h */, … … 18859 18865 895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */, 18860 18866 895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */, 18867 CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */, 18861 18868 ); 18862 18869 runOnlyForDeploymentPostprocessing = 0; … … 21094 21101 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */, 21095 21102 895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */, 21103 CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */, 21096 21104 ); 21097 21105 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/dom/Document.cpp
r57533 r57775 127 127 #include "UIEvent.h" 128 128 #include "UserContentURLPattern.h" 129 #include "ViewportArguments.h" 129 130 #include "WebKitAnimationEvent.h" 130 131 #include "WebKitTransitionEvent.h" … … 2296 2297 } 2297 2298 } 2299 } 2300 2301 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't. 2302 static bool isSeparator(UChar c) 2303 { 2304 return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0'; 2305 } 2306 2307 void Document::processArguments(const String& features, void* data, ArgumentsCallback callback) 2308 { 2309 // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior. 2310 int keyBegin, keyEnd; 2311 int valueBegin, valueEnd; 2312 2313 int i = 0; 2314 int length = features.length(); 2315 String buffer = features.lower(); 2316 while (i < length) { 2317 // skip to first non-separator, but don't skip past the end of the string 2318 while (isSeparator(buffer[i])) { 2319 if (i >= length) 2320 break; 2321 i++; 2322 } 2323 keyBegin = i; 2324 2325 // skip to first separator 2326 while (!isSeparator(buffer[i])) 2327 i++; 2328 keyEnd = i; 2329 2330 // skip to first '=', but don't skip past a ',' or the end of the string 2331 while (buffer[i] != '=') { 2332 if (buffer[i] == ',' || i >= length) 2333 break; 2334 i++; 2335 } 2336 2337 // skip to first non-separator, but don't skip past a ',' or the end of the string 2338 while (isSeparator(buffer[i])) { 2339 if (buffer[i] == ',' || i >= length) 2340 break; 2341 i++; 2342 } 2343 valueBegin = i; 2344 2345 // skip to first separator 2346 while (!isSeparator(buffer[i])) 2347 i++; 2348 valueEnd = i; 2349 2350 ASSERT(i <= length); 2351 2352 String keyString = buffer.substring(keyBegin, keyEnd - keyBegin); 2353 String valueString = buffer.substring(valueBegin, valueEnd - valueBegin); 2354 callback(keyString, valueString, this, data); 2355 } 2356 } 2357 2358 void Document::processViewport(const String& features) 2359 { 2360 ASSERT(!features.isNull()); 2361 2362 Frame* frame = this->frame(); 2363 if (!frame) 2364 return; 2365 2366 ViewportArguments arguments; 2367 processArguments(features, (void*)&arguments, &setViewportFeature); 2368 2369 if (frame->page()) 2370 frame->page()->chrome()->client()->didReceiveViewportArguments(frame, arguments); 2298 2371 } 2299 2372 -
trunk/WebCore/dom/Document.h
r57391 r57775 701 701 */ 702 702 void processHttpEquiv(const String& equiv, const String& content); 703 703 void processViewport(const String& features); 704 704 705 // Returns the owning element in the parent document. 705 706 // Returns 0 if this is the top level document. … … 975 976 976 977 private: 978 979 typedef void (*ArgumentsCallback)(const String& keyString, const String& valueString, Document*, void* data); 980 void processArguments(const String& features, void* data, ArgumentsCallback); 981 977 982 virtual bool isDocument() const { return true; } 978 983 virtual void removedLastRef(); -
trunk/WebCore/html/HTMLMetaElement.cpp
r43187 r57775 64 64 void HTMLMetaElement::process() 65 65 { 66 if (!inDocument() || m_content.isNull()) 67 return; 68 69 if (equalIgnoringCase(name(), "viewport")) 70 document()->processViewport(m_content); 71 66 72 // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while 67 73 // it's not in the tree shouldn't have any effect on the document) 68 if ( inDocument() && !m_equiv.isNull() && !m_content.isNull())74 if (!m_equiv.isNull()) 69 75 document()->processHttpEquiv(m_equiv, m_content); 70 76 } -
trunk/WebCore/page/ChromeClient.h
r57631 r57775 57 57 58 58 struct FrameLoadRequest; 59 struct ViewportArguments; 59 60 struct WindowFeatures; 60 61 … … 146 147 virtual void setToolTip(const String&, TextDirection) = 0; 147 148 149 virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const { } 150 148 151 virtual void print(Frame*) = 0; 149 152
Note: See TracChangeset
for help on using the changeset viewer.