[haiku-webkit-commits] r445 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Tue, 20 Apr 2010 22:52:42 +0000

Author: stippi
Date: Tue Apr 20 22:52:41 2010
New Revision: 445
URL: http://mmlr.dyndns.org/changeset/445

Log:
Make the base URL show in bold font in the URL input field, and the rest of the
text in dark gray.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp

Modified: webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp     Tue Apr 20 
16:26:32 2010        (r444)
+++ webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp     Tue Apr 20 
22:52:41 2010        (r445)
@@ -171,6 +171,7 @@
        fPreviousText("")
 {
        MakeResizable(true);
+       SetStylable(true);
 }
 
 
@@ -334,6 +335,31 @@
                BTextView::InsertText(filteredText.String(), inLength, inOffset,
                        inRuns);
        }
+
+       // Make the base URL part bold.
+       BString text(Text(), TextLength());
+       int32 baseUrlStart = text.FindFirst("://");
+       if (baseUrlStart >= 0)
+               baseUrlStart += 3;
+       else
+               baseUrlStart = 0;
+       int32 baseUrlEnd = text.FindFirst("/", baseUrlStart);
+       if (baseUrlEnd < 0)
+               baseUrlEnd = TextLength();
+       BFont font;
+       GetFont(&font);
+       const rgb_color black = (rgb_color){ 0, 0, 0, 255 };
+       const rgb_color gray = (rgb_color){ 60, 60, 60, 255 };
+       if (baseUrlStart > 0)
+               SetFontAndColor(0, baseUrlStart - 1, &font, B_FONT_ALL, &gray);
+       if (baseUrlEnd > baseUrlStart) {
+               font.SetFace(B_BOLD_FACE);
+               SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, 
&black);
+       }
+       if (baseUrlEnd < TextLength()) {
+               font.SetFace(B_REGULAR_FACE);
+               SetFontAndColor(baseUrlEnd, TextLength(), &font, B_FONT_ALL, 
&gray);
+       }
 }
 
 

Other related posts:

  • » [haiku-webkit-commits] r445 - webkit/trunk/WebKit/haiku/WebPositive - webkit