Changeset 30005 in webkit
- Timestamp:
- Feb 5, 2008 9:31:30 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r30003 r30005 1 2008-02-05 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 - WebCore part of <rdar://problem/5724303> Should implement writing direction shortcuts 6 7 * WebCore.base.exp: Added Editor::setBaseWritingDirection() and 8 Frame::baseWritingDirectionForSelectionStart(). 9 * page/mac/WebCoreFrameBridge.h: Removed 10 -baseWritingDirectionForSelectionStart. 11 * page/mac/WebCoreFrameBridge.mm: Ditto. 12 1 13 2008-02-05 Mark Rowe <mrowe@apple.com> 2 14 -
trunk/WebCore/WebCore.base.exp
r29905 r30005 426 426 __ZN7WebCore6Editor21applyStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE 427 427 __ZN7WebCore6Editor21isSelectionMisspelledEv 428 __ZN7WebCore6Editor23setBaseWritingDirectionERKNS_6StringE 428 429 __ZN7WebCore6Editor24advanceToNextMisspellingEb 429 430 __ZN7WebCore6Editor24isSelectionUngrammaticalEv … … 539 540 __ZN7WebCoreeqERKNS_19ResourceRequestBaseES2_ 540 541 __ZN7WebCoreeqERKNS_4KURLES2_ 542 __ZNK7WebCore5Frame37baseWritingDirectionForSelectionStartEv 541 543 __ZNK7WebCore11CachedImage5imageEv 542 544 __ZNK7WebCore11ContextMenu19platformDescriptionEv -
trunk/WebCore/page/mac/WebCoreFrameBridge.h
r29889 r30005 162 162 163 163 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts; 164 - (NSWritingDirection)baseWritingDirectionForSelectionStart;165 164 166 165 - (NSString *)stringWithData:(NSData *)data; // using the encoding of the frame's main resource -
trunk/WebCore/page/mac/WebCoreFrameBridge.mm
r29581 r30005 1131 1131 } 1132 1132 1133 - (NSWritingDirection)baseWritingDirectionForSelectionStart1134 {1135 return m_frame ? m_frame->baseWritingDirectionForSelectionStart() : (NSWritingDirection)NSWritingDirectionLeftToRight;1136 }1137 1138 1133 - (void)dragSourceMovedTo:(NSPoint)windowLoc 1139 1134 { -
trunk/WebKit/mac/ChangeLog
r30003 r30005 1 2008-02-05 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 - WebKit part of <rdar://problem/5724303> Should implement writing direction shortcuts 6 7 The key bindings are Command-Control-left arrow and 8 Command-Control-right arrow. To match AppKit, the bindings are enabled 9 only when certain user defaults are set. 10 11 * WebView/WebHTMLView.mm: 12 (-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]): 13 (-[WebHTMLView toggleBaseWritingDirection:]): Changed to call 14 Frame::baseWritingDirectionForSelectionStart() and 15 Editor::setBaseWritingDirection() directly. 16 (-[WebHTMLView changeBaseWritingDirection:]): Ditto. 17 (writingDirectionKeyBindingsEnabled): Added. 18 (-[WebHTMLView _changeBaseWritingDirectionTo:]): Added this helper 19 method. 20 (-[WebHTMLView changeBaseWritingDirectionToLTR:]): Added. 21 (-[WebHTMLView changeBaseWritingDirectionToRTL:]): Added. 22 * WebView/WebView.mm: 23 1 24 2008-02-05 Mark Rowe <mrowe@apple.com> 2 25 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r29889 r30005 2266 2266 || action == @selector(pasteFont:)) 2267 2267 return [self _canEdit]; 2268 2268 2269 2269 if (action == @selector(showGuessPanel:)) { 2270 2270 #ifndef BUILDING_ON_TIGER … … 4218 4218 return; 4219 4219 4220 NSString *direction = @"RTL"; 4221 switch ([[self _bridge] baseWritingDirectionForSelectionStart]) { 4220 Frame* coreFrame = core([self _frame]); 4221 if (!coreFrame) 4222 return; 4223 4224 const char* direction = "rtl"; 4225 switch (coreFrame->baseWritingDirectionForSelectionStart()) { 4222 4226 case NSWritingDirectionLeftToRight: 4223 4227 break; 4224 4228 case NSWritingDirectionRightToLeft: 4225 direction = @"LTR";4229 direction = "ltr"; 4226 4230 break; 4227 4231 // The writingDirectionForSelectionStart method will never return "natural". It … … 4232 4236 } 4233 4237 4234 DOMCSSStyleDeclaration *style = [self _emptyStyle]; 4235 [style setDirection:direction]; 4236 [self _applyParagraphStyleToSelection:style withUndoAction:EditActionSetWritingDirection]; 4238 if (Frame* coreFrame = core([self _frame])) 4239 coreFrame->editor()->setBaseWritingDirection(direction); 4237 4240 } 4238 4241 … … 4250 4253 ASSERT(writingDirection != NSWritingDirectionNatural); 4251 4254 4252 DOMCSSStyleDeclaration *style = [self _emptyStyle]; 4253 [style setDirection:writingDirection == NSWritingDirectionLeftToRight ? @"LTR" : @"RTL"]; 4254 [self _applyParagraphStyleToSelection:style withUndoAction:EditActionSetWritingDirection]; 4255 if (Frame* coreFrame = core([self _frame])) 4256 coreFrame->editor()->setBaseWritingDirection(writingDirection == NSWritingDirectionLeftToRight ? "ltr" : "rtl"); 4257 } 4258 4259 static BOOL writingDirectionKeyBindingsEnabled() 4260 { 4261 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 4262 return [defaults boolForKey:@"NSAllowsBaseWritingDirectionKeyBindings"] || [defaults boolForKey:@"AppleTextDirection"]; 4263 } 4264 4265 - (void)_changeBaseWritingDirectionTo:(NSWritingDirection)direction 4266 { 4267 if (![self _canEdit]) 4268 return; 4269 4270 static BOOL bindingsEnabled = writingDirectionKeyBindingsEnabled(); 4271 4272 if (!bindingsEnabled) { 4273 NSBeep(); 4274 return; 4275 } 4276 4277 if (Frame* coreFrame = core([self _frame])) 4278 coreFrame->editor()->setBaseWritingDirection(direction == NSWritingDirectionLeftToRight ? "ltr" : "rtl"); 4279 } 4280 4281 - (void)changeBaseWritingDirectionToLTR:(id)sender 4282 { 4283 COMMAND_PROLOGUE 4284 4285 [self _changeBaseWritingDirectionTo:NSWritingDirectionLeftToRight]; 4286 } 4287 4288 - (void)changeBaseWritingDirectionToRTL:(id)sender 4289 { 4290 COMMAND_PROLOGUE 4291 4292 [self _changeBaseWritingDirectionTo:NSWritingDirectionRightToLeft]; 4255 4293 } 4256 4294 -
trunk/WebKit/mac/WebView/WebView.mm
r29811 r30005 150 150 macro(changeAttributes) \ 151 151 macro(changeBaseWritingDirection) \ 152 macro(changeBaseWritingDirectionToLTR) \ 153 macro(changeBaseWritingDirectionToRTL) \ 152 154 macro(changeColor) \ 153 155 macro(changeDocumentBackgroundColor) \
Note: See TracChangeset
for help on using the changeset viewer.