[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:02:41 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 5c443f8d855681a1f0d05901d8c1756d686331a5
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 17 23:57:31 2003 +0000
Reviewed by Maciej.
- make text areas set the base writing direction based on the direction in the CSS style
* kwq/KWQTextArea.h: Added setBaseWritingDirection method.
* kwq/KWQTextArea.mm:
(-[KWQTextArea _createTextView]): Use _KWQ_setTypingParagraphStyle.
(-[KWQTextArea setWordWrap:]): Use _KWQ_setTypingParagraphStyle.
(-[KWQTextArea setBaseWritingDirection:]): Added. New method that sets the base writing
direction in both the style of the text and the typing attributes.
(-[NSTextView _KWQ_typingParagraphStyle]): Added. Helper method to make setBaseWritingDirection:
a little less gigantic.
(-[NSTextView _KWQ_setTypingParagraphStyle:]): Ditto.
(-[NSTextStorage _KWQ_setBaseWritingDirection:]): Ditto.
* kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Set both alignment and base writing direction.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 3ac1f34..51fad1a 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-10-17 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - make text areas set the base writing direction based on the direction in the CSS style
+
+ * kwq/KWQTextArea.h: Added setBaseWritingDirection method.
+ * kwq/KWQTextArea.mm:
+ (-[KWQTextArea _createTextView]): Use _KWQ_setTypingParagraphStyle.
+ (-[KWQTextArea setWordWrap:]): Use _KWQ_setTypingParagraphStyle.
+ (-[KWQTextArea setBaseWritingDirection:]): Added. New method that sets the base writing
+ direction in both the style of the text and the typing attributes.
+ (-[NSTextView _KWQ_typingParagraphStyle]): Added. Helper method to make setBaseWritingDirection:
+ a little less gigantic.
+ (-[NSTextView _KWQ_setTypingParagraphStyle:]): Ditto.
+ (-[NSTextStorage _KWQ_setBaseWritingDirection:]): Ditto.
+
+ * kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Set both alignment and base writing direction.
+
2003-10-17 David Hyatt <hyatt at apple.com>
Implement horizontal and vertical border-spacing. Allow them to be specified individually.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3ac1f34..51fad1a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-10-17 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - make text areas set the base writing direction based on the direction in the CSS style
+
+ * kwq/KWQTextArea.h: Added setBaseWritingDirection method.
+ * kwq/KWQTextArea.mm:
+ (-[KWQTextArea _createTextView]): Use _KWQ_setTypingParagraphStyle.
+ (-[KWQTextArea setWordWrap:]): Use _KWQ_setTypingParagraphStyle.
+ (-[KWQTextArea setBaseWritingDirection:]): Added. New method that sets the base writing
+ direction in both the style of the text and the typing attributes.
+ (-[NSTextView _KWQ_typingParagraphStyle]): Added. Helper method to make setBaseWritingDirection:
+ a little less gigantic.
+ (-[NSTextView _KWQ_setTypingParagraphStyle:]): Ditto.
+ (-[NSTextStorage _KWQ_setBaseWritingDirection:]): Ditto.
+
+ * kwq/KWQTextEdit.mm: (QTextEdit::setAlignment): Set both alignment and base writing direction.
+
2003-10-17 David Hyatt <hyatt at apple.com>
Implement horizontal and vertical border-spacing. Allow them to be specified individually.
diff --git a/WebCore/kwq/KWQTextArea.h b/WebCore/kwq/KWQTextArea.h
index 4891c63..aece2a7 100644
--- a/WebCore/kwq/KWQTextArea.h
+++ b/WebCore/kwq/KWQTextArea.h
@@ -41,6 +41,7 @@ class QTextEdit;
- initWithQTextEdit:(QTextEdit *)w;
- (void)setAlignment:(NSTextAlignment)alignment;
+- (void)setBaseWritingDirection:(NSWritingDirection)direction;
- (void)setEditable:(BOOL)flag;
- (BOOL)isEditable;
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index b83ebf1..56edb59 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -45,10 +45,20 @@
HARD|PHYSICAL - Text is wrapped, and text is broken into separate lines.
*/
+
@interface NSView (KWQTextArea)
- (void)_KWQ_setKeyboardFocusRingNeedsDisplay;
@end
+ at interface NSTextView (KWQTextArea)
+- (NSParagraphStyle *)_KWQ_typingParagraphStyle;
+- (void)_KWQ_setTypingParagraphStyle:(NSParagraphStyle *)style;
+ at end
+
+ at interface NSTextStorage (KWQTextArea)
+- (void)_KWQ_setBaseWritingDirection:(NSWritingDirection)direction;
+ at end
+
@interface KWQTextAreaTextView : NSTextView <KWQWidgetHolder>
{
QTextEdit *widget;
@@ -88,7 +98,7 @@ const float LargeNumberForText = 1.0e7;
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
[style setLineBreakMode:NSLineBreakByWordWrapping];
[style setAlignment:NSLeftTextAlignment];
- [textView setTypingAttributes:[NSDictionary dictionaryWithObject:style forKey:NSParagraphStyleAttributeName]];
+ [textView _KWQ_setTypingParagraphStyle:style];
[style release];
[textView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
@@ -182,7 +192,7 @@ const float LargeNumberForText = 1.0e7;
[style setAlignment:NSLeftTextAlignment];
- [textView setTypingAttributes:[NSDictionary dictionaryWithObject:style forKey:NSParagraphStyleAttributeName]];
+ [textView _KWQ_setTypingParagraphStyle:style];
[style release];
wrap = f;
@@ -468,6 +478,21 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
[textView setAlignment:alignment];
}
+- (void)setBaseWritingDirection:(NSWritingDirection)direction
+{
+ // Set the base writing direction for typing.
+ NSParagraphStyle *style = [textView _KWQ_typingParagraphStyle];
+ if ([style baseWritingDirection] != direction) {
+ NSMutableParagraphStyle *mutableStyle = [style mutableCopy];
+ [mutableStyle setBaseWritingDirection:direction];
+ [textView _KWQ_setTypingParagraphStyle:mutableStyle];
+ [mutableStyle release];
+ }
+
+ // Set the base writing direction for text.
+ [[textView textStorage] _KWQ_setBaseWritingDirection:direction];
+}
+
// This is the only one of the display family of calls that we use, and the way we do
// displaying in WebCore means this is called on this NSView explicitly, so this catches
// all cases where we are inside the normal display machinery. (Used only by the insertion
@@ -709,3 +734,64 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
}
@end
+
+ at implementation NSTextView (KWQTextArea)
+
+- (NSParagraphStyle *)_KWQ_typingParagraphStyle
+{
+ NSParagraphStyle *style = [[self typingAttributes] objectForKey:NSParagraphStyleAttributeName];
+ if (style != nil) {
+ return style;
+ }
+ style = [self defaultParagraphStyle];
+ if (style != nil) {
+ return style;
+ }
+ return [NSParagraphStyle defaultParagraphStyle];
+}
+
+- (void)_KWQ_setTypingParagraphStyle:(NSParagraphStyle *)style
+{
+ NSParagraphStyle *immutableStyle = [style copy];
+ NSDictionary *attributes = [self typingAttributes];
+ if (attributes != nil) {
+ NSMutableDictionary *mutableAttributes = [attributes mutableCopy];
+ [mutableAttributes setObject:immutableStyle forKey:NSParagraphStyleAttributeName];
+ attributes = mutableAttributes;
+ } else {
+ attributes = [[NSDictionary alloc] initWithObjectsAndKeys:immutableStyle, NSParagraphStyleAttributeName, nil];
+ }
+ [immutableStyle release];
+ [self setTypingAttributes:attributes];
+ [attributes release];
+}
+
+ at end
+
+ at implementation NSTextStorage (KWQTextArea)
+
+- (void)_KWQ_setBaseWritingDirection:(NSWritingDirection)direction
+{
+ unsigned end = [self length];
+ NSRange range = NSMakeRange(0, end);
+ if (end != 0) {
+ [self beginEditing];
+ for (unsigned i = 0; i < end; ) {
+ NSRange effectiveRange;
+ NSParagraphStyle *style = [self attribute:NSParagraphStyleAttributeName atIndex:i longestEffectiveRange:&effectiveRange inRange:range];
+ if (style == nil) {
+ style = [NSParagraphStyle defaultParagraphStyle];
+ }
+ if ([style baseWritingDirection] != direction) {
+ NSMutableParagraphStyle *mutableStyle = [style mutableCopy];
+ [mutableStyle setBaseWritingDirection:direction];
+ [self addAttribute:NSParagraphStyleAttributeName value:mutableStyle range:effectiveRange];
+ [mutableStyle release];
+ }
+ i = NSMaxRange(effectiveRange);
+ }
+ [self endEditing];
+ }
+}
+
+ at end
diff --git a/WebCore/kwq/KWQTextEdit.mm b/WebCore/kwq/KWQTextEdit.mm
index 221ec9a..13c2e5f 100644
--- a/WebCore/kwq/KWQTextEdit.mm
+++ b/WebCore/kwq/KWQTextEdit.mm
@@ -190,11 +190,15 @@ void QTextEdit::clicked()
void QTextEdit::setAlignment(AlignmentFlags alignment)
{
+ // The thing we use setAlignment for in WebCore is to set the base writing direction.
+ // Rather than adding a new call for this purpose, we just code it that way.
+
ASSERT(alignment == AlignLeft || alignment == AlignRight);
KWQTextArea *textArea = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textArea setAlignment:(alignment == AlignRight ? NSRightTextAlignment : NSLeftTextAlignment)];
+ [textArea setBaseWritingDirection:(alignment == AlignRight ? NSWritingDirectionRightToLeft : NSWritingDirectionLeftToRight)];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list