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

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:10:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 48ae932e644c88005e5d180ce77ca74ff816c8f3
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 10 23:21:54 2003 +0000

    	Fixed:
    	<rdar://problem/3478883>: REGRESSION (113-114u): drag image for selected text includes unselected images
    	<rdar://problem/3479204>: selected images don't look selected
    
            Reviewed by dave.
    
            * khtml/rendering/render_image.cpp:
            (RenderImage::RenderImage): init m_selectionState
            (RenderImage::paintObject): draw a tint over the image if selected, don't draw anything if not selected and the action is PaintActionSelection
            * khtml/rendering/render_image.h:
            (khtml::RenderImage::selectionState): new
            (khtml::RenderImage::setSelectionState): new
            * kwq/KWQPainter.h:
            * kwq/KWQPainter.mm:
            (QPainter::selectedImageTintColor): new
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5446 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0787ad8..fdf5df8 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2003-11-10  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed:
+	<rdar://problem/3478883>: REGRESSION (113-114u): drag image for selected text includes unselected images
+	<rdar://problem/3479204>: selected images don't look selected
+
+        Reviewed by dave.
+
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::RenderImage): init m_selectionState
+        (RenderImage::paintObject): draw a tint over the image if selected, don't draw anything if not selected and the action is PaintActionSelection
+        * khtml/rendering/render_image.h:
+        (khtml::RenderImage::selectionState): new
+        (khtml::RenderImage::setSelectionState): new
+        * kwq/KWQPainter.h:
+        * kwq/KWQPainter.mm:
+        (QPainter::selectedImageTintColor): new
+
 2003-11-10  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Hyatt
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 2a3705d..ed7bdb9 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -55,6 +55,7 @@ RenderImage::RenderImage(NodeImpl *_node)
     image = 0;
     berrorPic = false;
     loadEventSent = false;
+    m_selectionState = SelectionNone;
 
     setIntrinsicWidth( 0 );
     setIntrinsicHeight( 0 );
@@ -199,6 +200,16 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
     
     if (paintAction != PaintActionForeground && paintAction != PaintActionSelection)
         return;
+
+#if APPLE_CHANGES
+    bool drawSelectionTint = selectionState() != SelectionNone;
+    if (paintAction == PaintActionSelection) {
+        if (selectionState() == SelectionNone) {
+            return;
+        }
+        drawSelectionTint = false;
+    }
+#endif
         
     int cWidth = contentWidth();
     int cHeight = contentHeight();
@@ -221,7 +232,7 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
                 p->setBrush (Qt::NoBrush);
                 p->drawRect (_tx + leftBorder + leftPad, _ty + topBorder + topPad, cWidth, cHeight);
 	    }
-
+            
             bool errorPictureDrawn = false;
             int imageX = 0, imageY = 0;
             int usableWidth = cWidth - leftBorder - borderRight() - leftPad - paddingRight();
@@ -293,6 +304,9 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
         if ( (cWidth != intrinsicWidth() ||  cHeight != intrinsicHeight()) &&
              pix.width() > 0 && pix.height() > 0 && image->valid_rect().isValid())
         {
+#if APPLE_CHANGES
+            QSize tintSize;
+#endif
             if (resizeCache.isNull() && cWidth && cHeight)
             {
                 QRect scaledrect(image->valid_rect());
@@ -324,9 +338,20 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
 
                 p->drawPixmap( QPoint( _tx + leftBorder + leftPad, _ty + topBorder + topPad),
                                resizeCache, scaledrect );
-            }
-            else
+#if APPLE_CHANGES
+                tintSize = s;
+#endif
+            } else {
                 p->drawPixmap( QPoint( _tx + leftBorder + leftPad, _ty + topBorder + topPad), resizeCache );
+#if APPLE_CHANGES
+                tintSize = resizeCache.rect().size();
+#endif
+            }
+#if APPLE_CHANGES
+            if (drawSelectionTint) {
+                p->fillRect(_tx + leftBorder + leftPad, _ty + topBorder + topPad, tintSize.width(), tintSize.height(), QBrush(p->selectedImageTintColor()));
+            }
+#endif
         }
         else
         {
@@ -350,7 +375,11 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
 
 //             p->drawPixmap( offs.x(), y, pix, rect.x(), rect.y(), rect.width(), rect.height() );
              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(p->selectedImageTintColor()));
+             }
+#endif
         }
     }
 }
diff --git a/WebCore/khtml/rendering/render_image.h b/WebCore/khtml/rendering/render_image.h
index 954d51d..bf7754f 100644
--- a/WebCore/khtml/rendering/render_image.h
+++ b/WebCore/khtml/rendering/render_image.h
@@ -42,6 +42,9 @@ public:
     virtual ~RenderImage();
 
     virtual const char *renderName() const { return "RenderImage"; }
+    
+    virtual SelectionState selectionState() const {return m_selectionState;}
+    virtual void setSelectionState(SelectionState s) {m_selectionState = s;}
 
     virtual bool isImage() const { return true; }
     
@@ -101,6 +104,7 @@ private:
     CachedImage *image;
     bool berrorPic : 1;
     bool loadEventSent : 1;
+    SelectionState m_selectionState : 3;
 };
 
 
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index dee3093..595f299 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -104,6 +104,8 @@ public:
 
     QColor selectedTextBackgroundColor() const;
     void setUsesInactiveTextBackgroundColor(bool u) { _usesInactiveTextBackgroundColor = u; }
+    
+    QColor selectedImageTintColor() const;
 
     bool paintingDisabled() const;
     void setPaintingDisabled(bool);
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index c711e9d..e36514c 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -592,6 +592,12 @@ QColor QPainter::selectedTextBackgroundColor() const
     return QColor((int)(255 * [color redComponent]), (int)(255 * [color greenComponent]), (int)(255 * [color blueComponent]));
 }
 
+QColor QPainter::selectedImageTintColor() const
+{
+    QColor color = selectedTextBackgroundColor();
+    return QColor(qRgba(color.red(), color.green(), color.blue(), 160));
+}
+
 void QPainter::_fillRect(float x, float y, float w, float h, const QColor& col)
 {
     [col.getNSColor() set];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list