[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:42:23 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 723663e83ddd051c5e844d22253631eb8cdbd67d
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu May 27 16:26:59 2004 +0000
Reviewed by Gramps
* kwq/KWQKHTMLPart.h: Declare new fontForCurrentPosition helper.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::fontForCurrentPosition): Determines the "current font" in the way that Cocoa
does. Either the font of the character before the caret, when the selection is a caret, or
the font of the first character selected, when the selection is a range.
* kwq/WebCoreBridge.h: Declare bridge method so this can be called from WebKit.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge fontForCurrentPosition]): Calls through to fontForCurrentPosition on KWQKHTMLPart.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a3c61a0..73e2d03 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,6 +1,19 @@
2004-05-27 Ken Kocienda <kocienda at apple.com>
Reviewed by Gramps
+
+ * kwq/KWQKHTMLPart.h: Declare new fontForCurrentPosition helper.
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::fontForCurrentPosition): Determines the "current font" in the way that Cocoa
+ does. Either the font of the character before the caret, when the selection is a caret, or
+ the font of the first character selected, when the selection is a range.
+ * kwq/WebCoreBridge.h: Declare bridge method so this can be called from WebKit.
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge fontForCurrentPosition]): Calls through to fontForCurrentPosition on KWQKHTMLPart.
+
+2004-05-27 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Gramps
Adds a typing style member variable to khtml part.
This patch adds basic life-cycle management and
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 7f0b6e9..d474df8 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -67,6 +67,7 @@ typedef DOMElement ObjCDOMElement;
@class NSColor;
@class NSEvent;
@class NSFileWrapper;
+ at class NSFont;
@class NSMutableDictionary;
@class NSResponder;
@class NSString;
@@ -85,6 +86,7 @@ class NSAttributedString;
class NSColor;
class NSEvent;
class NSFileWrapper;
+class NSFont;
class NSMutableDictionary;
class NSResponder;
class NSString;
@@ -206,6 +208,8 @@ public:
int selectionEndOffset() const;
QRect selectionRect() const;
+
+ NSFont *fontForCurrentPosition() const;
NSFileWrapper *fileWrapperForElement(DOM::ElementImpl *);
NSAttributedString *attributedString(DOM::NodeImpl *startNode, int startOffset, DOM::NodeImpl *endNode, int endOffset);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index f590304..0563f40 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -41,7 +41,9 @@
#import "csshelper.h"
#import "dom2_eventsimpl.h"
#import "dom2_rangeimpl.h"
+#import "dom_position.h"
#import "dom_selection.h"
+#import "dom_textimpl.h"
#import "html_documentimpl.h"
#import "html_misc.h"
#import "htmlattrs.h"
@@ -79,9 +81,11 @@ using DOM::HTMLGenericFormElementImpl;
using DOM::HTMLTableCellElementImpl;
using DOM::Node;
using DOM::NodeImpl;
+using DOM::Position;
using DOM::Range;
using DOM::RangeImpl;
using DOM::Selection;
+using DOM::TextImpl;
using khtml::Cache;
using khtml::ChildFrame;
@@ -2757,6 +2761,53 @@ QRect KWQKHTMLPart::selectionRect() const
return root->selectionRect();
}
+NSFont *KWQKHTMLPart::fontForCurrentPosition() const
+{
+ if (d->m_selection.state() == Selection::NONE)
+ return nil;
+
+ Range range(d->m_selection.toRange());
+ Position pos(range.startContainer().handle(), range.startOffset());
+ ASSERT(pos.notEmpty());
+ ElementImpl *elem = pos.element();
+ if (d->m_typingStyle) {
+ if (!xmlDocImpl())
+ return nil;
+
+ int exceptionCode = 0;
+ ElementImpl *styleElement = xmlDocImpl()->createHTMLElement("SPAN", exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ styleElement->setAttribute(ATTR_STYLE, d->m_typingStyle->cssText().implementation(), exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ TextImpl *text = xmlDocImpl()->createEditingTextNode("");
+ styleElement->appendChild(text, exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ elem->appendChild(styleElement, exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ RenderObject *renderer = styleElement->renderer();
+ ASSERT(renderer);
+ NSFont *result = renderer->style()->font().getNSFont();
+
+ styleElement->removeChild(text, exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ elem->removeChild(styleElement, exceptionCode);
+ ASSERT(exceptionCode == 0);
+
+ return result;
+ }
+ else {
+ RenderObject *renderer = elem->renderer();
+ if (renderer)
+ return renderer->style()->font().getNSFont();
+ }
+ return nil;
+}
+
KWQWindowWidget *KWQKHTMLPart::topLevelWidget()
{
return _windowWidget;
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index df6aece..1dfc0dd 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -307,6 +307,7 @@ typedef enum {
- (void)deleteSelection;
- (void)deleteKeyPressed;
- (void)applyStyle:(DOMCSSStyleDeclaration *)style;
+- (NSFont *)fontForCurrentPosition;
- (void)ensureCaretVisible;
- (WebScriptObject *)windowScriptObject;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 04839e5..e061b0d 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1526,6 +1526,11 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
cmd.apply();
}
+- (NSFont *)fontForCurrentPosition
+{
+ return _part ? _part->fontForCurrentPosition() : nil;
+}
+
- (void)ensureCaretVisible
{
if (!_part)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list