Changeset 21649 in webkit


Ignore:
Timestamp:
May 22, 2007 4:21:21 PM (17 years ago)
Author:
adele
Message:

LayoutTests:

Reviewed by Darin.

Test for http://bugs.webkit.org/show_bug.cgi?id=13796
Crash in [NSInputContext currentInputContext] when you click on this map

  • fast/frames/frame-display-none-focus-expected.txt: Added.
  • fast/frames/frame-display-none-focus.html: Added.
  • fast/frames/resources/iframe-focus.html: Added.

WebCore:

Reviewed by Darin.

Fix for http://bugs.webkit.org/show_bug.cgi?id=13796
Crash in [NSInputContext currentInputContext] when you click on this map

This is another case of <rdar://problem/5171145> Safari crashed closing tab in NSInputContext updateInputContexts

Test: fast/frames/frame-display-none-focus.html

  • WebCore.xcodeproj/project.pbxproj: Added ChromeMac.mm
  • page/Chrome.h:
  • page/mac/ChromeMac.mm: Added. (WebCore::Chrome::focusNSView): Moved code from Widget::setFocus so it can be used whenever we need to make a view the first responder.
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::focusDocumentView): Calls focusNSView.
  • platform/mac/WidgetMac.mm: (WebCore::Widget::setFocus): Calls focusNSView.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r21648 r21649  
     12007-05-22  Adele Peterson  <adele@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        Test for http://bugs.webkit.org/show_bug.cgi?id=13796
     6        Crash in [NSInputContext currentInputContext] when you click on this map
     7
     8        * fast/frames/frame-display-none-focus-expected.txt: Added.
     9        * fast/frames/frame-display-none-focus.html: Added.
     10        * fast/frames/resources/iframe-focus.html: Added.
     11
    1122007-05-22  Justin Garcia  <justin.garcia@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r21648 r21649  
     12007-05-22  Adele Peterson  <adele@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        Fix for http://bugs.webkit.org/show_bug.cgi?id=13796
     6        Crash in [NSInputContext currentInputContext] when you click on this map
     7
     8        This is another case of <rdar://problem/5171145> Safari crashed closing tab in NSInputContext updateInputContexts
     9
     10        Test: fast/frames/frame-display-none-focus.html
     11
     12        * WebCore.xcodeproj/project.pbxproj: Added ChromeMac.mm
     13        * page/Chrome.h:
     14        * page/mac/ChromeMac.mm: Added.
     15        (WebCore::Chrome::focusNSView): Moved code from Widget::setFocus so it can be used whenever we need to make a view the first responder.
     16        * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::focusDocumentView): Calls focusNSView.
     17        * platform/mac/WidgetMac.mm: (WebCore::Widget::setFocus): Calls focusNSView.
     18
    1192007-05-22  Justin Garcia  <justin.garcia@apple.com>
    220
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r21633 r21649  
    22822282                AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; };
    22832283                AB7170A00B31193B0017123E /* SearchPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB71709F0B31193B0017123E /* SearchPopupMenuMac.mm */; };
     2284                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */; };
    22842285                ABB5419E0ACDDFE4002820EB /* RenderListBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */; };
    22852286                ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = ABB5419D0ACDDFE4002820EB /* RenderListBox.h */; };
     
    53905391                AB7170880B3118080017123E /* SearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenu.h; sourceTree = "<group>"; };
    53915392                AB71709F0B31193B0017123E /* SearchPopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchPopupMenuMac.mm; sourceTree = "<group>"; };
     5393                ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ChromeMac.mm; sourceTree = "<group>"; };
    53925394                ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderListBox.cpp; sourceTree = "<group>"; };
    53935395                ABB5419D0ACDDFE4002820EB /* RenderListBox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderListBox.h; sourceTree = "<group>"; };
     
    80898091                        isa = PBXGroup;
    80908092                        children = (
     8093                                ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */,
    80918094                                93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */,
    80928095                                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */,
     
    1273412737                                BC4918C80BFEA050009D6316 /* JSHTMLIFrameElement.cpp in Sources */,
    1273512738                                BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */,
     12739                                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */,
    1273612740                        );
    1273712741                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/page/Chrome.h

    r20856 r21649  
    2525#include <wtf/Forward.h>
    2626#include <wtf/RefPtr.h>
     27
     28#if PLATFORM(MAC)
     29#ifndef __OBJC__
     30class NSView;
     31#endif
     32#endif
    2733
    2834namespace WebCore {
     
    98104        void updateBackingStore();
    99105
     106#if PLATFORM(MAC)
     107        void focusNSView(NSView*);
     108#endif
    100109    private:
    101110        Page* m_page;
  • trunk/WebCore/page/mac/EventHandlerMac.mm

    r21555 r21649  
    151151void EventHandler::focusDocumentView()
    152152{
    153     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    154     if (FrameView* frameView = m_frame->view()) {
    155         if (NSView *documentView = frameView->getDocumentView()) {
    156             if ([m_frame->bridge() firstResponder] != documentView)
    157                 [m_frame->bridge() makeFirstResponder:documentView];
    158         }
    159     }
    160     END_BLOCK_OBJC_EXCEPTIONS;
    161     if (Page* page = m_frame->page())
    162         page->focusController()->setFocusedFrame(m_frame);
     153    Page* page = m_frame->page();
     154    if (!page)
     155        return;
     156
     157    if (FrameView* frameView = m_frame->view())
     158        if (NSView *documentView = frameView->getDocumentView())
     159            page->chrome()->focusNSView(documentView);
     160   
     161    page->focusController()->setFocusedFrame(m_frame);
    163162}
    164163
  • trunk/WebCore/platform/mac/WidgetMac.mm

    r21632 r21649  
    3333#import "Frame.h"
    3434#import "GraphicsContext.h"
     35#import "Page.h"
    3536#import "PlatformMouseEvent.h"
    3637#import "WebCoreFrameBridge.h"
     
    128129 
    129130    NSView *view = [getView() _webcore_effectiveFirstResponder];
    130     WebCoreFrameBridge *bridge = frame->bridge();
    131     id firstResponder = [bridge firstResponder];
    132     if (firstResponder && firstResponder == view)
    133         return;
    134 
    135     if (![view window] || ![view superview] || ![view acceptsFirstResponder])
    136         return;
    137 
    138     NSResponder *oldFirstResponder = [bridge firstResponder];
    139 
    140     [bridge makeFirstResponder:view];
    141 
    142     // Setting focus can actually cause a style change which might
    143     // remove the view from its superview while it's being made
    144     // first responder. This confuses AppKit so we must restore
    145     // the old first responder.
    146     if (![view superview])
    147         [bridge makeFirstResponder:oldFirstResponder];
    148 
     131    if (Page* page = frame->page())
     132        page->chrome()->focusNSView(view);
     133   
    149134    END_BLOCK_OBJC_EXCEPTIONS;
    150135}
Note: See TracChangeset for help on using the changeset viewer.