Changeset 215872 in webkit


Ignore:
Timestamp:
Apr 27, 2017, 9:42:13 AM (8 years ago)
Author:
achristensen@apple.com
Message:

Modernize Frame.h
https://bugs.webkit.org/show_bug.cgi?id=171357

Reviewed by Andy Estes.

Source/WebCore:

Frame.h has several std::unique_ptrs that are created in the constructor, never null,
and destroyed in the destructor. This is what WTF::UniqueRef is for, and using UniqueRef
allows us to not check for null values because a UniqueRef can never be null.
An interesting case was the EventHandler, which we explicitly set to nullptr in the destructor
of MainFrame, a subclass of Frame. We added this in r199181 to fix a crash tested by
fast/events/wheel-event-destroys-frame.html and this improved lifetime also does not crash
or assert in that test.

Using UniqueRef also requires const correctness, which this patch adds when necessary.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::dispatchTouchEvent):

  • editing/DeleteSelectionCommand.cpp:

(WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete):

  • editing/Editor.cpp:

(WebCore::Editor::isSelectTrailingWhitespaceEnabled):
(WebCore::Editor::computeAndSetTypingStyle):

  • editing/Editor.h:
  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::contains):
(WebCore::FrameSelection::copyTypingStyle):

  • editing/FrameSelection.h:

(WebCore::FrameSelection::setTypingStyle):

  • loader/EmptyClients.cpp:
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::clear):

  • page/EditorClient.h:
  • page/EventHandler.cpp:

(WebCore::EventHandler::hitTestResultAtPoint):

  • page/EventHandler.h:
  • page/Frame.cpp:

(WebCore::Frame::Frame):
(WebCore::Frame::setView):
(WebCore::Frame::injectUserScripts):

  • page/Frame.h:

(WebCore::Frame::editor):
(WebCore::Frame::eventHandler):
(WebCore::Frame::selection):
(WebCore::Frame::animation):
(WebCore::Frame::script):
(WebCore::Frame::eventHandlerPtr): Deleted.

  • page/MainFrame.cpp:

(WebCore::MainFrame::~MainFrame):

  • replay/UserInputBridge.cpp:

(WebCore::UserInputBridge::handleContextMenuEvent):

  • replay/UserInputBridge.h:

Source/WebKit/mac:

  • WebCoreSupport/WebEditorClient.h:
  • WebCoreSupport/WebEditorClient.mm:

(WebEditorClient::isSelectTrailingWhitespaceEnabled):

Source/WebKit/win:

  • WebCoreSupport/WebEditorClient.cpp:

(WebEditorClient::isSelectTrailingWhitespaceEnabled):

  • WebCoreSupport/WebEditorClient.h:

Source/WebKit2:

  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::WebEditorClient::isSelectTrailingWhitespaceEnabled):

  • WebProcess/WebCoreSupport/WebEditorClient.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::contextMenuAtPointInWindow):
(WebKit::handleContextMenuEvent):
(WebKit::WebPage::isSelectTrailingWhitespaceEnabled):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::rangeForGranularityAtPoint):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):

Location:
trunk/Source
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215870 r215872  
     12017-04-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Modernize Frame.h
     4        https://bugs.webkit.org/show_bug.cgi?id=171357
     5
     6        Reviewed by Andy Estes.
     7
     8        Frame.h has several std::unique_ptrs that are created in the constructor, never null,
     9        and destroyed in the destructor.  This is what WTF::UniqueRef is for, and using UniqueRef
     10        allows us to not check for null values because a UniqueRef can never be null.
     11        An interesting case was the EventHandler, which we explicitly set to nullptr in the destructor
     12        of MainFrame, a subclass of Frame.  We added this in r199181 to fix a crash tested by
     13        fast/events/wheel-event-destroys-frame.html and this improved lifetime also does not crash
     14        or assert in that test.
     15
     16        Using UniqueRef also requires const correctness, which this patch adds when necessary.
     17
     18        * accessibility/AccessibilityObject.cpp:
     19        (WebCore::AccessibilityObject::dispatchTouchEvent):
     20        * editing/DeleteSelectionCommand.cpp:
     21        (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
     22        * editing/Editor.cpp:
     23        (WebCore::Editor::isSelectTrailingWhitespaceEnabled):
     24        (WebCore::Editor::computeAndSetTypingStyle):
     25        * editing/Editor.h:
     26        * editing/FrameSelection.cpp:
     27        (WebCore::FrameSelection::contains):
     28        (WebCore::FrameSelection::copyTypingStyle):
     29        * editing/FrameSelection.h:
     30        (WebCore::FrameSelection::setTypingStyle):
     31        * loader/EmptyClients.cpp:
     32        * loader/FrameLoader.cpp:
     33        (WebCore::FrameLoader::clear):
     34        * page/EditorClient.h:
     35        * page/EventHandler.cpp:
     36        (WebCore::EventHandler::hitTestResultAtPoint):
     37        * page/EventHandler.h:
     38        * page/Frame.cpp:
     39        (WebCore::Frame::Frame):
     40        (WebCore::Frame::setView):
     41        (WebCore::Frame::injectUserScripts):
     42        * page/Frame.h:
     43        (WebCore::Frame::editor):
     44        (WebCore::Frame::eventHandler):
     45        (WebCore::Frame::selection):
     46        (WebCore::Frame::animation):
     47        (WebCore::Frame::script):
     48        (WebCore::Frame::eventHandlerPtr): Deleted.
     49        * page/MainFrame.cpp:
     50        (WebCore::MainFrame::~MainFrame):
     51        * replay/UserInputBridge.cpp:
     52        (WebCore::UserInputBridge::handleContextMenuEvent):
     53        * replay/UserInputBridge.h:
     54
    1552017-04-27  Andy Estes  <aestes@apple.com>
    256
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r215837 r215872  
    952952bool AccessibilityObject::dispatchTouchEvent()
    953953{
    954     bool handled = false;
    955954#if ENABLE(IOS_TOUCH_EVENTS)
    956     MainFrame* frame = mainFrame();
    957     if (!frame)
    958         return false;
    959 
    960     handled = frame->eventHandler().dispatchSimulatedTouchEvent(clickPoint());
     955    if (auto* frame = mainFrame())
     956        return frame->eventHandler().dispatchSimulatedTouchEvent(clickPoint());
    961957#endif
    962     return handled;
     958    return false;
    963959}
    964960
  • trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp

    r213355 r215872  
    764764    // but, if we change the selection, come back and start typing that style should be lost.  Also see
    765765    // preserveTypingStyle() below.
    766     frame().selection().setTypingStyle(m_typingStyle);
     766    frame().selection().setTypingStyle(m_typingStyle.copyRef());
    767767}
    768768
  • trunk/Source/WebCore/editing/Editor.cpp

    r215160 r215872  
    362362}
    363363
    364 bool Editor::isSelectTrailingWhitespaceEnabled()
     364bool Editor::isSelectTrailingWhitespaceEnabled() const
    365365{
    366366    return client() && client()->isSelectTrailingWhitespaceEnabled();
     
    30423042
    30433043    // Set the remaining style as the typing style.
    3044     m_frame.selection().setTypingStyle(typingStyle);
     3044    m_frame.selection().setTypingStyle(WTFMove(typingStyle));
    30453045}
    30463046
  • trunk/Source/WebCore/editing/Editor.h

    r213902 r215872  
    313313    // mutually exclusive, meaning that enabling one will disable the other.
    314314    bool smartInsertDeleteEnabled();
    315     bool isSelectTrailingWhitespaceEnabled();
     315    bool isSelectTrailingWhitespaceEnabled() const;
    316316   
    317317    WEBCORE_EXPORT bool hasBidiSelection() const;
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r215167 r215872  
    18141814}
    18151815
    1816 bool FrameSelection::contains(const LayoutPoint& point)
     1816bool FrameSelection::contains(const LayoutPoint& point) const
    18171817{
    18181818    // Treat a collapsed selection like no selection.
     
    22022202}
    22032203
    2204 PassRefPtr<MutableStyleProperties> FrameSelection::copyTypingStyle() const
     2204RefPtr<MutableStyleProperties> FrameSelection::copyTypingStyle() const
    22052205{
    22062206    if (!m_typingStyle || !m_typingStyle->style())
    2207         return 0;
     2207        return nullptr;
    22082208    return m_typingStyle->style()->mutableCopy();
    22092209}
     
    24292429}
    24302430
    2431 PassRefPtr<Range> FrameSelection::elementRangeContainingCaretSelection() const
     2431RefPtr<Range> FrameSelection::elementRangeContainingCaretSelection() const
    24322432{
    24332433    if (m_selection.isNone())
     
    24682468}
    24692469
    2470 PassRefPtr<Range> FrameSelection::wordRangeContainingCaretSelection()
     2470RefPtr<Range> FrameSelection::wordRangeContainingCaretSelection()
    24712471{
    24722472    return wordSelectionContainingCaretSelection(m_selection).toNormalizedRange();
     
    26202620}
    26212621
    2622 PassRefPtr<Range> FrameSelection::rangeByMovingCurrentSelection(int amount) const
     2622RefPtr<Range> FrameSelection::rangeByMovingCurrentSelection(int amount) const
    26232623{
    26242624    return rangeByAlteringCurrentSelection(AlterationMove, amount);
    26252625}
    26262626
    2627 PassRefPtr<Range> FrameSelection::rangeByExtendingCurrentSelection(int amount) const
     2627RefPtr<Range> FrameSelection::rangeByExtendingCurrentSelection(int amount) const
    26282628{
    26292629    return rangeByAlteringCurrentSelection(AlterationExtend, amount);
     
    27862786}
    27872787
    2788 PassRefPtr<Range> FrameSelection::rangeByAlteringCurrentSelection(EAlteration alteration, int amount) const
     2788RefPtr<Range> FrameSelection::rangeByAlteringCurrentSelection(EAlteration alteration, int amount) const
    27892789{
    27902790    if (m_selection.isNone())
  • trunk/Source/WebCore/editing/FrameSelection.h

    r215724 r215872  
    154154    void setNeedsSelectionUpdate();
    155155
    156     bool contains(const LayoutPoint&);
     156    bool contains(const LayoutPoint&) const;
    157157
    158158    WEBCORE_EXPORT bool modify(EAlteration, SelectionDirection, TextGranularity, EUserTriggered = NotUserTriggered);
     
    216216public:
    217217    WEBCORE_EXPORT void expandSelectionToElementContainingCaretSelection();
    218     WEBCORE_EXPORT PassRefPtr<Range> elementRangeContainingCaretSelection() const;
     218    WEBCORE_EXPORT RefPtr<Range> elementRangeContainingCaretSelection() const;
    219219    WEBCORE_EXPORT void expandSelectionToWordContainingCaretSelection();
    220     WEBCORE_EXPORT PassRefPtr<Range> wordRangeContainingCaretSelection();
     220    WEBCORE_EXPORT RefPtr<Range> wordRangeContainingCaretSelection();
    221221    WEBCORE_EXPORT void expandSelectionToStartOfWordContainingCaretSelection();
    222222    WEBCORE_EXPORT UChar characterInRelationToCaretSelection(int amount) const;
     
    228228    WEBCORE_EXPORT bool selectionAtSentenceStart() const;
    229229    WEBCORE_EXPORT bool selectionAtWordStart() const;
    230     WEBCORE_EXPORT PassRefPtr<Range> rangeByMovingCurrentSelection(int amount) const;
    231     WEBCORE_EXPORT PassRefPtr<Range> rangeByExtendingCurrentSelection(int amount) const;
     230    WEBCORE_EXPORT RefPtr<Range> rangeByMovingCurrentSelection(int amount) const;
     231    WEBCORE_EXPORT RefPtr<Range> rangeByExtendingCurrentSelection(int amount) const;
    232232    WEBCORE_EXPORT void selectRangeOnElement(unsigned location, unsigned length, Node&);
    233233    WEBCORE_EXPORT void clearCurrentSelection();
     
    244244private:
    245245    bool actualSelectionAtSentenceStart(const VisibleSelection&) const;
    246     PassRefPtr<Range> rangeByAlteringCurrentSelection(EAlteration, int amount) const;
     246    RefPtr<Range> rangeByAlteringCurrentSelection(EAlteration, int amount) const;
    247247public:
    248248#endif
     
    254254
    255255    EditingStyle* typingStyle() const;
    256     WEBCORE_EXPORT PassRefPtr<MutableStyleProperties> copyTypingStyle() const;
    257     void setTypingStyle(PassRefPtr<EditingStyle>);
     256    WEBCORE_EXPORT RefPtr<MutableStyleProperties> copyTypingStyle() const;
     257    void setTypingStyle(RefPtr<EditingStyle>&& style) { m_typingStyle = WTFMove(style); }
    258258    void clearTypingStyle();
    259259
     
    365365}
    366366
    367 inline void FrameSelection::setTypingStyle(PassRefPtr<EditingStyle> style)
    368 {
    369     m_typingStyle = style;
    370 }
    371 
    372367#if !(PLATFORM(COCOA) || PLATFORM(GTK))
    373368#if HAVE(ACCESSIBILITY)
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r215831 r215872  
    147147    bool shouldDeleteRange(Range*) final { return false; }
    148148    bool smartInsertDeleteEnabled() final { return false; }
    149     bool isSelectTrailingWhitespaceEnabled() final { return false; }
     149    bool isSelectTrailingWhitespaceEnabled() const final { return false; }
    150150    bool isContinuousSpellCheckingEnabled() final { return false; }
    151151    void toggleContinuousSpellChecking() final { }
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r215816 r215872  
    628628
    629629    m_frame.selection().prepareForDestruction();
    630 
    631     // We may call this code during object destruction, so need to make sure eventHandler is present.
    632     if (auto eventHandler = m_frame.eventHandlerPtr())
    633         eventHandler->clear();
     630    m_frame.eventHandler().clear();
    634631
    635632    if (clearFrameView && m_frame.view())
  • trunk/Source/WebCore/page/EditorClient.h

    r210845 r215872  
    7171    virtual bool shouldDeleteRange(Range*) = 0;
    7272    virtual bool smartInsertDeleteEnabled() = 0;
    73     virtual bool isSelectTrailingWhitespaceEnabled() = 0;
     73    virtual bool isSelectTrailingWhitespaceEnabled() const = 0;
    7474    virtual bool isContinuousSpellCheckingEnabled() = 0;
    7575    virtual void toggleContinuousSpellChecking() = 0;
  • trunk/Source/WebCore/page/EventHandler.cpp

    r215404 r215872  
    11191119#endif // ENABLE(DRAG_SUPPORT)
    11201120
    1121 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
     1121HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding) const
    11221122{
    11231123    Ref<Frame> protectedFrame(m_frame);
  • trunk/Source/WebCore/page/EventHandler.h

    r215404 r215872  
    148148    void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
    149149
    150     WEBCORE_EXPORT HitTestResult hitTestResultAtPoint(const LayoutPoint&,
    151         HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent,
    152         const LayoutSize& padding = LayoutSize());
     150    WEBCORE_EXPORT HitTestResult hitTestResultAtPoint(const LayoutPoint&, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent, const LayoutSize& padding = LayoutSize()) const;
    153151
    154152    bool mousePressed() const { return m_mousePressed; }
  • trunk/Source/WebCore/page/Frame.cpp

    r215831 r215872  
    158158    , m_navigationScheduler(*this)
    159159    , m_ownerElement(ownerElement)
    160     , m_script(std::make_unique<ScriptController>(*this))
    161     , m_editor(std::make_unique<Editor>(*this))
    162     , m_selection(std::make_unique<FrameSelection>(this))
    163     , m_animationController(std::make_unique<CSSAnimationController>(*this))
     160    , m_script(makeUniqueRef<ScriptController>(*this))
     161    , m_editor(makeUniqueRef<Editor>(*this))
     162    , m_selection(makeUniqueRef<FrameSelection>(this))
     163    , m_animationController(makeUniqueRef<CSSAnimationController>(*this))
    164164#if PLATFORM(IOS)
    165165    , m_overflowAutoScrollTimer(*this, &Frame::overflowAutoScrollTimerFired)
     
    169169    , m_textZoomFactor(parentTextZoomFactor(this))
    170170    , m_activeDOMObjectsAndAnimationsSuspendedCount(0)
    171     , m_eventHandler(std::make_unique<EventHandler>(*this))
     171    , m_eventHandler(makeUniqueRef<EventHandler>(*this))
    172172{
    173173    AtomicString::init();
     
    252252        m_view->unscheduleRelayout();
    253253   
    254     // This may be called during destruction, so need to do a null check.
    255     if (m_eventHandler)
    256         m_eventHandler->clear();
     254    m_eventHandler->clear();
    257255
    258256    RELEASE_ASSERT(!m_doc || !m_doc->hasLivingRenderTree());
     
    715713            if (m_page)
    716714                m_page->setAsRunningUserScripts();
    717             if (m_script)
    718                 m_script->evaluateInWorld(ScriptSourceCode(script.source(), script.url()), world);
     715            m_script->evaluateInWorld(ScriptSourceCode(script.source(), script.url()), world);
    719716        }
    720717    });
  • trunk/Source/WebCore/page/Frame.h

    r211949 r215872  
    3535#include "ScrollTypes.h"
    3636#include "UserScriptTypes.h"
    37 #include <memory>
    3837#include <wtf/ThreadSafeRefCounted.h>
     38#include <wtf/UniqueRef.h>
    3939
    4040#if PLATFORM(IOS)
     
    144144    FrameView* view() const;
    145145
    146     Editor& editor() const;
    147     EventHandler& eventHandler() const;
    148     EventHandler* eventHandlerPtr() const;
     146    Editor& editor() { return m_editor; }
     147    const Editor& editor() const { return m_editor; }
     148    EventHandler& eventHandler() { return m_eventHandler; }
     149    const EventHandler& eventHandler() const { return m_eventHandler; }
    149150    FrameLoader& loader() const;
    150151    NavigationScheduler& navigationScheduler() const;
    151     FrameSelection& selection() const;
     152    FrameSelection& selection() { return m_selection; }
     153    const FrameSelection& selection() const { return m_selection; }
    152154    FrameTree& tree() const;
    153     CSSAnimationController& animation() const;
    154     ScriptController& script();
     155    CSSAnimationController& animation() { return m_animationController; }
     156    const CSSAnimationController& animation() const { return m_animationController; }
     157    ScriptController& script() { return m_script; }
     158    const ScriptController& script() const { return m_script; }
    155159   
    156160    WEBCORE_EXPORT RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
     
    242246    WEBCORE_EXPORT int preferredHeight() const;
    243247    WEBCORE_EXPORT void updateLayout() const;
    244     WEBCORE_EXPORT NSRect caretRect() const;
    245     WEBCORE_EXPORT NSRect rectForScrollToVisible() const;
     248    WEBCORE_EXPORT NSRect caretRect();
     249    WEBCORE_EXPORT NSRect rectForScrollToVisible();
    246250    WEBCORE_EXPORT unsigned formElementsCharacterCount() const;
    247251
     
    289293    RefPtr<Document> m_doc;
    290294
    291     const std::unique_ptr<ScriptController> m_script;
    292     const std::unique_ptr<Editor> m_editor;
    293     const std::unique_ptr<FrameSelection> m_selection;
    294     const std::unique_ptr<CSSAnimationController> m_animationController;
     295    UniqueRef<ScriptController> m_script;
     296    UniqueRef<Editor> m_editor;
     297    UniqueRef<FrameSelection> m_selection;
     298    UniqueRef<CSSAnimationController> m_animationController;
    295299
    296300#if ENABLE(DATA_DETECTION)
     
    325329
    326330protected:
    327     std::unique_ptr<EventHandler> m_eventHandler;
     331    UniqueRef<EventHandler> m_eventHandler;
    328332};
    329333
     
    348352}
    349353
    350 inline ScriptController& Frame::script()
    351 {
    352     return *m_script;
    353 }
    354 
    355354inline Document* Frame::document() const
    356355{
     
    358357}
    359358
    360 inline FrameSelection& Frame::selection() const
    361 {
    362     return *m_selection;
    363 }
    364 
    365 inline Editor& Frame::editor() const
    366 {
    367     return *m_editor;
    368 }
    369 
    370 inline CSSAnimationController& Frame::animation() const
    371 {
    372     return *m_animationController;
    373 }
    374 
    375359inline HTMLFrameOwnerElement* Frame::ownerElement() const
    376360{
     
    391375{
    392376    m_page = nullptr;
    393 }
    394 
    395 inline EventHandler& Frame::eventHandler() const
    396 {
    397     return *m_eventHandler;
    398 }
    399 
    400 inline EventHandler* Frame::eventHandlerPtr() const
    401 {
    402     return m_eventHandler.get();
    403377}
    404378
  • trunk/Source/WebCore/page/MainFrame.cpp

    r214294 r215872  
    6060{
    6161    m_recentWheelEventDeltaFilter = nullptr;
    62     m_eventHandler = nullptr;
    6362
    6463    setMainFrameWasDestroyed();
  • trunk/Source/WebCore/page/ios/FrameIOS.mm

    r211741 r215872  
    511511}
    512512
    513 NSRect Frame::caretRect() const
     513NSRect Frame::caretRect()
    514514{
    515515    VisibleSelection visibleSelection = selection().selection();
     
    519519}
    520520
    521 NSRect Frame::rectForScrollToVisible() const
     521NSRect Frame::rectForScrollToVisible()
    522522{
    523523    VisibleSelection selection(this->selection().selection());
  • trunk/Source/WebCore/replay/UserInputBridge.cpp

    r214113 r215872  
    7070
    7171#if ENABLE(CONTEXT_MENUS)
    72 bool UserInputBridge::handleContextMenuEvent(const PlatformMouseEvent& mouseEvent, const Frame* frame, InputSource)
    73 {
    74     return frame->eventHandler().sendContextMenuEvent(mouseEvent);
     72bool UserInputBridge::handleContextMenuEvent(const PlatformMouseEvent& mouseEvent, Frame& frame, InputSource)
     73{
     74    return frame.eventHandler().sendContextMenuEvent(mouseEvent);
    7575}
    7676#endif
  • trunk/Source/WebCore/replay/UserInputBridge.h

    r214113 r215872  
    7373    // User input APIs.
    7474#if ENABLE(CONTEXT_MENUS)
    75     WEBCORE_EXPORT bool handleContextMenuEvent(const PlatformMouseEvent&, const Frame*, InputSource source = InputSource::User);
     75    WEBCORE_EXPORT bool handleContextMenuEvent(const PlatformMouseEvent&, Frame&, InputSource = InputSource::User);
    7676#endif
    7777    WEBCORE_EXPORT bool handleMousePressEvent(const PlatformMouseEvent&, InputSource source = InputSource::User);
  • trunk/Source/WebKit/mac/ChangeLog

    r215866 r215872  
     12017-04-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Modernize Frame.h
     4        https://bugs.webkit.org/show_bug.cgi?id=171357
     5
     6        Reviewed by Andy Estes.
     7
     8        * WebCoreSupport/WebEditorClient.h:
     9        * WebCoreSupport/WebEditorClient.mm:
     10        (WebEditorClient::isSelectTrailingWhitespaceEnabled):
     11
    1122017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
    213
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h

    r210845 r215872  
    5959
    6060    bool smartInsertDeleteEnabled() final;
    61     bool isSelectTrailingWhitespaceEnabled() final;
     61    bool isSelectTrailingWhitespaceEnabled() const final;
    6262
    6363    bool shouldDeleteRange(WebCore::Range*) final;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r212642 r215872  
    243243}
    244244
    245 bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
     245bool WebEditorClient::isSelectTrailingWhitespaceEnabled() const
    246246{
    247247    Page* page = [m_webView page];
  • trunk/Source/WebKit/win/ChangeLog

    r215585 r215872  
     12017-04-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Modernize Frame.h
     4        https://bugs.webkit.org/show_bug.cgi?id=171357
     5
     6        Reviewed by Andy Estes.
     7
     8        * WebCoreSupport/WebEditorClient.cpp:
     9        (WebEditorClient::isSelectTrailingWhitespaceEnabled):
     10        * WebCoreSupport/WebEditorClient.h:
     11
    1122017-04-20  Fujii Hironori  <Hironori.Fujii@sony.com>
    213
  • trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp

    r210845 r215872  
    383383}
    384384
    385 bool WebEditorClient::isSelectTrailingWhitespaceEnabled(void)
     385bool WebEditorClient::isSelectTrailingWhitespaceEnabled(void) const
    386386{
    387387    Page* page = m_webView->page();
  • trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h

    r210845 r215872  
    7171
    7272    bool smartInsertDeleteEnabled() final;
    73     bool isSelectTrailingWhitespaceEnabled() final;
     73    bool isSelectTrailingWhitespaceEnabled() const final;
    7474
    7575    void registerUndoStep(WebCore::UndoStep&) final;
  • trunk/Source/WebKit2/ChangeLog

    r215862 r215872  
     12017-04-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Modernize Frame.h
     4        https://bugs.webkit.org/show_bug.cgi?id=171357
     5
     6        Reviewed by Andy Estes.
     7
     8        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     9        (WebKit::WebEditorClient::isSelectTrailingWhitespaceEnabled):
     10        * WebProcess/WebCoreSupport/WebEditorClient.h:
     11        * WebProcess/WebPage/WebPage.cpp:
     12        (WebKit::WebPage::contextMenuAtPointInWindow):
     13        (WebKit::handleContextMenuEvent):
     14        (WebKit::WebPage::isSelectTrailingWhitespaceEnabled):
     15        * WebProcess/WebPage/WebPage.h:
     16        * WebProcess/WebPage/ios/WebPageIOS.mm:
     17        (WebKit::WebPage::selectWithGesture):
     18        (WebKit::WebPage::selectPositionAtPoint):
     19        (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
     20        (WebKit::WebPage::rangeForGranularityAtPoint):
     21        (WebKit::WebPage::selectTextWithGranularityAtPoint):
     22        (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
     23        (WebKit::WebPage::updateSelectionWithExtentPoint):
     24
    1252017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r215255 r215872  
    8383}
    8484 
    85 bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
     85bool WebEditorClient::isSelectTrailingWhitespaceEnabled() const
    8686{
    8787    return m_page->isSelectTrailingWhitespaceEnabled();
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

    r210845 r215872  
    4343    bool shouldDeleteRange(WebCore::Range*) final;
    4444    bool smartInsertDeleteEnabled() final;
    45     bool isSelectTrailingWhitespaceEnabled() final;
     45    bool isSelectTrailingWhitespaceEnabled() const final;
    4646    bool isContinuousSpellCheckingEnabled() final;
    4747    void toggleContinuousSpellChecking() final;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r215724 r215872  
    21362136    // Simulate a mouse click to generate the correct menu.
    21372137    PlatformMouseEvent mouseEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
    2138     bool handled = corePage()->userInputBridge().handleContextMenuEvent(mouseEvent, &corePage()->mainFrame());
     2138    bool handled = corePage()->userInputBridge().handleContextMenuEvent(mouseEvent, corePage()->mainFrame());
    21392139    if (!handled)
    21402140        return 0;
     
    22612261        frame = result.innerNonSharedNode()->document().frame();
    22622262
    2263     bool handled = page->corePage()->userInputBridge().handleContextMenuEvent(platformMouseEvent, frame);
     2263    bool handled = page->corePage()->userInputBridge().handleContextMenuEvent(platformMouseEvent, *frame);
    22642264    if (handled)
    22652265        page->contextMenu()->show();
     
    51875187}
    51885188
    5189 bool WebPage::isSelectTrailingWhitespaceEnabled()
     5189bool WebPage::isSelectTrailingWhitespaceEnabled() const
    51905190{
    51915191    return m_page->settings().selectTrailingWhitespaceEnabled();
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r215724 r215872  
    721721    void setSmartInsertDeleteEnabled(bool);
    722722
    723     bool isSelectTrailingWhitespaceEnabled();
     723    bool isSelectTrailingWhitespaceEnabled() const;
    724724    void setSelectTrailingWhitespaceEnabled(bool);
    725725
     
    10121012    void resetTextAutosizing();
    10131013    WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithAssistedNode);
    1014     RefPtr<WebCore::Range> rangeForGranularityAtPoint(const WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode);
     1014    RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode);
    10151015    bool shouldSwitchToBlockModeForHandle(const WebCore::IntPoint& handlePoint, SelectionHandlePosition);
    10161016    RefPtr<WebCore::Range> switchToBlockSelectionAtPoint(const WebCore::IntPoint&, SelectionHandlePosition);
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r215446 r215872  
    10411041void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, uint64_t callbackID)
    10421042{
    1043     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     1043    auto& frame = m_page->focusController().focusedOrMainFrame();
    10441044    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
    10451045
     
    19201920void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, uint64_t callbackID)
    19211921{
    1922     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     1922    auto& frame = m_page->focusController().focusedOrMainFrame();
    19231923    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
    19241924   
     
    19301930void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, uint64_t callbackID)
    19311931{
    1932     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     1932    auto& frame = m_page->focusController().focusedOrMainFrame();
    19331933    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
    19341934
     
    19551955}
    19561956
    1957 RefPtr<Range> WebPage::rangeForGranularityAtPoint(const Frame& frame, const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode)
     1957RefPtr<Range> WebPage::rangeForGranularityAtPoint(Frame& frame, const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode)
    19581958{
    19591959    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
     
    19871987void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
    19881988{
    1989     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     1989    auto& frame = m_page->focusController().focusedOrMainFrame();
    19901990    RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithAssistedNode);
    19911991    if (!isInteractingWithAssistedNode) {
     
    20202020void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
    20212021{
    2022     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     2022    auto& frame = m_page->focusController().focusedOrMainFrame();
    20232023    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
    20242024    RefPtr<Range> newRange = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithAssistedNode);
     
    20492049void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, uint64_t callbackID)
    20502050{
    2051     const Frame& frame = m_page->focusController().focusedOrMainFrame();
     2051    auto& frame = m_page->focusController().focusedOrMainFrame();
    20522052    VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
    20532053
Note: See TracChangeset for help on using the changeset viewer.