Changeset 116724 in webkit


Ignore:
Timestamp:
May 10, 2012 9:00:34 PM (12 years ago)
Author:
tkent@chromium.org
Message:

Unreviewed, rolling out r116715.
http://trac.webkit.org/changeset/116715
https://bugs.webkit.org/show_bug.cgi?id=86172

Broke http/tests/security/cross-frame-access-selection.html
(Requested by tkent on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-05-10

  • dom/Document.cpp:

(WebCore):
(WebCore::Document::getSelection):

  • dom/Document.h:

(Document):

  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::selection):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::~TreeScope):

  • dom/TreeScope.h:

(WebCore):
(TreeScope):

  • page/DOMSelection.cpp:

(WebCore::DOMSelection::DOMSelection):

  • page/DOMSelection.h:

(WebCore):
(WebCore::DOMSelection::create):
(DOMSelection):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::clearDOMWindowProperties):
(WebCore::DOMWindow::getSelection):

  • page/DOMWindow.h:

(DOMWindow):

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116723 r116724  
     12012-05-10  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r116715.
     4        http://trac.webkit.org/changeset/116715
     5        https://bugs.webkit.org/show_bug.cgi?id=86172
     6
     7        Broke http/tests/security/cross-frame-access-selection.html
     8        (Requested by tkent on #webkit).
     9
     10        * dom/Document.cpp:
     11        (WebCore):
     12        (WebCore::Document::getSelection):
     13        * dom/Document.h:
     14        (Document):
     15        * dom/ShadowRoot.cpp:
     16        (WebCore::ShadowRoot::selection):
     17        * dom/TreeScope.cpp:
     18        (WebCore::TreeScope::~TreeScope):
     19        * dom/TreeScope.h:
     20        (WebCore):
     21        (TreeScope):
     22        * page/DOMSelection.cpp:
     23        (WebCore::DOMSelection::DOMSelection):
     24        * page/DOMSelection.h:
     25        (WebCore):
     26        (WebCore::DOMSelection::create):
     27        (DOMSelection):
     28        * page/DOMWindow.cpp:
     29        (WebCore::DOMWindow::~DOMWindow):
     30        (WebCore::DOMWindow::clearDOMWindowProperties):
     31        (WebCore::DOMWindow::getSelection):
     32        * page/DOMWindow.h:
     33        (DOMWindow):
     34
    1352012-05-10  Hajime Morrita  <morrita@google.com>
    236
  • trunk/Source/WebCore/dom/Document.cpp

    r116715 r116724  
    4747#include "CookieJar.h"
    4848#include "DOMImplementation.h"
    49 #include "DOMSelection.h"
    5049#include "DOMWindow.h"
    5150#include "DateComponents.h"
     
    50945093}
    50955094
     5095// FF method for accessing the selection added for compatibility.
     5096DOMSelection* Document::getSelection() const
     5097{
     5098    return frame() ? frame()->domWindow()->getSelection() : 0;
     5099}
     5100
    50965101void Document::attachRange(Range* range)
    50975102{
  • trunk/Source/WebCore/dom/Document.h

    r116715 r116724  
    970970    void cancelFocusAppearanceUpdate();
    971971       
     972    // FF method for accessing the selection added for compatibility.
     973    DOMSelection* getSelection() const;
     974   
    972975    // Extension for manipulating canvas drawing contexts for use in CSS
    973976    CanvasRenderingContext* getCSSCanvasContext(const String& type, const String& name, int width, int height);
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r116715 r116724  
    152152DOMSelection* ShadowRoot::selection()
    153153{
    154     if (document())
    155         return document()->getSelection();
     154    if (document() && document()->domWindow())
     155        return document()->domWindow()->getSelection();
    156156    return 0;
    157157}
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r116715 r116724  
    2828
    2929#include "ContainerNode.h"
    30 #include "DOMSelection.h"
    3130#include "Document.h"
    3231#include "Element.h"
     
    3837#include "HTMLNames.h"
    3938#include "Page.h"
    40 #include "RuntimeEnabledFeatures.h"
    4139#include "TreeScopeAdopter.h"
    4240#include <wtf/text/AtomicString.h>
     
    5755TreeScope::~TreeScope()
    5856{
    59     if (m_selection) {
    60         m_selection->clearTreeScope();
    61         m_selection = 0;
    62     }
    6357}
    6458
     
    121115        return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
    122116    return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByMapName(AtomicString(name).impl(), this));
    123 }
    124 
    125 DOMSelection* TreeScope::getSelection() const
    126 {
    127     if (!rootNode()->document()->frame())
    128         return 0;
    129 
    130     if (m_selection)
    131         return m_selection.get();
    132 
    133     m_selection = DOMSelection::create(rootNode()->document());
    134     return m_selection.get();
    135117}
    136118
  • trunk/Source/WebCore/dom/TreeScope.h

    r116715 r116724  
    3434
    3535class ContainerNode;
    36 class DOMSelection;
    3736class Element;
    3837class HTMLMapElement;
     
    6463    bool hasNodeListCaches() const { return m_numNodeListCaches; }
    6564
    66     DOMSelection* getSelection() const;
    67 
    6865    // Find first anchor with the given name.
    6966    // First searches for an element with the given ID, but if that fails, then looks
     
    9491
    9592    unsigned m_numNodeListCaches;
    96 
    97     mutable RefPtr<DOMSelection> m_selection;
    9893};
    9994
  • trunk/Source/WebCore/page/DOMSelection.cpp

    r116715 r116724  
    5959}
    6060
    61 DOMSelection::DOMSelection(const TreeScope* treeScope)
    62     : m_treeScope(treeScope)
    63     , m_frame(treeScope->rootNode()->document()->frame())
    64 {
    65 }
    66 
    67 void DOMSelection::clearTreeScope()
    68 {
    69     m_frame = 0;
    70     m_treeScope = 0;
     61DOMSelection::DOMSelection(Frame* frame)
     62    : DOMWindowProperty(frame)
     63{
    7164}
    7265
  • trunk/Source/WebCore/page/DOMSelection.h

    r116715 r116724  
    11/*
    22 * Copyright (C) 2007 Apple Inc.  All rights reserved.
    3  * Copyright (C) 2012 Google Inc.  All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    4039
    4140    class Frame;
     41    class Range;
    4242    class Node;
    43     class Range;
    44     class TreeScope;
    4543    class VisibleSelection;
    4644
    4745    typedef int ExceptionCode;
    4846
    49     class DOMSelection : public RefCounted<DOMSelection> {
     47    class DOMSelection : public RefCounted<DOMSelection>, public DOMWindowProperty {
    5048    public:
    51         static PassRefPtr<DOMSelection> create(const TreeScope* treeScope) { return adoptRef(new DOMSelection(treeScope)); }
    52 
    53         void clearTreeScope();
     49        static PassRefPtr<DOMSelection> create(Frame* frame) { return adoptRef(new DOMSelection(frame)); }
    5450
    5551        // Safari Selection Object API
     
    8985        String toString();
    9086
    91         Frame* frame() const { return m_frame; }
    92 
    9387        // Microsoft Selection Object API
    9488        void empty();
    9589
    9690    private:
    97         const TreeScope* m_treeScope;
    98         Frame* m_frame;
    99 
    100         explicit DOMSelection(const TreeScope*);
     91        explicit DOMSelection(Frame*);
    10192
    10293        // Convenience method for accessors, does not NULL check m_frame.
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r116715 r116724  
    400400    if (!m_suspendedForPageCache) {
    401401        ASSERT(!m_screen);
     402        ASSERT(!m_selection);
    402403        ASSERT(!m_history);
    403404        ASSERT(!m_crypto);
     
    572573
    573574    m_screen = 0;
     575    m_selection = 0;
    574576    m_history = 0;
    575577    m_crypto = 0;
     
    885887DOMSelection* DOMWindow::getSelection()
    886888{
    887     if (!isCurrentlyDisplayedInFrame() || !m_frame)
    888         return 0;
    889 
    890     return m_frame->document()->getSelection();
     889    if (!isCurrentlyDisplayedInFrame())
     890        return 0;
     891    if (!m_selection)
     892        m_selection = DOMSelection::create(m_frame);
     893    return m_selection.get();
    891894}
    892895
  • trunk/Source/WebCore/page/DOMWindow.h

    r116715 r116724  
    429429
    430430        mutable RefPtr<Screen> m_screen;
     431        mutable RefPtr<DOMSelection> m_selection;
    431432        mutable RefPtr<History> m_history;
    432433        mutable RefPtr<Crypto>  m_crypto;
Note: See TracChangeset for help on using the changeset viewer.