Changeset 88418 in webkit
- Timestamp:
- Jun 8, 2011 8:55:17 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88417 r88418 1 2011-06-08 Hayato Ito <hayato@chromium.org> 2 3 Reviewed by Hajime Morita. 4 5 Makes sure that document.activeElement won't be an element in shadow root. 6 7 https://bugs.webkit.org/show_bug.cgi?id=61413 8 9 * fast/dom/shadow/activeelement-should-be-shadowhost-expected.txt: Added. 10 * fast/dom/shadow/activeelement-should-be-shadowhost.html: Added. 11 1 12 2011-06-08 Kent Tamura <tkent@chromium.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r88415 r88418 1 2011-06-08 Hayato Ito <hayato@chromium.org> 2 3 Reviewed by Hajime Morita. 4 5 Makes sure that document.activeElement won't be an element in shadow root. 6 7 https://bugs.webkit.org/show_bug.cgi?id=61413 8 9 Test: fast/dom/shadow/activeelement-should-be-shadowhost.html 10 11 * html/HTMLDocument.cpp: 12 (WebCore::focusedFrameOwnerElement): 13 (WebCore::HTMLDocument::activeElement): 14 1 15 2011-06-08 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/Source/WebCore/html/HTMLDocument.cpp
r86707 r88418 137 137 } 138 138 139 static Node* focusedFrameOwnerElement(Frame* focusedFrame, Frame* currentFrame) 140 { 141 for (; focusedFrame; focusedFrame = focusedFrame->tree()->parent()) { 142 if (focusedFrame->tree()->parent() == currentFrame) 143 return focusedFrame->ownerElement(); 144 } 145 return 0; 146 } 147 139 148 Element* HTMLDocument::activeElement() 140 149 { 141 if (Node* node = focusedNode()) { 142 if (node->isElementNode()) 143 return static_cast<Element*>(node); 144 } else if (Page* page = this->page()) { 145 for (Frame* focusedFrame = page->focusController()->focusedFrame(); focusedFrame; focusedFrame = focusedFrame->tree()->parent()) { 146 if (focusedFrame->tree()->parent() == frame()) 147 return focusedFrame->ownerElement(); 148 } 149 } 150 Node* node = focusedNode(); 151 if (!node && page()) 152 node = focusedFrameOwnerElement(page()->focusController()->focusedFrame(), frame()); 153 if (!node) 154 return body(); 155 ASSERT(node->document() == this); 156 while (node->treeScope() != this) { 157 node = node->parentOrHostNode(); 158 ASSERT(node); 159 } 160 if (node->isElementNode()) 161 return toElement(node); 150 162 return body(); 151 163 }
Note: See TracChangeset
for help on using the changeset viewer.