Changeset 116724 in webkit
- Timestamp:
- May 10, 2012 9:00:34 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116723 r116724 1 2012-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 1 35 2012-05-10 Hajime Morrita <morrita@google.com> 2 36 -
trunk/Source/WebCore/dom/Document.cpp
r116715 r116724 47 47 #include "CookieJar.h" 48 48 #include "DOMImplementation.h" 49 #include "DOMSelection.h"50 49 #include "DOMWindow.h" 51 50 #include "DateComponents.h" … … 5094 5093 } 5095 5094 5095 // FF method for accessing the selection added for compatibility. 5096 DOMSelection* Document::getSelection() const 5097 { 5098 return frame() ? frame()->domWindow()->getSelection() : 0; 5099 } 5100 5096 5101 void Document::attachRange(Range* range) 5097 5102 { -
trunk/Source/WebCore/dom/Document.h
r116715 r116724 970 970 void cancelFocusAppearanceUpdate(); 971 971 972 // FF method for accessing the selection added for compatibility. 973 DOMSelection* getSelection() const; 974 972 975 // Extension for manipulating canvas drawing contexts for use in CSS 973 976 CanvasRenderingContext* getCSSCanvasContext(const String& type, const String& name, int width, int height); -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r116715 r116724 152 152 DOMSelection* ShadowRoot::selection() 153 153 { 154 if (document() )155 return document()-> getSelection();154 if (document() && document()->domWindow()) 155 return document()->domWindow()->getSelection(); 156 156 return 0; 157 157 } -
trunk/Source/WebCore/dom/TreeScope.cpp
r116715 r116724 28 28 29 29 #include "ContainerNode.h" 30 #include "DOMSelection.h"31 30 #include "Document.h" 32 31 #include "Element.h" … … 38 37 #include "HTMLNames.h" 39 38 #include "Page.h" 40 #include "RuntimeEnabledFeatures.h"41 39 #include "TreeScopeAdopter.h" 42 40 #include <wtf/text/AtomicString.h> … … 57 55 TreeScope::~TreeScope() 58 56 { 59 if (m_selection) {60 m_selection->clearTreeScope();61 m_selection = 0;62 }63 57 } 64 58 … … 121 115 return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this)); 122 116 return static_cast<HTMLMapElement*>(m_imageMapsByName.getElementByMapName(AtomicString(name).impl(), this)); 123 }124 125 DOMSelection* TreeScope::getSelection() const126 {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();135 117 } 136 118 -
trunk/Source/WebCore/dom/TreeScope.h
r116715 r116724 34 34 35 35 class ContainerNode; 36 class DOMSelection;37 36 class Element; 38 37 class HTMLMapElement; … … 64 63 bool hasNodeListCaches() const { return m_numNodeListCaches; } 65 64 66 DOMSelection* getSelection() const;67 68 65 // Find first anchor with the given name. 69 66 // First searches for an element with the given ID, but if that fails, then looks … … 94 91 95 92 unsigned m_numNodeListCaches; 96 97 mutable RefPtr<DOMSelection> m_selection;98 93 }; 99 94 -
trunk/Source/WebCore/page/DOMSelection.cpp
r116715 r116724 59 59 } 60 60 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; 61 DOMSelection::DOMSelection(Frame* frame) 62 : DOMWindowProperty(frame) 63 { 71 64 } 72 65 -
trunk/Source/WebCore/page/DOMSelection.h
r116715 r116724 1 1 /* 2 2 * Copyright (C) 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 40 39 41 40 class Frame; 41 class Range; 42 42 class Node; 43 class Range;44 class TreeScope;45 43 class VisibleSelection; 46 44 47 45 typedef int ExceptionCode; 48 46 49 class DOMSelection : public RefCounted<DOMSelection> {47 class DOMSelection : public RefCounted<DOMSelection>, public DOMWindowProperty { 50 48 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)); } 54 50 55 51 // Safari Selection Object API … … 89 85 String toString(); 90 86 91 Frame* frame() const { return m_frame; }92 93 87 // Microsoft Selection Object API 94 88 void empty(); 95 89 96 90 private: 97 const TreeScope* m_treeScope; 98 Frame* m_frame; 99 100 explicit DOMSelection(const TreeScope*); 91 explicit DOMSelection(Frame*); 101 92 102 93 // Convenience method for accessors, does not NULL check m_frame. -
trunk/Source/WebCore/page/DOMWindow.cpp
r116715 r116724 400 400 if (!m_suspendedForPageCache) { 401 401 ASSERT(!m_screen); 402 ASSERT(!m_selection); 402 403 ASSERT(!m_history); 403 404 ASSERT(!m_crypto); … … 572 573 573 574 m_screen = 0; 575 m_selection = 0; 574 576 m_history = 0; 575 577 m_crypto = 0; … … 885 887 DOMSelection* DOMWindow::getSelection() 886 888 { 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(); 891 894 } 892 895 -
trunk/Source/WebCore/page/DOMWindow.h
r116715 r116724 429 429 430 430 mutable RefPtr<Screen> m_screen; 431 mutable RefPtr<DOMSelection> m_selection; 431 432 mutable RefPtr<History> m_history; 432 433 mutable RefPtr<Crypto> m_crypto;
Note: See TracChangeset
for help on using the changeset viewer.