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

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 754043004: Remove autofocus. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/frame/UseCounter.h » ('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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 , TreeScope(*this) 246 , TreeScope(*this)
247 , m_module(nullptr) 247 , m_module(nullptr)
248 , m_hasNodesWithPlaceholderStyle(false) 248 , m_hasNodesWithPlaceholderStyle(false)
249 , m_evaluateMediaQueriesOnStyleRecalc(false) 249 , m_evaluateMediaQueriesOnStyleRecalc(false)
250 , m_pendingSheetLayout(NoLayoutWithPendingSheets) 250 , m_pendingSheetLayout(NoLayoutWithPendingSheets)
251 , m_frame(initializer.frame()) 251 , m_frame(initializer.frame())
252 , m_domWindow(m_frame ? m_frame->domWindow() : 0) 252 , m_domWindow(m_frame ? m_frame->domWindow() : 0)
253 , m_importsController(initializer.importsController()) 253 , m_importsController(initializer.importsController())
254 , m_activeParserCount(0) 254 , m_activeParserCount(0)
255 , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWa itingForResourcesTimerFired) 255 , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWa itingForResourcesTimerFired)
256 , m_hasAutofocused(false)
257 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired) 256 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired)
258 , m_focusAutofocusElementTimer(this, &Document::focusAutofocusElementTimerFi red)
259 , m_listenerTypes(0) 257 , m_listenerTypes(0)
260 , m_mutationObserverTypes(0) 258 , m_mutationObserverTypes(0)
261 , m_readyState(Complete) 259 , m_readyState(Complete)
262 , m_isParsing(false) 260 , m_isParsing(false)
263 , m_containsValidityStyleRules(false) 261 , m_containsValidityStyleRules(false)
264 , m_markers(adoptPtr(new DocumentMarkerController)) 262 , m_markers(adoptPtr(new DocumentMarkerController))
265 , m_loadEventProgress(LoadEventNotRun) 263 , m_loadEventProgress(LoadEventNotRun)
266 , m_startTime(currentTime()) 264 , m_startTime(currentTime())
267 , m_documentClasses(documentClasses) 265 , m_documentClasses(documentClasses)
268 , m_renderView(0) 266 , m_renderView(0)
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 // FIXME: This shouldn't be needed once LocalDOMWindow becomes ExecutionCont ext. 1286 // FIXME: This shouldn't be needed once LocalDOMWindow becomes ExecutionCont ext.
1289 if (m_domWindow) 1287 if (m_domWindow)
1290 m_domWindow->clearEventQueue(); 1288 m_domWindow->clearEventQueue();
1291 1289
1292 if (m_renderView) 1290 if (m_renderView)
1293 m_renderView->setIsInWindow(false); 1291 m_renderView->setIsInWindow(false);
1294 1292
1295 m_hoverNode = nullptr; 1293 m_hoverNode = nullptr;
1296 m_focusedElement = nullptr; 1294 m_focusedElement = nullptr;
1297 m_activeHoverElement = nullptr; 1295 m_activeHoverElement = nullptr;
1298 m_autofocusElement = nullptr;
1299 1296
1300 m_renderView = 0; 1297 m_renderView = 0;
1301 ContainerNode::detach(context); 1298 ContainerNode::detach(context);
1302 1299
1303 m_styleEngine->didDetach(); 1300 m_styleEngine->didDetach();
1304 1301
1305 // This is required, as our LocalFrame might delete itself as soon as it det aches 1302 // This is required, as our LocalFrame might delete itself as soon as it det aches
1306 // us. However, this violates Node::detach() semantics, as it's never 1303 // us. However, this violates Node::detach() semantics, as it's never
1307 // possible to re-attach. Eventually Document::detach() should be renamed, 1304 // possible to re-attach. Eventually Document::detach() should be renamed,
1308 // or this setting of the frame to 0 could be made explicit in each of the 1305 // or this setting of the frame to 0 could be made explicit in each of the
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 void Document::modifiedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upd ateMode) 2745 void Document::modifiedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upd ateMode)
2749 { 2746 {
2750 // If we're in document teardown, then we don't need this notification of ou r sheet's removal. 2747 // If we're in document teardown, then we don't need this notification of ou r sheet's removal.
2751 // styleResolverChanged() is needed even when the document is inactive so th at 2748 // styleResolverChanged() is needed even when the document is inactive so th at
2752 // imported docuements (which is inactive) notifies the change to the master document. 2749 // imported docuements (which is inactive) notifies the change to the master document.
2753 if (isActive()) 2750 if (isActive())
2754 styleEngine()->modifiedStyleSheet(sheet); 2751 styleEngine()->modifiedStyleSheet(sheet);
2755 styleResolverChanged(updateMode); 2752 styleResolverChanged(updateMode);
2756 } 2753 }
2757 2754
2758 void Document::focusAutofocusElementTimerFired(Timer<Document>*)
2759 {
2760 if (RefPtr<Element> element = autofocusElement()) {
2761 setAutofocusElement(nullptr);
2762 element->focus();
2763 }
2764 }
2765
2766 void Document::setAutofocusElement(Element* element)
2767 {
2768 if (!element) {
2769 m_autofocusElement = nullptr;
2770 return;
2771 }
2772 if (m_hasAutofocused)
2773 return;
2774 m_hasAutofocused = true;
2775 ASSERT(!m_autofocusElement);
2776 m_autofocusElement = element;
2777 if (!m_focusAutofocusElementTimer.isActive())
2778 m_focusAutofocusElementTimer.startOneShot(0, FROM_HERE);
2779 }
2780
2781 Element* Document::activeElement() const 2755 Element* Document::activeElement() const
2782 { 2756 {
2783 if (Element* element = treeScope().adjustedFocusedElement()) 2757 if (Element* element = treeScope().adjustedFocusedElement())
2784 return element; 2758 return element;
2785 return documentElement(); 2759 return documentElement();
2786 } 2760 }
2787 2761
2788 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa ta) 2762 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa ta)
2789 { 2763 {
2790 } 2764 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 using namespace blink; 2807 using namespace blink;
2834 void showLiveDocumentInstances() 2808 void showLiveDocumentInstances()
2835 { 2809 {
2836 WeakDocumentSet& set = liveDocumentSet(); 2810 WeakDocumentSet& set = liveDocumentSet();
2837 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2811 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2838 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2812 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2839 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2813 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2840 } 2814 }
2841 } 2815 }
2842 #endif 2816 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698