Index: third_party/WebKit/WebCore/editing/mac/SelectionControllerMac.mm |
=================================================================== |
--- third_party/WebKit/WebCore/editing/mac/SelectionControllerMac.mm (revision 9383) |
+++ third_party/WebKit/WebCore/editing/mac/SelectionControllerMac.mm (working copy) |
@@ -27,41 +27,42 @@ |
#import "SelectionController.h" |
#import "AXObjectCache.h" |
+#import "Document.h" |
#import "Frame.h" |
+#import "FrameView.h" |
#import "RenderView.h" |
+#import "Selection.h" |
#import "WebCoreViewFactory.h" |
+#import <ApplicationServices/ApplicationServices.h> |
+ |
namespace WebCore { |
void SelectionController::notifyAccessibilityForSelectionChange() |
{ |
- Document* document = m_frame->document(); |
- |
if (AXObjectCache::accessibilityEnabled() && m_sel.start().isNotNull() && m_sel.end().isNotNull()) |
- document->axObjectCache()->postNotification(m_sel.start().node()->renderer(), "AXSelectedTextChanged"); |
- |
+ m_frame->document()->axObjectCache()->postNotification(m_sel.start().node()->renderer(), "AXSelectedTextChanged"); |
+ |
// if zoom feature is enabled, insertion point changes should update the zoom |
- if (!UAZoomEnabled() || !m_sel.isCaret()) |
- return; |
+ if (UAZoomEnabled() && m_sel.isCaret() && m_sel.start().node()) { |
+ RenderView* renderView = toRenderView(m_sel.start().node()->renderer()); |
+ if (renderView) { |
+ IntRect selectionRect = absoluteCaretBounds(); |
+ IntRect viewRect = renderView->viewRect(); |
+ FrameView* frameView = renderView->view()->frameView(); |
+ if (frameView) { |
+ selectionRect = frameView->contentsToScreen(selectionRect); |
+ viewRect = frameView->contentsToScreen(viewRect); |
+ CGRect cgCaretRect = CGRectMake(selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height()); |
+ CGRect cgViewRect = CGRectMake(viewRect.x(), viewRect.y(), viewRect.width(), viewRect.height()); |
+ cgCaretRect = [[WebCoreViewFactory sharedFactory] accessibilityConvertScreenRect:cgCaretRect]; |
+ cgViewRect = [[WebCoreViewFactory sharedFactory] accessibilityConvertScreenRect:cgViewRect]; |
- RenderView* renderView = document->renderView(); |
- if (!renderView) |
- return; |
- FrameView* frameView = m_frame->view(); |
- if (!frameView) |
- return; |
+ (void)UAZoomChangeFocus(&cgViewRect, &cgCaretRect, kUAZoomFocusTypeInsertionPoint); |
+ } |
+ } |
+ } |
+} |
- IntRect selectionRect = absoluteCaretBounds(); |
- IntRect viewRect = renderView->viewRect(); |
- selectionRect = frameView->contentsToScreen(selectionRect); |
- viewRect = frameView->contentsToScreen(viewRect); |
- CGRect cgCaretRect = CGRectMake(selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height()); |
- CGRect cgViewRect = CGRectMake(viewRect.x(), viewRect.y(), viewRect.width(), viewRect.height()); |
- cgCaretRect = [[WebCoreViewFactory sharedFactory] accessibilityConvertScreenRect:cgCaretRect]; |
- cgViewRect = [[WebCoreViewFactory sharedFactory] accessibilityConvertScreenRect:cgViewRect]; |
- |
- UAZoomChangeFocus(&cgViewRect, &cgCaretRect, kUAZoomFocusTypeInsertionPoint); |
-} |
- |
} // namespace WebCore |