Commit 06186597 authored by hyatt's avatar hyatt

WebCore:

        Add support for custom highlighting to paint at the root line box level
        (and to inflate the box it uses so that it can go outside the bounds of
        the line if necessary).

        Reviewed by harrison

        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::customHighlightLineRect):
        (WebCore::FrameMac::paintCustomHighlight):
        * bridge/mac/WebCoreFrameBridge.h:
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paintCustomHighlight):
        * rendering/RootInlineBox.cpp:
        (WebCore::RootInlineBox::paintCustomHighlight):
        (WebCore::RootInlineBox::paint):
        * rendering/RootInlineBox.h:

WebKit:

        Fix custom highlighting so that you can paint the entire line (and go
        outside the bounds of the line).

        Reviewed by harrison

        * WebCoreSupport/WebFrameBridge.m:
        (-[WebFrameBridge customHighlightRect:forLine:]):
        (-[WebFrameBridge paintCustomHighlight:forBox:onLine:behindText:entireLine:]):
        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebHTMLViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4ab60f4f
2006-06-28 David Hyatt <hyatt@apple.com>
Add support for custom highlighting to paint at the root line box level
(and to inflate the box it uses so that it can go outside the bounds of
the line if necessary).
Reviewed by harrison
* bridge/mac/FrameMac.h:
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::customHighlightLineRect):
(WebCore::FrameMac::paintCustomHighlight):
* bridge/mac/WebCoreFrameBridge.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintCustomHighlight):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::paintCustomHighlight):
(WebCore::RootInlineBox::paint):
* rendering/RootInlineBox.h:
2006-06-28 Levi Weintraub <lweintraub@apple.com>
Reviewed by justin
......
......@@ -309,7 +309,8 @@ public:
virtual bool canUndo() const;
virtual void print();
void paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text);
FloatRect customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect);
void paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line);
protected:
virtual void startRedirectionTimer();
......
......@@ -3430,9 +3430,14 @@ void Frame::setNeedsReapplyStyles()
[Mac(this)->bridge() setNeedsReapplyStyles];
}
void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text)
FloatRect FrameMac::customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect)
{
[bridge() paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text];
return [bridge() customHighlightRect:type forLine:lineRect];
}
void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line)
{
[bridge() paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line];
}
}
......@@ -679,7 +679,8 @@ typedef enum {
- (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
- (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text;
- (NSRect)customHighlightRect:(NSString*)type forLine:(NSRect)lineRect;
- (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line;
- (void)handledOnloadEvents;
......
......@@ -487,7 +487,7 @@ void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& typ
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);
Mac(object()->document()->frame())->paintCustomHighlight(type, textRect, rootRect, true, false);
}
#endif
......
......@@ -23,6 +23,11 @@
#include "EllipsisBox.h"
#include "RenderBlock.h"
#include "GraphicsContext.h"
#include "Document.h"
#if PLATFORM(MAC)
#include "FrameMac.h"
#endif
using namespace std;
......@@ -98,10 +103,29 @@ void RootInlineBox::paintEllipsisBox(RenderObject::PaintInfo& i, int _tx, int _t
m_ellipsisBox->paint(i, _tx, _ty);
}
#if PLATFORM(MAC)
void RootInlineBox::paintCustomHighlight(RenderObject::PaintInfo& i, int tx, int ty, const AtomicString& highlightType)
{
if (!object()->shouldPaintWithinRoot(i) || object()->style()->visibility() != VISIBLE || i.phase != PaintPhaseForeground)
return;
// Get the inflated rect so that we can properly hit test.
FloatRect rootRect(tx + xPos(), ty + selectionTop(), width(), selectionHeight());
FloatRect inflatedRect = Mac(object()->document()->frame())->customHighlightLineRect(highlightType, rootRect);
if (inflatedRect.intersects(i.r))
Mac(object()->document()->frame())->paintCustomHighlight(highlightType, rootRect, rootRect, false, true);
}
#endif
void RootInlineBox::paint(RenderObject::PaintInfo& i, int tx, int ty)
{
InlineFlowBox::paint(i, tx, ty);
paintEllipsisBox(i, tx, ty);
#if PLATFORM(MAC)
RenderStyle* styleToUse = object()->style(m_firstLine);
if (styleToUse->highlight() != nullAtom && !i.p->paintingDisabled())
paintCustomHighlight(i, tx, ty, styleToUse->highlight());
#endif
}
bool RootInlineBox::nodeAtPoint(RenderObject::NodeInfo& i, int x, int y, int tx, int ty)
......
......@@ -92,6 +92,10 @@ public:
virtual void clearTruncation();
#if PLATFORM(MAC)
void paintCustomHighlight(RenderObject::PaintInfo& i, int tx, int ty, const AtomicString& highlightType);
#endif
virtual void paint(RenderObject::PaintInfo& i, int _tx, int _ty);
virtual bool nodeAtPoint(RenderObject::NodeInfo& i, int x, int y, int tx, int ty);
......
2006-06-28 David Hyatt <hyatt@apple.com>
Fix custom highlighting so that you can paint the entire line (and go
outside the bounds of the line).
Reviewed by harrison
* WebCoreSupport/WebFrameBridge.m:
(-[WebFrameBridge customHighlightRect:forLine:]):
(-[WebFrameBridge paintCustomHighlight:forBox:onLine:behindText:entireLine:]):
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebHTMLViewPrivate.h:
2006-06-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Anders.
......
......@@ -1533,7 +1533,20 @@ - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions
}
}
- (NSRect)customHighlightRect:(NSString*)type forLine:(NSRect)lineRect
{
ASSERT(_frame != nil);
NSView *documentView = [[_frame frameView] documentView];
if (![documentView isKindOfClass:[WebHTMLView class]])
return NSZeroRect;
WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
id<WebHTMLHighlighter> highlighter = [webHTMLView _highlighterForType:type];
return [highlighter highlightRectForLine:lineRect];
}
- (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text
entireLine:(BOOL)line
{
ASSERT(_frame != nil);
NSView *documentView = [[_frame frameView] documentView];
......@@ -1542,7 +1555,7 @@ - (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRe
WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
id<WebHTMLHighlighter> highlighter = [webHTMLView _highlighterForType:type];
[highlighter paintHighlightForBox:boxRect onLine:lineRect behindText:text];
[highlighter paintHighlightForBox:boxRect onLine:lineRect behindText:text entireLine:line];
}
- (NSString *)nameForUndoAction:(WebUndoAction)undoAction
......
......@@ -278,6 +278,23 @@
ED7F6D8B0980683500C235ED /* WebNSDataExtrasPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
BCEED1470A53334500443D9A /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
BCEED1480A53334500443D9A /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXFileReference section */
1C0706620A431E01001078F6 /* WebScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
1C07073C0A433BD8001078F6 /* WebScriptDebugServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebScriptDebugServer.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -1229,6 +1246,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
buildSettings = {
};
buildStyles = (
BCEED1470A53334500443D9A /* Development */,
BCEED1480A53334500443D9A /* Deployment */,
);
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -37,7 +37,8 @@
@class WebPluginController;
@protocol WebHTMLHighlighter
- (void)paintHighlightForBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text;
- (NSRect)highlightRectForLine:(NSRect)lineRect;
- (void)paintHighlightForBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line;
@end
@interface WebHTMLView (WebPrivate)
......
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