Reviewed by Trey.
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jun 2004 00:09:08 +0000 (00:09 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jun 2004 00:09:08 +0000 (00:09 +0000)
        Work on text-align API. Marked these bugs fixed:
        <rdar://problem/3655380>: (Editing:�alignCenter:�ethod�nimplemented�WebKit�diting�PI))
        <rdar://problem/3655381>: (Editing:�alignJustified:�ethod�nimplemented�WebKit�diting�PI))
        <rdar://problem/3655383>: (Editing:�alignLeft:�ethod�nimplemented�WebKit�diting�PI))
        <rdar://problem/3655384>: (Editing:�alignRight:�ethod�nimplemented�WebKit�diting�PI))

        in favor of opening this bug:
        <rdar://problem/3675191>: (Editing: -alignLeft: and friends mostly implemented but not
        yet working (WebKit editing API))

        * English.lproj/StringsNotToBeLocalized.txt:
        updated for these changes

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView changeDocumentBackgroundColor:]):
        added a FIXME about why this is still not quite right
        (-[WebHTMLView _alignSelectionUsingCSSValue:]):
        new method, bottleneck for the various values
        (-[WebHTMLView alignCenter:]):
        call _alignSelectionUsingCSSValue:@"center"
        (-[WebHTMLView alignJustified:]):
        call _alignSelectionUsingCSSValue:@"justify"
        (-[WebHTMLView alignLeft:]):
        call _alignSelectionUsingCSSValue:@"left"
        (-[WebHTMLView alignRight:]):
        call _alignSelectionUsingCSSValue:@"right"

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@6740 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/English.lproj/StringsNotToBeLocalized.txt
WebKit/WebView.subproj/WebHTMLView.m

index a4c0003fa67672be32be8d9fdc26f350cd5369f7..fb64a677e206df15c759703372e7405611ed8f2b 100644 (file)
@@ -1,3 +1,34 @@
+2004-06-01  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Trey.
+        
+        Work on text-align API. Marked these bugs fixed:
+        <rdar://problem/3655380>: (Editing:Ê-alignCenter:ÊmethodÊunimplementedÊ(WebKitÊeditingÊAPI))
+        <rdar://problem/3655381>: (Editing:Ê-alignJustified:ÊmethodÊunimplementedÊ(WebKitÊeditingÊAPI))
+        <rdar://problem/3655383>: (Editing:Ê-alignLeft:ÊmethodÊunimplementedÊ(WebKitÊeditingÊAPI))
+        <rdar://problem/3655384>: (Editing:Ê-alignRight:ÊmethodÊunimplementedÊ(WebKitÊeditingÊAPI))        
+        
+        in favor of opening this bug:
+        <rdar://problem/3675191>: (Editing: -alignLeft: and friends mostly implemented but not 
+        yet working (WebKit editing API))        
+
+        * English.lproj/StringsNotToBeLocalized.txt:
+        updated for these changes
+        
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView changeDocumentBackgroundColor:]):
+        added a FIXME about why this is still not quite right
+        (-[WebHTMLView _alignSelectionUsingCSSValue:]):
+        new method, bottleneck for the various values
+        (-[WebHTMLView alignCenter:]):
+        call _alignSelectionUsingCSSValue:@"center"
+        (-[WebHTMLView alignJustified:]):
+        call _alignSelectionUsingCSSValue:@"justify"
+        (-[WebHTMLView alignLeft:]):
+        call _alignSelectionUsingCSSValue:@"left"
+        (-[WebHTMLView alignRight:]):
+        call _alignSelectionUsingCSSValue:@"right"
+
 2004-06-01  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Ken.
index 620eb7597ba36e381d978242aa3c54097a407af4..94e36822d772d198ed08c3b51932b664659f11be 100644 (file)
 "mainFrameURL"
 "nullplugin"
 "pluginspage"
+"rgb(%.0f,%.0f,%.0f)"
 "src"
 "text/"
 "text/calendar"
@@ -361,8 +362,12 @@ WebCoreSupport.subproj/WebTextRendererFactory.m:"Pashto"
 WebCoreSupport.subproj/WebTextRendererFactory.m:"Urdu"
 WebView.subproj/WebDataSource.m:"Refresh"
 WebView.subproj/WebHTMLView.m:"bold"
+WebView.subproj/WebHTMLView.m:"center"
 WebView.subproj/WebHTMLView.m:"italic"
+WebView.subproj/WebHTMLView.m:"justify"
+WebView.subproj/WebHTMLView.m:"left"
 WebView.subproj/WebHTMLView.m:"normal"
+WebView.subproj/WebHTMLView.m:"right"
 WebView.subproj/WebPreferences.m:"Identifier"
 WebView.subproj/WebPreferences.m:"Values"
 WebView.subproj/WebPreferences.m:"WebPreferences%d"
index 36ba6a921c0bb5c8c21045e107c982f670dbeeca..3498a2350052f597c010c642aa355e53f7a2259e 100644 (file)
@@ -2458,6 +2458,10 @@ static WebHTMLView *lastHitView = nil;
     // FIXME: this actually has no effect when called, probably due to 3654850. _entireDOMRange seems
     // to do the right thing because it works in startSpeaking:, and I know setBackgroundColor: does the
     // right thing because I tested it with [[self _bridge] selectedDOMRange].
+    // FIXME: This won't actually apply the style to the entire range here, because it ends up calling
+    // [bridge applyStyle:], which operates on the current selection. To make this work right, we'll
+    // need to save off the selection, temporarily set it to the entire range, make the change, then
+    // restore the old selection.
     [self _changeCSSColorUsingSelector:@selector(setBackgroundColor:) inRange:[self _entireDOMRange]];
 }
 
@@ -2471,24 +2475,37 @@ static WebHTMLView *lastHitView = nil;
     [self _changeCSSColorUsingSelector:@selector(setColor:) inRange:[[self _bridge] selectedDOMRange]];
 }
 
+- (void)_alignSelectionUsingCSSValue:(NSString *)CSSAlignmentValue
+{
+    // FIXME 3675191: This doesn't work yet. Maybe it's blocked by 3654850, or maybe something other than
+    // just applyStyle: needs to be called for block-level attributes like this.
+    WebBridge *bridge = [self _bridge];
+    DOMCSSStyleDeclaration *style = [[bridge DOMDocument] createCSSStyleDeclaration];
+    [style setTextAlign:CSSAlignmentValue];
+    WebView *webView = [self _webView];
+    if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:[bridge selectedDOMRange]]) {
+        [[self _bridge] applyStyle:style];
+    }
+}
+
 - (void)alignCenter:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alignSelectionUsingCSSValue:@"center"];
 }
 
 - (void)alignJustified:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alignSelectionUsingCSSValue:@"justify"];
 }
 
 - (void)alignLeft:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alignSelectionUsingCSSValue:@"left"];
 }
 
 - (void)alignRight:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alignSelectionUsingCSSValue:@"right"];
 }
 
 - (void)indent:(id)sender