Changeset 29581 in webkit


Ignore:
Timestamp:
Jan 17, 2008 9:44:35 AM (16 years ago)
Author:
Adam Roben
Message:

Move focused/active state from Frame to SelectionController/FocusController

WebCore:

Move focused/active state from Frame to SelectionController/FocusController

This is the first part of <rdar://5006915> Inactive look for Aqua
controls.

The following methods were moved/renamed:

  • Frame::setIsActive -> FocusController::setActive
  • Frame::isActive -> SelectionController::isActiveAndFocused
  • Frame::setWindowHasFocus -> SelectionController::setFocused

Active state is now correctly a Page-level concept.

The Mac parts of this patch were written by Darin.

Reviewed by Darin.

All tests pass.

  • WebCore.base.exp: Updated for method renames.
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::checkOneSelector): Ditto.
  • editing/SelectionController.cpp: (WebCore::SelectionController::SelectionController): Initialize new member. (WebCore::SelectionController::focusedOrActiveStateChanged): New private method. Most of this code came from Frame::setIsActive. (WebCore::SelectionController::pageActivationChanged): Added. (WebCore::SelectionController::setFocused): Added. Replaces Frame::setWindowHasFocus. (WebCore::SelectionController::isFocusedAndActive): Added. Replaces Frame::isActive.
  • editing/SelectionController.h:
  • page/FocusController.cpp: (WebCore::FocusController::FocusController): Initialize new member. (WebCore::FocusController::setFocusedFrame): Changed to just call SelectionController::setFocused, since active state has doesn't change when the focused frame changes. (WebCore::FocusController::setActive): Added. Replaces Frame::setIsActive.
  • page/FocusController.h: (WebCore::FocusController::isActive): Added.
  • page/Frame.cpp: (WebCore::Frame::setDocument): Updated for method renames. (WebCore::Frame::setFocusedNodeIfNeeded): Ditto. (WebCore::Frame::updateSecureKeyboardEntryIfActive): Ditto. (WebCore::FramePrivate::FramePrivate): Removed initialization of removed members.
  • page/Frame.h:
  • page/FramePrivate.h:
  • page/mac/WebCoreFrameBridge.h: Removed -selectionColor.
  • page/mac/WebCoreFrameBridge.mm: Ditto.
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): Updated for method renames. (WebCore::RenderListBox::paintItemBackground): Ditto.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::selectionBackgroundColor): Ditto. (WebCore::RenderObject::selectionForegroundColor): Ditto.
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::capsLockStateMayHaveChanged): Ditto.
  • rendering/RenderTheme.cpp: (WebCore::RenderTheme::isFocused): Ditto.

WebKit/mac:

Updated for renames/removal of WebCore methods.

Reviewed by Darin.

  • Plugins/WebPluginController.mm: (-[WebPluginController webPlugInContainerSelectionColor]): Changed to ask isFocusedAndActive directly, instead of going through the frame bridge.
  • WebView/WebHTMLView.mm: (-[WebHTMLView _updateActiveState]): Updated for method renames.

WebKit/win:

Updated for changes to WebCore methods

Focus and active state are now handled (somewhat) separately. Future
patches will further separate these concepts.

Reviewed by Darin.

  • WebView.cpp: (WebViewWndProc): Updated for method renames. (WebView::updateActiveState): Only change the active state here. Focus is handled inside WM_SETFOCUS and WM_KILLFOCUS message handlers.

WebKit/wx:

Updated for WebCore method renames.

Reviewed by Darin.

  • WebView.cpp: (wxWebView::OnSetFocus): (wxWebView::OnKillFocus): (wxWebView::OnActivate):
Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r29579 r29581  
     12008-01-16  Adam Roben  <aroben@apple.com>
     2
     3        Move focused/active state from Frame to SelectionController/FocusController
     4
     5        This is the first part of <rdar://5006915> Inactive look for Aqua
     6        controls.
     7
     8        The following methods were moved/renamed:
     9            - Frame::setIsActive -> FocusController::setActive
     10            - Frame::isActive -> SelectionController::isActiveAndFocused
     11            - Frame::setWindowHasFocus -> SelectionController::setFocused
     12
     13        Active state is now correctly a Page-level concept.
     14
     15        The Mac parts of this patch were written by Darin.
     16
     17        Reviewed by Darin.
     18
     19        All tests pass.
     20
     21        * WebCore.base.exp: Updated for method renames.
     22        * css/CSSStyleSelector.cpp:
     23        (WebCore::CSSStyleSelector::checkOneSelector): Ditto.
     24        * editing/SelectionController.cpp:
     25        (WebCore::SelectionController::SelectionController): Initialize new
     26        member.
     27        (WebCore::SelectionController::focusedOrActiveStateChanged): New
     28        private method. Most of this code came from Frame::setIsActive.
     29        (WebCore::SelectionController::pageActivationChanged): Added.
     30        (WebCore::SelectionController::setFocused): Added. Replaces
     31        Frame::setWindowHasFocus.
     32        (WebCore::SelectionController::isFocusedAndActive): Added. Replaces
     33        Frame::isActive.
     34        * editing/SelectionController.h:
     35        * page/FocusController.cpp:
     36        (WebCore::FocusController::FocusController): Initialize new member.
     37        (WebCore::FocusController::setFocusedFrame): Changed to just call
     38        SelectionController::setFocused, since active state has doesn't change
     39        when the focused frame changes.
     40        (WebCore::FocusController::setActive): Added. Replaces
     41        Frame::setIsActive.
     42        * page/FocusController.h:
     43        (WebCore::FocusController::isActive): Added.
     44        * page/Frame.cpp:
     45        (WebCore::Frame::setDocument): Updated for method renames.
     46        (WebCore::Frame::setFocusedNodeIfNeeded): Ditto.
     47        (WebCore::Frame::updateSecureKeyboardEntryIfActive): Ditto.
     48        (WebCore::FramePrivate::FramePrivate): Removed initialization of
     49        removed members.
     50        * page/Frame.h:
     51        * page/FramePrivate.h:
     52        * page/mac/WebCoreFrameBridge.h: Removed -selectionColor.
     53        * page/mac/WebCoreFrameBridge.mm: Ditto.
     54        * rendering/RenderListBox.cpp:
     55        (WebCore::RenderListBox::paintItemForeground): Updated for method
     56        renames.
     57        (WebCore::RenderListBox::paintItemBackground): Ditto.
     58        * rendering/RenderObject.cpp:
     59        (WebCore::RenderObject::selectionBackgroundColor): Ditto.
     60        (WebCore::RenderObject::selectionForegroundColor): Ditto.
     61        * rendering/RenderTextControl.cpp:
     62        (WebCore::RenderTextControl::capsLockStateMayHaveChanged): Ditto.
     63        * rendering/RenderTheme.cpp:
     64        (WebCore::RenderTheme::isFocused): Ditto.
     65
    1662008-01-17  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
    267
  • trunk/WebCore/WebCore.base.exp

    r29492 r29581  
    309309__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
    310310__ZN7WebCore15FocusController18focusedOrMainFrameEv
     311__ZN7WebCore15FocusController9setActiveEb
    311312__ZN7WebCore15StringTruncator13rightTruncateERKNS_6StringEfRKNS_4FontEb
    312313__ZN7WebCore15StringTruncator14centerTruncateERKNS_6StringEfRKNS_4FontEb
     
    342343__ZN7WebCore19InspectorController5closeEv
    343344__ZN7WebCore19InspectorController7inspectEPNS_4NodeE
     345__ZN7WebCore19SelectionController10setFocusedEb
    344346__ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEb
    345347__ZN7WebCore19SelectionController5clearEv
     
    389391__ZN7WebCore5Cache13setCapacitiesEjjj
    390392__ZN7WebCore5Frame11scriptProxyEv
    391 __ZN7WebCore5Frame11setIsActiveEb
    392393__ZN7WebCore5Frame11shouldCloseEv
    393394__ZN7WebCore5Frame17bindingRootObjectEv
    394 __ZN7WebCore5Frame17setWindowHasFocusEb
    395395__ZN7WebCore5Frame18windowScriptObjectEv
    396396__ZN7WebCore5Frame20setSelectionFromNoneEv
     
    624624__ZNK7WebCore19ResourceRequestBase7isEmptyEv
    625625__ZNK7WebCore19SelectionController17isInPasswordFieldEv
     626__ZNK7WebCore19SelectionController18isFocusedAndActiveEv
    626627__ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
    627628__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r29502 r29581  
    6060#include "Rect.h"
    6161#include "RenderTheme.h"
     62#include "SelectionController.h"
    6263#include "Settings.h"
    6364#include "ShadowValue.h"
     
    16391640            }
    16401641            case CSSSelector::PseudoFocus:
    1641                 if (e && e->focused() && e->document()->frame()->isActive())
     1642                if (e && e->focused() && e->document()->frame()->selectionController()->isFocusedAndActive())
    16421643                    return true;
    16431644                break;
  • trunk/WebCore/editing/SelectionController.cpp

    r28523 r29581  
    3131#include "Editor.h"
    3232#include "Element.h"
     33#include "EventHandler.h"
    3334#include "EventNames.h"
    3435#include "ExceptionCode.h"
     
    4445#include "Page.h"
    4546#include "Range.h"
     47#include "RenderTheme.h"
    4648#include "RenderView.h"
    4749#include "TextIterator.h"
     
    6668    , m_isCaretBlinkingSuspended(false)
    6769    , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation)
     70    , m_focused(false)
    6871{
    6972}
     
    10201023    return !isTableElement(startNode) && !editingIgnoresContent(startNode);
    10211024}
     1025
     1026void SelectionController::focusedOrActiveStateChanged()
     1027{
     1028    bool activeAndFocused = isFocusedAndActive();
     1029
     1030    // Because RenderObject::selectionBackgroundColor() and
     1031    // RenderObject::selectionForegroundColor() check if the frame is active,
     1032    // we have to update places those colors were painted.
     1033    if (m_frame->view())
     1034        m_frame->view()->updateContents(enclosingIntRect(m_frame->selectionRect()));
     1035
     1036    // Caret appears in the active frame.
     1037    if (activeAndFocused)
     1038        m_frame->setSelectionFromNone();
     1039    m_frame->setCaretVisible(activeAndFocused);
     1040
     1041    // Update for caps lock state
     1042    m_frame->eventHandler()->capsLockStateMayHaveChanged();
     1043
     1044    // Because CSSStyleSelector::checkOneSelector() and
     1045    // RenderTheme::isFocused() check if the frame is active, we have to
     1046    // update style and theme state that depended on those.
     1047    if (Node* node = m_frame->document()->focusedNode()) {
     1048        node->setChanged();
     1049        if (RenderObject* renderer = node->renderer())
     1050            if (renderer && renderer->style()->hasAppearance())
     1051                theme()->stateChanged(renderer, FocusState);
     1052    }
     1053
     1054    // Secure keyboard entry is set by the active frame.
     1055    if (m_frame->document()->useSecureKeyboardEntryWhenActive())
     1056        m_frame->setUseSecureKeyboardEntry(activeAndFocused);
     1057}
     1058
     1059void SelectionController::pageActivationChanged()
     1060{
     1061    focusedOrActiveStateChanged();
     1062}
     1063
     1064void SelectionController::setFocused(bool flag)
     1065{
     1066    if (m_focused == flag)
     1067        return;
     1068    m_focused = flag;
     1069
     1070    focusedOrActiveStateChanged();
     1071
     1072    if (Document* doc = m_frame->document())
     1073        doc->dispatchWindowEvent(flag ? focusEvent : blurEvent, false, false);
     1074}
     1075
     1076bool SelectionController::isFocusedAndActive() const
     1077{
     1078    return m_focused && m_frame->page() && m_frame->page()->focusController()->isActive();
     1079}
    10221080 
    10231081#ifndef NDEBUG
  • trunk/WebCore/editing/SelectionController.h

    r27744 r29581  
    112112    bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; }
    113113
     114    // Focus
     115    void setFocused(bool);
     116    bool isFocusedAndActive() const;
     117    void pageActivationChanged();
     118
    114119#ifndef NDEBUG
    115120    void formatForDebugger(char* buffer, unsigned length) const;
     
    136141#endif
    137142
     143    void focusedOrActiveStateChanged();
     144
    138145    Selection m_sel;
    139146
     
    153160   
    154161    int m_xPosForVerticalArrowNavigation;
     162    bool m_focused;
    155163};
    156164
  • trunk/WebCore/page/FocusController.cpp

    r29348 r29581  
    5757FocusController::FocusController(Page* page)
    5858    : m_page(page)
     59    , m_isActive(false)
    5960{
    6061}
     
    6566        return;
    6667
    67     if (m_focusedFrame) {
    68         m_focusedFrame->setWindowHasFocus(false);
    69         m_focusedFrame->setIsActive(false);
    70     }
     68    if (m_focusedFrame)
     69        m_focusedFrame->selectionController()->setFocused(false);
    7170
    7271    m_focusedFrame = frame;
    7372
    74     if (m_focusedFrame) {
    75         m_focusedFrame->setWindowHasFocus(true);
    76         m_focusedFrame->setIsActive(true);
    77     }
     73    if (m_focusedFrame)
     74        m_focusedFrame->selectionController()->setFocused(true);
    7875}
    7976
     
    293290}
    294291
     292void FocusController::setActive(bool active)
     293{
     294    if (m_isActive == active)
     295        return;
     296
     297    m_isActive = active;
     298
     299    if (Frame* frame = focusedFrame())
     300        frame->selectionController()->pageActivationChanged();
     301}
     302
    295303} // namespace WebCore
  • trunk/WebCore/page/FocusController.h

    r29348 r29581  
    5151        bool setFocusedNode(Node*, PassRefPtr<Frame>);
    5252
     53        void setActive(bool);
     54        bool isActive() const { return m_isActive; }
     55
    5356    private:
    5457        Page* m_page;
    5558        RefPtr<Frame> m_focusedFrame;
     59        bool m_isActive;
    5660    };
    5761
  • trunk/WebCore/page/Frame.cpp

    r29344 r29581  
    276276
    277277    d->m_doc = newDoc;
    278     if (d->m_doc && d->m_isActive)
     278    if (d->m_doc && selectionController()->isFocusedAndActive())
    279279        setUseSecureKeyboardEntry(d->m_doc->useSecureKeyboardEntryWhenActive());
    280280       
     
    586586void Frame::setFocusedNodeIfNeeded()
    587587{
    588     if (!document() || selectionController()->isNone() || !d->m_isActive)
     588    if (!document() || selectionController()->isNone() || !selectionController()->isFocusedAndActive())
    589589        return;
    590590
     
    833833void Frame::updateSecureKeyboardEntryIfActive()
    834834{
    835     if (d->m_isActive)
     835    if (selectionController()->isFocusedAndActive())
    836836        setUseSecureKeyboardEntry(d->m_doc->useSecureKeyboardEntryWhenActive());
    837837}
     
    15361536}
    15371537
    1538 bool Frame::isActive() const
    1539 {
    1540     return d->m_isActive;
    1541 }
    1542 
    1543 void Frame::setIsActive(bool flag)
    1544 {
    1545     if (d->m_isActive == flag)
    1546         return;
    1547     d->m_isActive = flag;
    1548 
    1549     // Because RenderObject::selectionBackgroundColor() and
    1550     // RenderObject::selectionForegroundColor() check if the frame is active,
    1551     // we have to update places those colors were painted.
    1552     if (d->m_view)
    1553         d->m_view->updateContents(enclosingIntRect(selectionRect()));
    1554 
    1555     // Caret appears in the active frame.
    1556     if (flag)
    1557         setSelectionFromNone();
    1558     setCaretVisible(flag);
    1559 
    1560     // Update for caps lock state
    1561     eventHandler()->capsLockStateMayHaveChanged();
    1562 
    1563     // Because CSSStyleSelector::checkOneSelector() and
    1564     // RenderTheme::isFocused() check if the frame is active, we have to
    1565     // update style and theme state that depended on those.
    1566     if (d->m_doc) {
    1567         if (Node* node = d->m_doc->focusedNode()) {
    1568             node->setChanged();
    1569             if (RenderObject* renderer = node->renderer())
    1570                 if (renderer && renderer->style()->hasAppearance())
    1571                     theme()->stateChanged(renderer, FocusState);
    1572         }
    1573     }
    1574 
    1575     // Secure keyboard entry is set by the active frame.
    1576     if (d->m_doc->useSecureKeyboardEntryWhenActive())
    1577         setUseSecureKeyboardEntry(flag);
    1578 }
    1579 
    1580 void Frame::setWindowHasFocus(bool flag)
    1581 {
    1582     if (d->m_windowHasFocus == flag)
    1583         return;
    1584     d->m_windowHasFocus = flag;
    1585    
    1586     if (Document *doc = document())
    1587         doc->dispatchWindowEvent(flag ? focusEvent : blurEvent, false, false);
    1588 }
    1589 
    15901538bool Frame::inViewSourceMode() const
    15911539{
     
    19531901    , m_caretVisible(false)
    19541902    , m_caretPaint(true)
    1955     , m_isActive(false)
    19561903    , m_isPainting(false)
    19571904    , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired)
     
    19601907    , m_paintRestriction(PaintRestrictionNone)
    19611908    , m_highlightTextMatches(false)
    1962     , m_windowHasFocus(false)
    19631909    , m_inViewSourceMode(false)
    19641910    , frameCount(0)
  • trunk/WebCore/page/Frame.h

    r28626 r29581  
    190190    static void clearTimers(FrameView*);
    191191
    192     bool isActive() const;
    193     void setIsActive(bool flag);
    194 
    195192    // Convenience, to avoid repeating the code to dig down to get this.
    196193    UChar backslashAsCurrencySymbol() const;
     
    225222    void sendResizeEvent();
    226223    void sendScrollEvent();
    227 
    228     void setWindowHasFocus(bool flag);
    229224
    230225// === to be moved into FrameView
     
    338333    void setSelectionFromNone();
    339334
     335    void setUseSecureKeyboardEntry(bool);
     336
    340337private:
    341338    void caretBlinkTimerFired(Timer<Frame>*);
    342     void setUseSecureKeyboardEntry(bool);
    343339
    344340public:
  • trunk/WebCore/page/FramePrivate.h

    r28411 r29581  
    9595        bool m_caretVisible : 1;
    9696        bool m_caretPaint : 1;
    97         bool m_isActive : 1;
    9897        bool m_isPainting : 1;
    9998
     
    110109       
    111110        bool m_highlightTextMatches;
    112         bool m_windowHasFocus;
    113111       
    114112        bool m_inViewSourceMode;
  • trunk/WebCore/page/mac/WebCoreFrameBridge.h

    r28717 r29581  
    172172- (void)setDrawsBackground:(BOOL)drawsBackround;
    173173
    174 - (NSColor *)selectionColor;
    175 
    176174- (id)accessibilityTree;
    177175
  • trunk/WebCore/page/mac/WebCoreFrameBridge.mm

    r29250 r29581  
    785785}
    786786
    787 - (NSColor *)selectionColor
    788 {
    789     return m_frame->isActive() ? [NSColor selectedTextBackgroundColor] : [NSColor secondarySelectedControlColor];
    790 }
    791 
    792787- (id)accessibilityTree
    793788{
  • trunk/WebCore/rendering/RenderListBox.cpp

    r28298 r29581  
    4747#include "RenderTheme.h"
    4848#include "RenderView.h"
     49#include "SelectionController.h"
    4950#include <math.h>
    5051
     
    317318    Color textColor = element->renderStyle() ? element->renderStyle()->color() : style()->color();
    318319    if (element->hasTagName(optionTag) && static_cast<HTMLOptionElement*>(element)->selected()) {
    319         if (document()->frame()->isActive() && document()->focusedNode() == node())
     320        if (document()->frame()->selectionController()->isFocusedAndActive() && document()->focusedNode() == node())
    320321            textColor = theme()->activeListBoxSelectionForegroundColor();
    321322        // Honor the foreground color for disabled items
     
    352353    Color backColor;
    353354    if (element->hasTagName(optionTag) && static_cast<HTMLOptionElement*>(element)->selected()) {
    354         if (document()->frame()->isActive() && document()->focusedNode() == node())
     355        if (document()->frame()->selectionController()->isFocusedAndActive() && document()->focusedNode() == node())
    355356            backColor = theme()->activeListBoxSelectionBackgroundColor();
    356357        else
  • trunk/WebCore/rendering/RenderObject.cpp

    r29553 r29581  
    6060#include "RenderTheme.h"
    6161#include "RenderView.h"
     62#include "SelectionController.h"
    6263#include "TextResourceDecoder.h"
    6364#include "TextStream.h"
     
    20392040            color = pseudoStyle->backgroundColor().blendWithWhite();
    20402041        else
    2041             color = document()->frame()->isActive() ?
     2042            color = document()->frame()->selectionController()->isFocusedAndActive() ?
    20422043                    theme()->activeSelectionBackgroundColor() :
    20432044                    theme()->inactiveSelectionBackgroundColor();
     
    20572058                color = pseudoStyle->color();
    20582059        } else
    2059             color = document()->frame()->isActive() ?
     2060            color = document()->frame()->selectionController()->isFocusedAndActive() ?
    20602061                    theme()->platformActiveSelectionForegroundColor() :
    20612062                    theme()->platformInactiveSelectionForegroundColor();
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r28447 r29581  
    12321232            if (Frame* f = d->frame())
    12331233                shouldDrawCapsLockIndicator = !m_multiLine && static_cast<HTMLInputElement*>(n)->inputType() == HTMLInputElement::PASSWORD &&
    1234                                                f->isActive() && d->focusedNode() == n && PlatformKeyboardEvent::currentCapsLockState();
     1234                                               f->selectionController()->isFocusedAndActive() && d->focusedNode() == n && PlatformKeyboardEvent::currentCapsLockState();
    12351235
    12361236    if (shouldDrawCapsLockIndicator != m_shouldDrawCapsLockIndicator) {
  • trunk/WebCore/rendering/RenderTheme.cpp

    r29492 r29581  
    3030#include "HTMLNames.h"
    3131#include "RenderStyle.h"
     32#include "SelectionController.h"
    3233
    3334// The methods in this file are shared by all themes on every platform.
     
    378379    Document* document = node->document();
    379380    Frame* frame = document->frame();
    380     return node == document->focusedNode() && frame && frame->isActive();
     381    return node == document->focusedNode() && frame && frame->selectionController()->isFocusedAndActive();
    381382}
    382383
  • trunk/WebKit/mac/ChangeLog

    r29543 r29581  
     12008-01-16  Adam Roben  <aroben@apple.com>
     2
     3        Updated for renames/removal of WebCore methods.
     4
     5        Reviewed by Darin.
     6
     7        * Plugins/WebPluginController.mm:
     8        (-[WebPluginController webPlugInContainerSelectionColor]): Changed to
     9        ask isFocusedAndActive directly, instead of going through the frame
     10        bridge.
     11        * WebView/WebHTMLView.mm:
     12        (-[WebHTMLView _updateActiveState]): Updated for method renames.
     13
    1142008-01-16  John Sullivan  <sullivan@apple.com>
    215
  • trunk/WebKit/mac/Plugins/WebPluginController.mm

    r24915 r29581  
    364364- (NSColor *)webPlugInContainerSelectionColor
    365365{
    366     return [[_dataSource _bridge] selectionColor];
     366    bool primary = true;
     367    if (Frame* frame = core([self webFrame]))
     368        primary = frame->selectionController()->isFocusedAndActive();
     369    return primary ? [NSColor selectedTextBackgroundColor] : [NSColor secondarySelectedControlColor];
    367370}
    368371
  • trunk/WebKit/mac/WebView/WebHTMLView.mm

    r29543 r29581  
    17281728
    17291729    BOOL isActive = !_private->resigningFirstResponder && windowIsKey && [self _web_firstResponderCausesFocusDisplay];
    1730     frame->setIsActive(isActive);           
     1730    page->focusController()->setActive(isActive);
    17311731
    17321732    Frame* focusedFrame = page->focusController()->focusedOrMainFrame();
    1733     frame->setWindowHasFocus(frame == focusedFrame && windowOrSheetIsKey);
     1733    frame->selectionController()->setFocused(frame == focusedFrame && windowOrSheetIsKey);
    17341734}
    17351735
  • trunk/WebKit/win/ChangeLog

    r29551 r29581  
     12008-01-16  Adam Roben  <aroben@apple.com>
     2
     3        Updated for changes to WebCore methods
     4
     5        Focus and active state are now handled (somewhat) separately. Future
     6        patches will further separate these concepts.
     7
     8        Reviewed by Darin.
     9
     10        * WebView.cpp:
     11        (WebViewWndProc): Updated for method renames.
     12        (WebView::updateActiveState): Only change the active state here. Focus
     13        is handled inside WM_SETFOCUS and WM_KILLFOCUS message handlers.
     14
    1152008-01-16  Steve Falkenburg  <sfalken@apple.com>
    216
  • trunk/WebKit/win/WebView.cpp

    r29551 r29581  
    16621662            // FIXME: Merge this logic with updateActiveState, and switch this over to use updateActiveState
    16631663
     1664            webView->page()->focusController()->setActive(true);
     1665
    16641666            // It's ok to just always do setWindowHasFocus, since we won't fire the focus event on the DOM
    16651667            // window unless the value changes.  It's also ok to do setIsActive inside focus,
     
    16681670            FocusController* focusController = webView->page()->focusController();
    16691671            if (Frame* frame = focusController->focusedFrame()) {
    1670                 frame->setIsActive(true);
    1671 
    16721672                // If the previously focused window is a child of ours (for example a plugin), don't send any
    16731673                // focus events.
    16741674                if (!IsChild(hWnd, reinterpret_cast<HWND>(wParam)))
    1675                     frame->setWindowHasFocus(true);
     1675                    frame->selectionController()->setFocused(true);
    16761676            } else
    16771677                focusController->setFocusedFrame(webView->page()->mainFrame());
     
    16941694            webView->resetIME(focusController->focusedOrMainFrame());
    16951695            if (GetAncestor(hWnd, GA_ROOT) != newFocusWnd) {
     1696                webView->page()->focusController()->setActive(false);
    16961697                if (Frame* frame = focusController->focusedOrMainFrame()) {
    1697                     frame->setIsActive(false);
    1698 
    16991698                    // If we're losing focus to a child of ours, don't send blur events.
    17001699                    if (!IsChild(hWnd, newFocusWnd))
    1701                         frame->setWindowHasFocus(false);
     1700                        frame->selectionController()->setFocused(false);
    17021701                }
    17031702            } else
     
    26652664HRESULT STDMETHODCALLTYPE WebView::updateActiveState()
    26662665{
    2667     Frame* frame = m_page->mainFrame();
    2668 
    26692666    HWND window = ::GetAncestor(m_viewWindow, GA_ROOT);
    26702667    HWND activeWindow = ::GetActiveWindow();
     
    26742671    bool windowOrSheetIsKey = windowIsKey || (window == activeWindow);
    26752672
    2676     frame->setIsActive(windowIsKey);           
    2677 
    2678     Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
    2679     frame->setWindowHasFocus(frame == focusedFrame && windowOrSheetIsKey);
     2673    m_page->focusController()->setActive(windowOrSheetIsKey);
    26802674
    26812675    return S_OK;
  • trunk/WebKit/wx/ChangeLog

    r29453 r29581  
     12008-01-16  Adam Roben  <aroben@apple.com>
     2
     3        Updated for WebCore method renames.
     4
     5        Reviewed by Darin.
     6
     7        * WebView.cpp:
     8        (wxWebView::OnSetFocus):
     9        (wxWebView::OnKillFocus):
     10        (wxWebView::OnActivate):
     11
    1122008-01-12  Kevin Ollivier  <kevino@theolliviers.com>
    213
  • trunk/WebKit/wx/WebView.cpp

    r29453 r29581  
    3030#include "Editor.h"
    3131#include "EventHandler.h"
     32#include "FocusController.h"
    3233#include "Frame.h"
    3334#include "FrameLoader.h"
     
    4445#include "RenderObject.h"
    4546#include "RenderTreeAsText.h"
     47#include "SelectionController.h"
    4648#include "Settings.h"
    4749
     
    557559{
    558560    if (m_impl->frame) {
    559         m_impl->frame->setWindowHasFocus(true);
     561        m_impl->frame->selectionController()->setFocused(true);
    560562    }
    561563    event.Skip();
     
    565567{
    566568    if (m_impl->frame) {
    567         m_impl->frame->setWindowHasFocus(false);
     569        m_impl->frame->selectionController()->setFocused(false);
    568570    }
    569571    event.Skip();
     
    572574void wxWebView::OnActivate(wxActivateEvent& event)
    573575{
    574     if (m_impl->frame) {
    575         m_impl->frame->setIsActive(event.GetActive());
     576    if (m_impl->page) {
     577        m_impl->page->focusController()->setActive(event.GetActive());
    576578    }
    577579    event.Skip();
Note: See TracChangeset for help on using the changeset viewer.