Commit 4e6f7fbc authored by hyatt's avatar hyatt

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:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e76b0101
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
......
......@@ -1524,6 +1524,23 @@
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;
......@@ -6216,6 +6233,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
buildSettings = {
};
buildStyles = (
BCC0C2960A3792E6008CD7AD /* Development */,
BCC0C2970A3792E6008CD7AD /* Deployment */,
);
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -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();
......
......@@ -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];
}
}
......@@ -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;
......
......@@ -39,6 +39,7 @@
#else
class NSImage;
class NSPasteboard;
typedef unsigned int NSDragOperation;
#endif
class DeprecatedStringList;
......
......@@ -34,6 +34,10 @@
#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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment