[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:37:15 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8ea28da733a4c989de601d15eaeb9b29537cf6e6
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 26 23:10:44 2004 +0000

    WebCore:
    	Added support for specifying composite operation on an
    	image element.  Attribute name is "composite", possible values
    	are:
    
    	clear,
    	copy
    	source-over
    	source-in
    	source-out
    	source-atop
    	destination-over
    	destination-in
    	destination-out
    	destination-atop
    	xor
    	darker
    	highlight
    	lighter
    
    	<img composite="source-over" src="triangle.png">
    	<img style="position:relative; left:-200px;" composite="destination-in" src="circle.png">
    
            Reviewed by Ken.
    
            * khtml/html/html_imageimpl.cpp:
            (HTMLImageElementImpl::parseHTMLAttribute):
            * khtml/html/html_imageimpl.h:
            (DOM::HTMLImageElementImpl::compositeOperator):
            * khtml/misc/htmlattrs.c:
            (findAttr):
            * khtml/misc/htmlattrs.h:
            * khtml/misc/htmlattrs.in:
            * khtml/rendering/render_image.cpp:
            (RenderImage::paint):
            * kwq/KWQPainter.h:
            * kwq/KWQPainter.mm:
            (compositeOperatorFromString):
            (QPainter::drawPixmap):
            * kwq/WebCoreImageRenderer.h:
    
    WebKit:
    	Added support for specifying composite operation on an
    	image element, i.e.:
    
    	<img composite="source-over" src="triangle.png">
    	<img style="position:relative; left:-200px;" composite="destination-in" src="circle.png">
    
    	This feature was requested by the dashboard guys.  They can use it to apply
    	transparency masks to widgies.
    
    
            Reviewed by Ken.
    
            * WebCoreSupport.subproj/WebImageRenderer.h:
            * WebCoreSupport.subproj/WebImageRenderer.m:
            (-[WebImageRenderer initWithMIMEType:]):
            (-[WebImageRenderer initWithData:MIMEType:]):
            (-[WebImageRenderer initWithContentsOfFile:]):
            (-[WebImageRenderer copyWithZone:]):
            (-[WebImageRenderer drawClippedToValidInRect:fromRect:]):
            (-[WebImageRenderer drawImageInRect:fromRect:]):
            (-[WebImageRenderer drawImageInRect:fromRect:compositeOperator:]):
    
    WebBrowser:
            Added debug menu to make browser window transparent.  Useful
            for testing widgies.
    
            * Debug/DebugUtilities.m:
            (-[DebugUtilities createDebugMenu]):
            (-[BrowserDocument toggleBackForwardEnabled:]):
            (-[BrowserDocument toggleTransparentWindow:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6491 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1971081..425a1ab 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,45 @@
+2004-04-26  Richard Williamson   <rjw at apple.com>
+
+	Added support for specifying composite operation on an
+	image element.  Attribute name is "composite", possible values
+	are:
+
+	clear,
+	copy
+	source-over
+	source-in
+	source-out
+	source-atop
+	destination-over
+	destination-in
+	destination-out
+	destination-atop
+	xor
+	darker
+	highlight
+	lighter
+
+	<img composite="source-over" src="triangle.png">
+	<img style="position:relative; left:-200px;" composite="destination-in" src="circle.png">
+
+        Reviewed by Ken.
+
+        * khtml/html/html_imageimpl.cpp:
+        (HTMLImageElementImpl::parseHTMLAttribute):
+        * khtml/html/html_imageimpl.h:
+        (DOM::HTMLImageElementImpl::compositeOperator):
+        * khtml/misc/htmlattrs.c:
+        (findAttr):
+        * khtml/misc/htmlattrs.h:
+        * khtml/misc/htmlattrs.in:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::paint):
+        * kwq/KWQPainter.h:
+        * kwq/KWQPainter.mm:
+        (compositeOperatorFromString):
+        (QPainter::drawPixmap):
+        * kwq/WebCoreImageRenderer.h:
+
 2004-04-26  Darin Adler  <darin at apple.com>
 
         - fixed <rdar://problem/3634145>: "REGRESSION: nil-deref in QTextCodec::toUnicode every time loading page at wiki.wordpress.org"
diff --git a/WebCore/khtml/html/html_imageimpl.cpp b/WebCore/khtml/html/html_imageimpl.cpp
index aff53ee..0ed24c9 100644
--- a/WebCore/khtml/html/html_imageimpl.cpp
+++ b/WebCore/khtml/html/html_imageimpl.cpp
@@ -178,6 +178,14 @@ void HTMLImageElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
 	    }
 	    oldIdAttr = newIdAttr;
 	}
+#if APPLE_CHANGES
+    case ATTR_COMPOSITE:
+        {
+	    _compositeOperator = attr->value().string();
+            if (m_render)
+                m_render->updateFromElement();
+        }
+#endif
 	// fall through
     default:
         HTMLElementImpl::parseHTMLAttribute(attr);
diff --git a/WebCore/khtml/html/html_imageimpl.h b/WebCore/khtml/html/html_imageimpl.h
index 69c0b5e..dd297a5 100644
--- a/WebCore/khtml/html/html_imageimpl.h
+++ b/WebCore/khtml/html/html_imageimpl.h
@@ -61,12 +61,19 @@ public:
     DOMString imageMap() const { return usemap; }
     
     virtual bool isURLAttribute(AttributeImpl *attr) const;
+
+#if APPLE_CHANGES
+    QString compositeOperator() const { return _compositeOperator; }
+#endif
     
 protected:
     DOMString usemap;
     bool ismap;
     QString oldIdAttr;
     QString oldNameAttr;
+#if APPLE_CHANGES
+    QString _compositeOperator;
+#endif
 };
 
 
diff --git a/WebCore/khtml/misc/htmlattrs.c b/WebCore/khtml/misc/htmlattrs.c
index 3612641..0f21fe5 100644
--- a/WebCore/khtml/misc/htmlattrs.c
+++ b/WebCore/khtml/misc/htmlattrs.c
@@ -97,7 +97,7 @@ findAttr (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 166,
+      TOTAL_KEYWORDS = 167,
       MIN_WORD_LENGTH = 2,
       MAX_WORD_LENGTH = 15,
       MIN_HASH_VALUE = 4,
@@ -184,6 +184,7 @@ findAttr (register const char *str, register unsigned int len)
       {"compact", ATTR_COMPACT},
       {"direction", ATTR_DIRECTION},
       {"noshade", ATTR_NOSHADE},
+      {"composite", ATTR_COMPOSITE},
       {"defer", ATTR_DEFER},
       {"onblur", ATTR_ONBLUR},
       {"charset", ATTR_CHARSET},
@@ -285,8 +286,8 @@ findAttr (register const char *str, register unsigned int len)
         -1,    7,   -1,   -1,   -1,   -1,   -1,    8,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,    9,
         10,   11,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1, -247,   -1,   14,   15,   -1,   16,   17,
-      -154,   -2,   -1,   18,   19,   -1,   -1,   -1,
+        -1, -248,   -1,   14,   15,   -1,   16,   17,
+      -155,   -2,   -1,   18,   19,   -1,   -1,   -1,
         20,   -1,   -1,   -1,   -1,   21,   22,   23,
         -1,   24,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   25,   -1,   -1,   -1,   26,   27,   28,
@@ -302,61 +303,61 @@ findAttr (register const char *str, register unsigned int len)
         62,   -1,   63,   64,   65,   -1,   66,   67,
         68,   -1,   69,   70,   71,   72,   -1,   -1,
         73,   74,   75,   -1,   76,   -1,   -1,   77,
-        -1,   -1,   78,   79,   80,   81,   -1,   -1,
-        -1,   82,   -1,   -1,   -1,   -1,   83,   -1,
-        84,   85,   -1,   -1,   -1,   86,   -1,   -1,
-        87,   -1,   -1,   -1,   -1,   88,   89,   -1,
-        -1,   -1,   -1,   90,   -1,   -1,   -1,   91,
-        92,   -1,   93,   -1,   -1,   -1,   -1,   -1,
-        94,   -1,   -1,   -1,   -1,   95,   -1,   96,
-        97,   -1,   98,   99,   -1,   -1,  100,   -1,
-        -1,  101,   -1,  102,   -1,  103,  104,  105,
-        -1,  106,  107,  108,   -1,   -1,   -1,  109,
-        -1,  110,   -1,  111,  112,   -1,   -1,   -1,
+        -1,   78,   79,   80,   81,   82,   -1,   -1,
+        -1,   83,   -1,   -1,   -1,   -1,   84,   -1,
+        85,   86,   -1,   -1,   -1,   87,   -1,   -1,
+        88,   -1,   -1,   -1,   -1,   89,   90,   -1,
+        -1,   -1,   -1,   91,   -1,   -1,   -1,   92,
+        93,   -1,   94,   -1,   -1,   -1,   -1,   -1,
+        95,   -1,   -1,   -1,   -1,   96,   -1,   97,
+        98,   -1,   99,  100,   -1,   -1,  101,   -1,
+        -1,  102,   -1,  103,   -1,  104,  105,  106,
+        -1,  107,  108,  109,   -1,   -1,   -1,  110,
+        -1,  111,   -1,  112,  113,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       113,   -1,  114,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  115,  116,  117,  118,   -1,
-       119,   -1,   -1,   -1,   -1,   -1,  120,   -1,
-       121,   -1,   -1,   -1,   -1,  122,   -1,   -1,
-       123,   -1,   -1,  124,   -1,   -1,  125,   -1,
-        -1,   -1,   -1,   -1,   -1,  126,   -1,  127,
-        -1,   -1,  128,   -1,  129,  130,  131,   -1,
-        -1,  132,  133,  134,   -1,  135,  136,   -1,
-        -1,   -1,   -1,  137,   -1,   -1,   -1,   -1,
-       138,   -1,  139,  140,   -1,   -1,  141,   -1,
-        -1,   -1,   -1,   -1,   -1,  142,   -1,   -1,
-        -1,   -1,  143,  144,   -1,   -1,   -1,   -1,
-        -1,   -1,  145,   -1,  146,  147,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  148,   -1,
-       149,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,  150,   -1,  151,   -1,   -1,   -1,
+       114,   -1,  115,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,  116,  117,  118,  119,   -1,
+       120,   -1,   -1,   -1,   -1,   -1,  121,   -1,
+       122,   -1,   -1,   -1,   -1,  123,   -1,   -1,
+       124,   -1,   -1,  125,   -1,   -1,  126,   -1,
+        -1,   -1,   -1,   -1,   -1,  127,   -1,  128,
+        -1,   -1,  129,   -1,  130,  131,  132,   -1,
+        -1,  133,  134,  135,   -1,  136,  137,   -1,
+        -1,   -1,   -1,  138,   -1,   -1,   -1,   -1,
+       139,   -1,  140,  141,   -1,   -1,  142,   -1,
+        -1,   -1,   -1,   -1,   -1,  143,   -1,   -1,
+        -1,   -1,  144,  145,   -1,   -1,   -1,   -1,
+        -1,   -1,  146,   -1,  147,  148,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,  149,   -1,
+       150,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,  151,   -1,  152,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       152,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       153,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,  153,   -1,   -1,   -1,   -1,   -1,
-        -1,  154,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,  154,   -1,   -1,   -1,   -1,   -1,
         -1,  155,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,  156,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       156,   -1,   -1,  157,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  158,   -1,
+       157,   -1,   -1,  158,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,  159,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       159,   -1,   -1,   -1,   -1,  160,   -1,   -1,
+       160,   -1,   -1,   -1,   -1,  161,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,  161,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,  162,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  162,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,  163,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       163,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,  164,
+       164,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,  165,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
@@ -364,7 +365,7 @@ findAttr (register const char *str, register unsigned int len)
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,  165
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,  166
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -441,6 +442,7 @@ static const char * const attrList[] = {
     "COLS",
     "COLSPAN",
     "COMPACT",
+    "COMPOSITE",
     "CONTENT",
     "CONTENTEDITABLE",
     "COORDS",
diff --git a/WebCore/khtml/misc/htmlattrs.h b/WebCore/khtml/misc/htmlattrs.h
index 63df6a5..4097f0a 100644
--- a/WebCore/khtml/misc/htmlattrs.h
+++ b/WebCore/khtml/misc/htmlattrs.h
@@ -44,136 +44,137 @@ htmlattrs.in by makeattrs, do not edit */
 #define ATTR_COLS 35
 #define ATTR_COLSPAN 36
 #define ATTR_COMPACT 37
-#define ATTR_CONTENT 38
-#define ATTR_CONTENTEDITABLE 39
-#define ATTR_COORDS 40
-#define ATTR_DATA 41
-#define ATTR_DATETIME 42
-#define ATTR_DECLARE 43
-#define ATTR_DEFER 44
-#define ATTR_DIR 45
-#define ATTR_DIRECTION 46
-#define ATTR_DISABLED 47
-#define ATTR_ENCTYPE 48
-#define ATTR_FACE 49
-#define ATTR_FOR 50
-#define ATTR_FRAME 51
-#define ATTR_FRAMEBORDER 52
-#define ATTR_HEADERS 53
-#define ATTR_HEIGHT 54
-#define ATTR_HIDDEN 55
-#define ATTR_HREF 56
-#define ATTR_HREFLANG 57
-#define ATTR_HSPACE 58
-#define ATTR_HTML 59
-#define ATTR_HTTP_EQUIV 60
-#define ATTR_ID 61
-#define ATTR_INCREMENTAL 62
-#define ATTR_ISMAP 63
-#define ATTR_KEYTYPE 64
-#define ATTR_LABEL 65
-#define ATTR_LANG 66
-#define ATTR_LANGUAGE 67
-#define ATTR_LEFT 68
-#define ATTR_LEFTMARGIN 69
-#define ATTR_LINK 70
-#define ATTR_LONGDESC 71
-#define ATTR_LOOP 72
-#define ATTR_MARGINHEIGHT 73
-#define ATTR_MARGINWIDTH 74
-#define ATTR_MAX 75
-#define ATTR_MAXLENGTH 76
-#define ATTR_MAYSCRIPT 77
-#define ATTR_MEDIA 78
-#define ATTR_METHOD 79
-#define ATTR_MIN 80
-#define ATTR_MULTIPLE 81
-#define ATTR_NAME 82
-#define ATTR_NOHREF 83
-#define ATTR_NORESIZE 84
-#define ATTR_NOSAVE 85
-#define ATTR_NOSHADE 86
-#define ATTR_NOWRAP 87
-#define ATTR_OBJECT 88
-#define ATTR_ONABORT 89
-#define ATTR_ONBLUR 90
-#define ATTR_ONCHANGE 91
-#define ATTR_ONCLICK 92
-#define ATTR_ONCONTEXTMENU 93
-#define ATTR_ONDBLCLICK 94
-#define ATTR_ONERROR 95
-#define ATTR_ONFOCUS 96
-#define ATTR_ONINPUT 97
-#define ATTR_ONKEYDOWN 98
-#define ATTR_ONKEYPRESS 99
-#define ATTR_ONKEYUP 100
-#define ATTR_ONLOAD 101
-#define ATTR_ONMOUSEDOWN 102
-#define ATTR_ONMOUSEMOVE 103
-#define ATTR_ONMOUSEOUT 104
-#define ATTR_ONMOUSEOVER 105
-#define ATTR_ONMOUSEUP 106
-#define ATTR_ONRESET 107
-#define ATTR_ONRESIZE 108
-#define ATTR_ONSCROLL 109
-#define ATTR_ONSEARCH 110
-#define ATTR_ONSELECT 111
-#define ATTR_ONSUBMIT 112
-#define ATTR_ONUNLOAD 113
-#define ATTR_OVERSRC 114
-#define ATTR_PAGEX 115
-#define ATTR_PAGEY 116
-#define ATTR_PLACEHOLDER 117
-#define ATTR_PLAIN 118
-#define ATTR_PLUGINPAGE 119
-#define ATTR_PLUGINSPAGE 120
-#define ATTR_PLUGINURL 121
-#define ATTR_PRECISION 122
-#define ATTR_PROFILE 123
-#define ATTR_PROMPT 124
-#define ATTR_READONLY 125
-#define ATTR_REL 126
-#define ATTR_RESULTS 127
-#define ATTR_REV 128
-#define ATTR_ROWS 129
-#define ATTR_ROWSPAN 130
-#define ATTR_RULES 131
-#define ATTR_SCHEME 132
-#define ATTR_SCOPE 133
-#define ATTR_SCROLLAMOUNT 134
-#define ATTR_SCROLLDELAY 135
-#define ATTR_SCROLLING 136
-#define ATTR_SELECTED 137
-#define ATTR_SHAPE 138
-#define ATTR_SIZE 139
-#define ATTR_SPAN 140
-#define ATTR_SRC 141
-#define ATTR_STANDBY 142
-#define ATTR_START 143
-#define ATTR_STYLE 144
-#define ATTR_SUMMARY 145
-#define ATTR_TABINDEX 146
-#define ATTR_TABLEBORDER 147
-#define ATTR_TARGET 148
-#define ATTR_TEXT 149
-#define ATTR_TITLE 150
-#define ATTR_TOP 151
-#define ATTR_TOPMARGIN 152
-#define ATTR_TRUESPEED 153
-#define ATTR_TYPE 154
-#define ATTR_UNKNOWN 155
-#define ATTR_USEMAP 156
-#define ATTR_VALIGN 157
-#define ATTR_VALUE 158
-#define ATTR_VALUETYPE 159
-#define ATTR_VERSION 160
-#define ATTR_VISIBILITY 161
-#define ATTR_VLINK 162
-#define ATTR_VSPACE 163
-#define ATTR_WIDTH 164
-#define ATTR_WRAP 165
-#define ATTR_Z_INDEX 166
-#define ATTR_LAST_ATTR 166
+#define ATTR_COMPOSITE 38
+#define ATTR_CONTENT 39
+#define ATTR_CONTENTEDITABLE 40
+#define ATTR_COORDS 41
+#define ATTR_DATA 42
+#define ATTR_DATETIME 43
+#define ATTR_DECLARE 44
+#define ATTR_DEFER 45
+#define ATTR_DIR 46
+#define ATTR_DIRECTION 47
+#define ATTR_DISABLED 48
+#define ATTR_ENCTYPE 49
+#define ATTR_FACE 50
+#define ATTR_FOR 51
+#define ATTR_FRAME 52
+#define ATTR_FRAMEBORDER 53
+#define ATTR_HEADERS 54
+#define ATTR_HEIGHT 55
+#define ATTR_HIDDEN 56
+#define ATTR_HREF 57
+#define ATTR_HREFLANG 58
+#define ATTR_HSPACE 59
+#define ATTR_HTML 60
+#define ATTR_HTTP_EQUIV 61
+#define ATTR_ID 62
+#define ATTR_INCREMENTAL 63
+#define ATTR_ISMAP 64
+#define ATTR_KEYTYPE 65
+#define ATTR_LABEL 66
+#define ATTR_LANG 67
+#define ATTR_LANGUAGE 68
+#define ATTR_LEFT 69
+#define ATTR_LEFTMARGIN 70
+#define ATTR_LINK 71
+#define ATTR_LONGDESC 72
+#define ATTR_LOOP 73
+#define ATTR_MARGINHEIGHT 74
+#define ATTR_MARGINWIDTH 75
+#define ATTR_MAX 76
+#define ATTR_MAXLENGTH 77
+#define ATTR_MAYSCRIPT 78
+#define ATTR_MEDIA 79
+#define ATTR_METHOD 80
+#define ATTR_MIN 81
+#define ATTR_MULTIPLE 82
+#define ATTR_NAME 83
+#define ATTR_NOHREF 84
+#define ATTR_NORESIZE 85
+#define ATTR_NOSAVE 86
+#define ATTR_NOSHADE 87
+#define ATTR_NOWRAP 88
+#define ATTR_OBJECT 89
+#define ATTR_ONABORT 90
+#define ATTR_ONBLUR 91
+#define ATTR_ONCHANGE 92
+#define ATTR_ONCLICK 93
+#define ATTR_ONCONTEXTMENU 94
+#define ATTR_ONDBLCLICK 95
+#define ATTR_ONERROR 96
+#define ATTR_ONFOCUS 97
+#define ATTR_ONINPUT 98
+#define ATTR_ONKEYDOWN 99
+#define ATTR_ONKEYPRESS 100
+#define ATTR_ONKEYUP 101
+#define ATTR_ONLOAD 102
+#define ATTR_ONMOUSEDOWN 103
+#define ATTR_ONMOUSEMOVE 104
+#define ATTR_ONMOUSEOUT 105
+#define ATTR_ONMOUSEOVER 106
+#define ATTR_ONMOUSEUP 107
+#define ATTR_ONRESET 108
+#define ATTR_ONRESIZE 109
+#define ATTR_ONSCROLL 110
+#define ATTR_ONSEARCH 111
+#define ATTR_ONSELECT 112
+#define ATTR_ONSUBMIT 113
+#define ATTR_ONUNLOAD 114
+#define ATTR_OVERSRC 115
+#define ATTR_PAGEX 116
+#define ATTR_PAGEY 117
+#define ATTR_PLACEHOLDER 118
+#define ATTR_PLAIN 119
+#define ATTR_PLUGINPAGE 120
+#define ATTR_PLUGINSPAGE 121
+#define ATTR_PLUGINURL 122
+#define ATTR_PRECISION 123
+#define ATTR_PROFILE 124
+#define ATTR_PROMPT 125
+#define ATTR_READONLY 126
+#define ATTR_REL 127
+#define ATTR_RESULTS 128
+#define ATTR_REV 129
+#define ATTR_ROWS 130
+#define ATTR_ROWSPAN 131
+#define ATTR_RULES 132
+#define ATTR_SCHEME 133
+#define ATTR_SCOPE 134
+#define ATTR_SCROLLAMOUNT 135
+#define ATTR_SCROLLDELAY 136
+#define ATTR_SCROLLING 137
+#define ATTR_SELECTED 138
+#define ATTR_SHAPE 139
+#define ATTR_SIZE 140
+#define ATTR_SPAN 141
+#define ATTR_SRC 142
+#define ATTR_STANDBY 143
+#define ATTR_START 144
+#define ATTR_STYLE 145
+#define ATTR_SUMMARY 146
+#define ATTR_TABINDEX 147
+#define ATTR_TABLEBORDER 148
+#define ATTR_TARGET 149
+#define ATTR_TEXT 150
+#define ATTR_TITLE 151
+#define ATTR_TOP 152
+#define ATTR_TOPMARGIN 153
+#define ATTR_TRUESPEED 154
+#define ATTR_TYPE 155
+#define ATTR_UNKNOWN 156
+#define ATTR_USEMAP 157
+#define ATTR_VALIGN 158
+#define ATTR_VALUE 159
+#define ATTR_VALUETYPE 160
+#define ATTR_VERSION 161
+#define ATTR_VISIBILITY 162
+#define ATTR_VLINK 163
+#define ATTR_VSPACE 164
+#define ATTR_WIDTH 165
+#define ATTR_WRAP 166
+#define ATTR_Z_INDEX 167
+#define ATTR_LAST_ATTR 167
 DOM::DOMString getAttrName(unsigned short id);
 
 #endif
diff --git a/WebCore/khtml/misc/htmlattrs.in b/WebCore/khtml/misc/htmlattrs.in
index cbac734..1330291 100644
--- a/WebCore/khtml/misc/htmlattrs.in
+++ b/WebCore/khtml/misc/htmlattrs.in
@@ -35,6 +35,7 @@ color
 cols
 colspan
 compact
+composite
 content
 contenteditable
 coords
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 1e81784..bea2ae5 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -396,7 +396,13 @@ void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
 
 
 //             p->drawPixmap( offs.x(), y, pix, rect.x(), rect.y(), rect.width(), rect.height() );
-             p->drawPixmap(offs, pix, rect);
+             HTMLImageElementImpl* i = element()->id() == ID_IMG ? static_cast<HTMLImageElementImpl*>(element()) : 0;
+             if (i && !i->compositeOperator().isNull()){
+                p->drawPixmap (offs, pix, rect, i->compositeOperator());
+             }
+             else {
+                 p->drawPixmap(offs, pix, rect);
+             }
 #if APPLE_CHANGES
              if (drawSelectionTint) {
                  p->fillRect(offs.x() + rect.x(), offs.y() + rect.y(), rect.width(), rect.height(), QBrush(selectionTintColor(p)));
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 8febdae..1e6a213 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -84,8 +84,9 @@ public:
 
     void drawPixmap(const QPoint &, const QPixmap &);
     void drawPixmap(const QPoint &, const QPixmap &, const QRect &);
+    void drawPixmap(const QPoint &, const QPixmap &, const QRect &, const QString &);
     void drawPixmap( int x, int y, const QPixmap &,
-			    int sx=0, int sy=0, int sw=-1, int sh=-1 );
+			    int sx=0, int sy=0, int sw=-1, int sh=-1, int compositeOperator=-1);
     void drawTiledPixmap(int, int, int, int, const QPixmap &, int sx=0, int sy=0);
 
     void addClip(const QRect &);
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 66bf68d..1912926 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -437,8 +437,50 @@ void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix, const QRect &r)
     drawPixmap(p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height());
 }
 
+struct CompositeOperator
+{
+    const char *name;
+    NSCompositingOperation value;
+};
+
+#define NUM_COMPOSITE_OPERATORS 14
+struct CompositeOperator compositeOperators[NUM_COMPOSITE_OPERATORS] = {
+    { "clear", NSCompositeClear },
+    { "copy", NSCompositeCopy },
+    { "source-over", NSCompositeSourceOver },
+    { "source-in", NSCompositeSourceIn },
+    { "source-out", NSCompositeSourceOut },
+    { "source-atop", NSCompositeSourceAtop },
+    { "destination-over", NSCompositeDestinationOver },
+    { "destination-in", NSCompositeDestinationIn },
+    { "destination-out", NSCompositeDestinationOut },
+    { "destination-atop", NSCompositeDestinationAtop },
+    { "xor", NSCompositeXOR },
+    { "darker", NSCompositePlusDarker },
+    { "highlight", NSCompositeHighlight },
+    { "lighter", NSCompositePlusLighter }
+};
+
+static NSCompositingOperation compositeOperatorFromString (QString aString)
+{
+    const char *operatorString = aString.ascii();
+    int i;
+    
+    for (i = 0; i < NUM_COMPOSITE_OPERATORS; i++) {
+        if (strcasecmp (operatorString, compositeOperators[i].name) == 0) {
+            return compositeOperators[i].value;
+        }
+    }
+    return NSCompositeSourceOver;
+}
+
+void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix, const QRect &r, const QString &compositeOperator)
+{
+    drawPixmap(p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height(), (int)compositeOperatorFromString(compositeOperator));
+}
+
 void QPainter::drawPixmap( int x, int y, const QPixmap &pixmap,
-                           int sx, int sy, int sw, int sh )
+                           int sx, int sy, int sw, int sh, int compositeOperator )
 {
     if (data->state.paintingDisabled)
         return;
@@ -453,7 +495,7 @@ void QPainter::drawPixmap( int x, int y, const QPixmap &pixmap,
     
     KWQ_BLOCK_EXCEPTIONS;
     [pixmap.imageRenderer drawImageInRect:inRect
-                                      fromRect:fromRect];
+                                      fromRect:fromRect compositeOperator:(NSCompositingOperation)compositeOperator];
     KWQ_UNBLOCK_EXCEPTIONS;
 }
 
diff --git a/WebCore/kwq/WebCoreImageRenderer.h b/WebCore/kwq/WebCoreImageRenderer.h
index 60328f7..2214027 100644
--- a/WebCore/kwq/WebCoreImageRenderer.h
+++ b/WebCore/kwq/WebCoreImageRenderer.h
@@ -32,6 +32,7 @@
 - (NSSize)size;
 - (void)resize:(NSSize)s;
 - (void)drawImageInRect:(NSRect)ir fromRect:(NSRect)fr;
+- (void)drawImageInRect:(NSRect)ir fromRect:(NSRect)fr compositeOperator:(NSCompositingOperation)compsiteOperator;
 - (void)stopAnimation;
 - (void)tileInRect:(NSRect)r fromPoint:(NSPoint)p;
 - (BOOL)isNull;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c391ccc..ad1c202 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,26 @@
+2004-04-26  Richard Williamson   <rjw at apple.com>
+
+	Added support for specifying composite operation on an
+	image element, i.e.:
+
+	<img composite="source-over" src="triangle.png">
+	<img style="position:relative; left:-200px;" composite="destination-in" src="circle.png">
+
+	This feature was requested by the dashboard guys.  They can use it to apply
+	transparency masks to widgies.
+
+        Reviewed by Ken.
+
+        * WebCoreSupport.subproj/WebImageRenderer.h:
+        * WebCoreSupport.subproj/WebImageRenderer.m:
+        (-[WebImageRenderer initWithMIMEType:]):
+        (-[WebImageRenderer initWithData:MIMEType:]):
+        (-[WebImageRenderer initWithContentsOfFile:]):
+        (-[WebImageRenderer copyWithZone:]):
+        (-[WebImageRenderer drawClippedToValidInRect:fromRect:]):
+        (-[WebImageRenderer drawImageInRect:fromRect:]):
+        (-[WebImageRenderer drawImageInRect:fromRect:compositeOperator:]):
+
 2004-04-26  Chris Blumenberg  <cblu at apple.com>
 
 	More header doc changes after John's review.
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
index a7b65f3..da57d3c 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
@@ -24,6 +24,8 @@
     NSPoint tilePoint;
     BOOL animatedTile;
 
+    int compositeOperator;
+    
     NSString *MIMEType;
     BOOL isNull;
 @public    
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index 4e3d87e..34fab80 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -55,7 +55,9 @@ static NSMutableSet *activeImageRenderers;
         loadStatus = NSImageRepLoadStatusUnknownType;
         MIMEType = [MIME copy];
         isNull = YES;
+        compositeOperator = (int)NSCompositeSourceOver;
     }
+    
     return self;
 }
 
@@ -74,6 +76,7 @@ static NSMutableSet *activeImageRenderers;
             result->loadStatus = NSImageRepLoadStatusUnknownType;
             result->MIMEType = [MIME copy];
             result->isNull = [data length] == 0;
+            result->compositeOperator = (int)NSCompositeSourceOver;
         }
 
     NS_HANDLER
@@ -100,6 +103,7 @@ static NSMutableSet *activeImageRenderers;
             [result setCacheMode:NSImageCacheNever];
     
             result->loadStatus = NSImageRepLoadStatusUnknownType;
+            result->compositeOperator = (int)NSCompositeSourceOver;
         }
         
     NS_HANDLER
@@ -136,6 +140,7 @@ static NSMutableSet *activeImageRenderers;
     copy->frameTimer = nil;
     copy->frameView = nil;
     copy->patternColor = nil;
+    copy->compositeOperator = compositeOperator;
         
     return copy;
 }
@@ -320,7 +325,7 @@ static NSMutableSet *activeImageRenderers;
     }
     
     // This is the operation that handles transparent portions of the source image correctly.
-    [self drawInRect:ir fromRect:fr operation:NSCompositeSourceOver fraction: 1.0];
+    [self drawInRect:ir fromRect:fr operation:compositeOperator fraction: 1.0];
 }
 
 - (void)nextFrame:(id)context
@@ -367,6 +372,12 @@ static NSMutableSet *activeImageRenderers;
     }
 }
 
+- (void)drawImageInRect:(NSRect)ir fromRect:(NSRect)fr compositeOperator:(NSCompositingOperation)operator
+{
+    compositeOperator = operator;
+    [self drawImageInRect:ir fromRect:fr];
+}
+
 - (void)startAnimationIfNecessary
 {
     if ([self frameCount] > 1 && !animationFinished) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list