[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aestes at apple.com aestes at apple.com
Wed Dec 22 14:32:49 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1d9a54efeaa1248c114e5e92d083a75ef404d236
Author: aestes at apple.com <aestes at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 00:25:14 2010 +0000

    2010-10-12  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Darin Adler.
    
            REGRESSION (new parser): Leopard/Tiger Mail <head>/<body> quirk is gone
            https://bugs.webkit.org/show_bug.cgi?id=45693
    
            * WebKit.xcodeproj/project.pbxproj:
             - Add the MailQuirksUserScript.js to the project.
    2010-10-12  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Darin Adler.
    
            REGRESSION (new parser): Leopard/Tiger Mail <head>/<body> quirk is gone
            https://bugs.webkit.org/show_bug.cgi?id=45693
    
            Re-implement this former WebCore parser quirk as a
            Mac-only userscript-based quirk.  As far as I can tell
            from Darin's description this should satisfy Mail's needs.
    
            * Misc/MailQuirksUserScript.js: Added.
            * WebView/WebView.mm:
            (+[WebView _mailQuirksUserScript]):
            (-[WebView _injectMailQuirksScript]):
            (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69622 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 16b77e8..0dde043 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-12  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (new parser): Leopard/Tiger Mail <head>/<body> quirk is gone
+        https://bugs.webkit.org/show_bug.cgi?id=45693
+
+        * WebKit.xcodeproj/project.pbxproj:
+         - Add the MailQuirksUserScript.js to the project.
+
 2010-10-11  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index 364c9e5..a89c817 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -336,6 +336,7 @@
 		A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70936AE0B5608DC00CDB48E /* WebDragClient.mm */; };
 		A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */; };
 		A7D3C5BD0B5773C5002CA450 /* WebPasteboardHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = A7D3C5BB0B5773C5002CA450 /* WebPasteboardHelper.mm */; };
+		A864B3F6123ED9FA00C2A612 /* MailQuirksUserScript.js in Resources */ = {isa = PBXBuildFile; fileRef = A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */; };
 		AB9FBBBB0F8582B0006ADC43 /* WebDOMOperationsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = AB9FBBBA0F8582B0006ADC43 /* WebDOMOperationsInternal.h */; };
 		ABDDF20D08EB0DDC001E1241 /* WebDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */; };
 		B6CE5C24100BC5CE00219936 /* WebApplicationCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */; };
@@ -646,6 +647,7 @@
 		A70936AE0B5608DC00CDB48E /* WebDragClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClient.mm; sourceTree = "<group>"; };
 		A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardHelper.h; sourceTree = "<group>"; };
 		A7D3C5BB0B5773C5002CA450 /* WebPasteboardHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPasteboardHelper.mm; sourceTree = "<group>"; };
+		A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = MailQuirksUserScript.js; sourceTree = "<group>"; };
 		AB9FBBBA0F8582B0006ADC43 /* WebDOMOperationsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDOMOperationsInternal.h; sourceTree = "<group>"; };
 		ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownloadInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCache.h; sourceTree = "<group>"; };
@@ -930,6 +932,7 @@
 		254DC334016E1D3F0ECA149E /* Misc */ = {
 			isa = PBXGroup;
 			children = (
+				A864B3E5123ED83D00C2A612 /* MailQuirksUserScript.js */,
 				1CCFFD120B1F81F2002EE926 /* OldWebAssertions.c */,
 				5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */,
 				5241ADF30B1BC48A004012BD /* WebCache.h */,
@@ -1693,6 +1696,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				A864B3F6123ED9FA00C2A612 /* MailQuirksUserScript.js in Resources */,
 				939810BA0824BF01008DF038 /* IDNScriptWhiteList.txt in Resources */,
 				5DE83A7F0D0F7FAD00CAD12A /* Localizable.strings in Resources */,
 				939810B70824BF01008DF038 /* url_icon.tiff in Resources */,
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 44509d1..24e1fea 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-12  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (new parser): Leopard/Tiger Mail <head>/<body> quirk is gone
+        https://bugs.webkit.org/show_bug.cgi?id=45693
+
+        Re-implement this former WebCore parser quirk as a
+        Mac-only userscript-based quirk.  As far as I can tell
+        from Darin's description this should satisfy Mail's needs.
+
+        * Misc/MailQuirksUserScript.js: Added.
+        * WebView/WebView.mm:
+        (+[WebView _mailQuirksUserScript]):
+        (-[WebView _injectMailQuirksScript]):
+        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+
 2010-10-12  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit/mac/Misc/MailQuirksUserScript.js b/WebKit/mac/Misc/MailQuirksUserScript.js
new file mode 100644
index 0000000..e36c21b
--- /dev/null
+++ b/WebKit/mac/Misc/MailQuirksUserScript.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function() {
+    function childrenBefore(parent, stopAt)
+    {
+        var children = [];
+        for (var child = parent.firstChild; child != stopAt; child = child.nextSibling)
+            children.push(child);
+        return children;
+    }
+
+    // If html or body is missing, Mail.app's assumption that
+    // document.firstChild.firstChild == document.body is wrong anyway,
+    // so return null to not move anything.
+    if (!document.documentElement || !document.body)
+        return;
+
+    var children = childrenBefore(document, document.documentElement);
+    children = children.concat(childrenBefore(document.documentElement, document.body));
+
+    for (var i = children.length - 1; i >= 0; i--) {
+        var child = children[i];
+        // It's not possible to move doctype nodes into the body, so just remove them.
+        if (child.nodeType == child.DOCUMENT_TYPE_NODE)
+            child.parentNode.removeChild(child);
+        else
+            document.body.insertBefore(child, document.body.firstChild);
+    }
+})();
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 3283742..432d712 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -637,6 +637,25 @@ static bool shouldEnableLoadDeferring()
     return _private->usesDocumentViews;
 }
 
+static NSString *mailQuirksUserScriptPath()
+{
+    NSString *scriptPath = [[NSBundle bundleForClass:[WebView class]] pathForResource:@"MailQuirksUserScript" ofType:@"js"];
+    return [[NSString alloc] initWithContentsOfFile:scriptPath];
+}
+
++ (NSString *)_mailQuirksUserScript
+{
+    static NSString* mailQuirksScript = mailQuirksUserScriptPath();
+    return mailQuirksScript;
+}
+
+- (void)_injectMailQuirksScript
+{
+    core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]),
+        [WebView _mailQuirksUserScript], KURL(), 0, 0, InjectAtDocumentEnd,
+        InjectInAllFrames);
+}
+
 - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
 {
     WebCoreThreadViolationCheckRoundTwo();
@@ -754,6 +773,8 @@ static bool shouldEnableLoadDeferring()
     [self _scheduleGlibContextIterations];
 #endif
 
+    if (runningTigerMail() || runningLeopardMail())
+        [self _injectMailQuirksScript];
 }
 
 - (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list