Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: Source/core/html/HTMLDocument.cpp

Issue 141733006: Move focus management API from HTMLDocument to Document (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add extra prototype check Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLDocument.h ('k') | Source/core/html/HTMLDocument.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 InheritedBool mode; 104 InheritedBool mode;
105 if (equalIgnoringCase(value, "on")) 105 if (equalIgnoringCase(value, "on"))
106 mode = on; 106 mode = on;
107 else if (equalIgnoringCase(value, "off")) 107 else if (equalIgnoringCase(value, "off"))
108 mode = off; 108 mode = off;
109 else 109 else
110 mode = inherit; 110 mode = inherit;
111 Document::setDesignMode(mode); 111 Document::setDesignMode(mode);
112 } 112 }
113 113
114 Element* HTMLDocument::activeElement()
115 {
116 if (Element* element = treeScope().adjustedFocusedElement())
117 return element;
118 return body();
119 }
120
121 bool HTMLDocument::hasFocus()
122 {
123 Page* page = this->page();
124 if (!page)
125 return false;
126 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
127 return false;
128 if (Frame* focusedFrame = page->focusController().focusedFrame()) {
129 if (focusedFrame->tree().isDescendantOf(frame()))
130 return true;
131 }
132 return false;
133 }
134
135 HTMLBodyElement* HTMLDocument::htmlBodyElement() const 114 HTMLBodyElement* HTMLDocument::htmlBodyElement() const
136 { 115 {
137 HTMLElement* body = this->body(); 116 HTMLElement* body = this->body();
138 return (body && body->hasTagName(bodyTag)) ? toHTMLBodyElement(body) : 0; 117 return (body && body->hasTagName(bodyTag)) ? toHTMLBodyElement(body) : 0;
139 } 118 }
140 119
141 const AtomicString& HTMLDocument::bodyAttributeValue(const QualifiedName& name) const 120 const AtomicString& HTMLDocument::bodyAttributeValue(const QualifiedName& name) const
142 { 121 {
143 if (HTMLBodyElement* body = htmlBodyElement()) 122 if (HTMLBodyElement* body = htmlBodyElement())
144 return body->fastGetAttribute(name); 123 return body->fastGetAttribute(name);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void HTMLDocument::writeln(DOMWindow* activeWindow, const Vector<String>& text) 319 void HTMLDocument::writeln(DOMWindow* activeWindow, const Vector<String>& text)
341 { 320 {
342 ASSERT(activeWindow); 321 ASSERT(activeWindow);
343 StringBuilder builder; 322 StringBuilder builder;
344 for (size_t i = 0; i < text.size(); ++i) 323 for (size_t i = 0; i < text.size(); ++i)
345 builder.append(text[i]); 324 builder.append(text[i]);
346 writeln(builder.toString(), activeWindow->document()); 325 writeln(builder.toString(), activeWindow->document());
347 } 326 }
348 327
349 } 328 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLDocument.h ('k') | Source/core/html/HTMLDocument.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698