Add support for custom highlighting. This is all ifdefed to be Mac-only.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jun 2006 01:41:55 +0000 (01:41 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jun 2006 01:41:55 +0000 (01:41 +0000)
        Reviewed by justin

        * WebCore.xcodeproj/project.pbxproj:
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::paintCustomHighlight):
        * bridge/mac/WebCoreFrameBridge.h:
        * platform/mac/ClipboardMac.h:
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paint):
        (WebCore::InlineTextBox::paintCustomHighlight):
        * rendering/InlineTextBox.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14766 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/platform/mac/ClipboardMac.h
WebCore/rendering/InlineTextBox.cpp
WebCore/rendering/InlineTextBox.h

index 762da8baed6257798df9886d2ba8695efcbc3375..698c3c4d08ab003f5960a2655d3c6d6a721c1844 100644 (file)
@@ -1,3 +1,20 @@
+2006-06-07  David Hyatt  <hyatt@apple.com>
+
+        Add support for custom highlighting.  This is all ifdefed to be Mac-only.
+
+        Reviewed by justin
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::paintCustomHighlight):
+        * bridge/mac/WebCoreFrameBridge.h:
+        * platform/mac/ClipboardMac.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        (WebCore::InlineTextBox::paintCustomHighlight):
+        * rendering/InlineTextBox.h:
+
 2006-06-07  Adele Peterson  <adele@apple.com>
 
         Reviewed by Hyatt 
index 584e9a3e58ff0dc1f7ea232f4757419d7a63add6..e470c6b6db4b23e75a8156913c7727586c5e95e7 100644 (file)
                FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
 /* End PBXBuildFile section */
 
+/* Begin PBXBuildStyle section */
+               BCC0C2960A3792E6008CD7AD /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               BCC0C2970A3792E6008CD7AD /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
                DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               BCC0C2960A3792E6008CD7AD /* Development */,
+                               BCC0C2970A3792E6008CD7AD /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index 5199e347273175e642b8804fe95dfc26074e305c..336722c56e795431722acd7911feb31cc8bb1afe 100644 (file)
@@ -309,6 +309,8 @@ public:
     virtual bool canUndo() const;
     virtual void print();
 
+    void paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text);
+
 protected:
     virtual void startRedirectionTimer();
     virtual void stopRedirectionTimer();
index ed523c1f6b1d486a31dfc253c62cb96999067949..6e59238794071e28f098d27c3d004e58f83237fc 100644 (file)
@@ -3478,4 +3478,9 @@ void Frame::setNeedsReapplyStyles()
     [Mac(this)->bridge() setNeedsReapplyStyles];
 }
 
+void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text)
+{
+    [bridge() paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text];
+}
+
 }
index 773cc60bd94fc092d94e1ae8e023876c44e7900a..0f3847833412f8c400b49890735a3a7cadffaba5 100644 (file)
@@ -667,6 +667,8 @@ typedef enum {
 
 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
 
+- (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text;
+
 - (void)handledOnloadEvents;
 
 - (WebCoreKeyboardUIMode)keyboardUIMode;
index f0ef5420d425c9474c7a5b6441ef6dbaca0831a7..62fae0f0368b81ca06038dbc31c4ee281e0540ae 100644 (file)
@@ -39,6 +39,7 @@
 #else
 class NSImage;
 class NSPasteboard;
+typedef unsigned int NSDragOperation;
 #endif
 
 class DeprecatedStringList;
index 5ffa0fda0e4b309e6649af5aeea9bcf1555ca68f..7defc66f1f0310d00a1a67f1ce84bbd87079680f 100644 (file)
 #include "RenderArena.h"
 #include <wtf/AlwaysInline.h>
 
+#if PLATFORM(MAC)
+#include "FrameMac.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -269,6 +273,12 @@ void InlineTextBox::paint(RenderObject::PaintInfo& i, int tx, int ty)
     // 1. Paint backgrounds behind text if needed.  Examples of such backgrounds include selection
     // and marked text.
     if (i.phase != PaintPhaseSelection && !isPrinting) {
+#if PLATFORM(MAC)
+        // Custom highlighters go behind everything else.
+        if (styleToUse->highlight() != nullAtom)
+            paintCustomHighlight(tx, ty, styleToUse->highlight());
+#endif
+
         if (haveMarkedText  && !markedTextUsesUnderlines)
             paintMarkedTextBackground(i.p, tx, ty, styleToUse, font, markedTextRange->startOffset(exception), markedTextRange->endOffset(exception));
 
@@ -474,6 +484,17 @@ void InlineTextBox::paintMarkedTextBackground(GraphicsContext* p, int tx, int ty
     p->restore();
 }
 
+#if PLATFORM(MAC)
+void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& type)
+{
+    RootInlineBox* r = root();
+    FloatRect rootRect(tx + r->xPos(), ty + r->selectionTop(), r->width(), r->selectionHeight());
+    FloatRect textRect(tx + xPos(), rootRect.y(), width(), rootRect.height());
+
+    Mac(object()->document()->frame())->paintCustomHighlight(type, textRect, rootRect, true);
+}
+#endif
+
 void InlineTextBox::paintDecoration(GraphicsContext *pt, int _tx, int _ty, int deco)
 {
     _tx += m_x;
index ee86ce767bb23ccc034c8b738e8e79c180f190bb..54180da5842ff5b7089ac0428d54ef636f7d6031 100644 (file)
@@ -113,6 +113,9 @@ public:
     void paintSpellingMarker(GraphicsContext*, int tx, int ty, DocumentMarker);
     void paintTextMatchMarker(GraphicsContext*, int tx, int ty, DocumentMarker, RenderStyle*, const Font*);
     void paintMarkedTextUnderline(GraphicsContext*, int tx, int ty, MarkedTextUnderline&);
+#if PLATFORM(MAC)
+    void paintCustomHighlight(int tx, int ty, const AtomicString& type);
+#endif
     virtual int caretMinOffset() const;
     virtual int caretMaxOffset() const;
     virtual unsigned caretMaxRenderedOffset() const;