[haiku-commits] haiku: hrev46675 - src/apps/webpositive

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 14 Jan 2014 14:30:29 +0100 (CET)

hrev46675 adds 1 changeset to branch 'master'
old head: a98f119a609d10197f348c88271b2cd32175ba7a
new head: 72921639156c94839ff23ae94477371390e58d2d
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=7292163+%5Ea98f119

----------------------------------------------------------------------------

7292163: Add a placeholder icon to the URL bar
  
  ... shown when website has no favicon.
  
  This avoids the URL moving by 16 pixels as the favicon is downloaded and
  rendered.
  
  Fixes #8888.
  
  The icon is from Zumi's BToolbar set ("insert link") with some
  tweakings. Something less colorful may be better.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46675
Commit:      72921639156c94839ff23ae94477371390e58d2d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7292163
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Tue Jan 14 13:28:25 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/8888

----------------------------------------------------------------------------

1 file changed, 41 insertions(+), 12 deletions(-)
src/apps/webpositive/URLInputGroup.cpp | 53 +++++++++++++++++++++++-------

----------------------------------------------------------------------------

diff --git a/src/apps/webpositive/URLInputGroup.cpp 
b/src/apps/webpositive/URLInputGroup.cpp
index 2e3ed14..f2e13d3 100644
--- a/src/apps/webpositive/URLInputGroup.cpp
+++ b/src/apps/webpositive/URLInputGroup.cpp
@@ -27,6 +27,7 @@
 #include "BitmapButton.h"
 #include "BrowsingHistory.h"
 #include "IconButton.h"
+#include "IconUtils.h"
 #include "TextViewCompleter.h"
 
 
@@ -474,6 +475,40 @@ const unsigned char kGoBitmapBits[] = {
 };
 
 
+const unsigned char kPlaceholderIcon[] = {
+       0x6e, 0x63, 0x69, 0x66, 0x04, 0x04, 0x00, 0x66, 0x03, 0x00, 0x3f, 0x80,
+       0x02, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x3d, 0xa6, 0x64, 0xc2, 0x19,
+       0x98, 0x00, 0x00, 0x00, 0x4d, 0xce, 0x64, 0x49, 0xac, 0xcc, 0x00, 0xab,
+       0xd5, 0xff, 0xff, 0x00, 0x6c, 0xd9, 0x02, 0x00, 0x06, 0x02, 0x00, 0x00,
+       0x00, 0x3d, 0x26, 0x64, 0xc2, 0x19, 0x98, 0x00, 0x00, 0x00, 0x4d, 0xce,
+       0x64, 0x49, 0xac, 0xcc, 0x00, 0x80, 0xff, 0x80, 0xff, 0x00, 0xb2, 0x00,
+       0x04, 0x02, 0x04, 0x34, 0x22, 0xbd, 0x9b, 0x22, 0xb8, 0x53, 0x22, 0x28,
+       0x2e, 0x28, 0xb5, 0xef, 0x28, 0xbb, 0x37, 0x34, 0x3a, 0xb8, 0x53, 0x3a,
+       0xbd, 0x9b, 0x3a, 0x40, 0x2e, 0x40, 0xbb, 0x37, 0x40, 0xb5, 0xef, 0x02,
+       0x08, 0xbe, 0xb6, 0xb4, 0xac, 0xc1, 0x46, 0xb4, 0xac, 0xbc, 0x25, 0xb4,
+       0xac, 0xb8, 0x09, 0xb7, 0x35, 0xb9, 0xcf, 0xb5, 0xa0, 0xb8, 0x05, 0xbe,
+       0xb6, 0x35, 0xc2, 0xe5, 0x35, 0xbe, 0xb6, 0x35, 0xc5, 0x68, 0xb8, 0x09,
+       0xc6, 0x36, 0xb8, 0x09, 0xc6, 0x36, 0xb9, 0xcf, 0xc7, 0xca, 0xbe, 0xb6,
+       0xc8, 0xc1, 0xbc, 0x25, 0xc8, 0xc1, 0xc1, 0xb3, 0xc8, 0xc1, 0xc6, 0x3c,
+       0xc5, 0x5b, 0xc4, 0x65, 0xc7, 0x70, 0xc6, 0x3e, 0xbe, 0xb6, 0xc2, 0x0f,
+       0xba, 0x87, 0xc2, 0x0f, 0xbe, 0xb6, 0xc2, 0x0f, 0xb8, 0x05, 0xc5, 0x64,
+       0xb7, 0x37, 0xc5, 0x64, 0xb7, 0x37, 0xc3, 0x9e, 0xb5, 0xa2, 0x02, 0x04,
+       0xb8, 0x09, 0xb7, 0x35, 0xb8, 0x05, 0xbe, 0xb6, 0xb5, 0xf8, 0xb9, 0x0c,
+       0xb4, 0xac, 0xbe, 0xb6, 0xb4, 0xac, 0xbb, 0xba, 0xb4, 0xac, 0xc1, 0xb1,
+       0xb8, 0x09, 0xc6, 0x36, 0xb5, 0xf8, 0xc4, 0x5e, 0xb9, 0xcf, 0xc7, 0xca,
+       0x35, 0xc2, 0xe5, 0x35, 0xc5, 0x68, 0x35, 0xbe, 0xb6, 0x02, 0x04, 0x4d,
+       0x51, 0xc4, 0xf2, 0xbf, 0x04, 0x53, 0x4e, 0xc8, 0xc1, 0xbe, 0x58, 0xc8,
+       0xc1, 0xc1, 0x55, 0xc8, 0xc1, 0xbb, 0x5d, 0xc5, 0x64, 0xb6, 0xd9, 0xc7,
+       0x75, 0xb8, 0xb0, 0xc3, 0x9e, 0xb5, 0x44, 0xc2, 0x0f, 0xba, 0x29, 0xc2,
+       0x0f, 0xb7, 0xa6, 0xc2, 0x0f, 0xbe, 0x58, 0x04, 0x0a, 0x00, 0x01, 0x00,
+       0x12, 0x42, 0x19, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x19,
+       0x98, 0xc6, 0x19, 0x93, 0x44, 0x19, 0xa2, 0x01, 0x17, 0x84, 0x00, 0x04,
+       0x0a, 0x01, 0x01, 0x00, 0x12, 0x42, 0x19, 0x98, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x42, 0x19, 0x98, 0xc7, 0x26, 0x5f, 0x28, 0x96, 0xf9, 0x01,
+       0x17, 0x83, 0x00, 0x04, 0x0a, 0x02, 0x01, 0x01, 0x00, 0x0a, 0x03, 0x02,
+       0x02, 0x03, 0x00
+};
+
 // #pragma mark - PageIconView
 
 
@@ -495,9 +530,6 @@ public:
 
        virtual void Draw(BRect updateRect)
        {
-               if (fIcon == NULL)
-                       return;
-
                BRect bounds(Bounds());
                BRect iconBounds(0, 0, 15, 15);
                iconBounds.OffsetTo(
@@ -511,9 +543,7 @@ public:
 
        virtual BSize MinSize()
        {
-               if (fIcon != NULL)
-                       return BSize(18, 18);
-               return BSize(0, 0);
+               return BSize(18, 18);
        }
 
        virtual BSize MaxSize()
@@ -528,15 +558,14 @@ public:
 
        void SetIcon(const BBitmap* icon)
        {
-               if (icon == NULL && fIcon == NULL)
-                       return;
-               if (!(fIcon != NULL && icon != NULL))
-                       InvalidateLayout();
                delete fIcon;
                if (icon)
                        fIcon = new BBitmap(icon);
-               else
-                       fIcon = NULL;
+               else {
+                       fIcon = new BBitmap(BRect(0, 0, 15, 15), B_RGB32);
+                       BIconUtils::GetVectorIcon(kPlaceholderIcon,
+                               sizeof(kPlaceholderIcon), fIcon);
+               }
                Invalidate();
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev46675 - src/apps/webpositive - pulkomandy