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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2739573005: Rename Document::widgetForElement to frameViewBaseForElement (Closed)
Patch Set: Move Document::widgetForElement to Node::frameViewBase Created 3 years, 9 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 return false; 361 return false;
362 362
363 // rule (d) above 363 // rule (d) above
364 CharDecompositionType decompType = decompositionType(c); 364 CharDecompositionType decompType = decompositionType(c);
365 if (decompType == DecompositionFont || decompType == DecompositionCompat) 365 if (decompType == DecompositionFont || decompType == DecompositionCompat)
366 return false; 366 return false;
367 367
368 return true; 368 return true;
369 } 369 }
370 370
371 static FrameViewBase* widgetForElement(const Element& focusedElement) {
372 LayoutObject* layoutObject = focusedElement.layoutObject();
373 if (!layoutObject || !layoutObject->isLayoutPart())
374 return 0;
375 return toLayoutPart(layoutObject)->frameViewBase();
376 }
377
378 static bool acceptsEditingFocus(const Element& element) { 371 static bool acceptsEditingFocus(const Element& element) {
379 DCHECK(hasEditableStyle(element)); 372 DCHECK(hasEditableStyle(element));
380 373
381 return element.document().frame() && rootEditableElement(element); 374 return element.document().frame() && rootEditableElement(element);
382 } 375 }
383 376
384 uint64_t Document::s_globalTreeVersion = 0; 377 uint64_t Document::s_globalTreeVersion = 0;
385 378
386 static bool s_threadedParsingEnabledForTesting = true; 379 static bool s_threadedParsingEnabledForTesting = true;
387 380
(...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 params.sourceCapabilities); 4026 params.sourceCapabilities);
4034 4027
4035 if (m_focusedElement) { 4028 if (m_focusedElement) {
4036 // handler shifted focus 4029 // handler shifted focus
4037 focusChangeBlocked = true; 4030 focusChangeBlocked = true;
4038 newFocusedElement = nullptr; 4031 newFocusedElement = nullptr;
4039 } 4032 }
4040 } 4033 }
4041 4034
4042 if (view()) { 4035 if (view()) {
4043 FrameViewBase* oldFrameViewBase = widgetForElement(*oldFocusedElement); 4036 FrameViewBase* oldFrameViewBase = oldFocusedElement->frameViewBase();
4037
4044 if (oldFrameViewBase) 4038 if (oldFrameViewBase)
4045 oldFrameViewBase->setFocused(false, params.type); 4039 oldFrameViewBase->setFocused(false, params.type);
4046 else 4040 else
4047 view()->setFocused(false, params.type); 4041 view()->setFocused(false, params.type);
4048 } 4042 }
4049 } 4043 }
4050 4044
4051 if (newFocusedElement) 4045 if (newFocusedElement)
4052 updateStyleAndLayoutTreeForNode(newFocusedElement); 4046 updateStyleAndLayoutTreeForNode(newFocusedElement);
4053 if (newFocusedElement && newFocusedElement->isFocusable()) { 4047 if (newFocusedElement && newFocusedElement->isFocusable()) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4107 goto SetFocusedElementDone; 4101 goto SetFocusedElementDone;
4108 } 4102 }
4109 } 4103 }
4110 4104
4111 if (isRootEditableElement(*m_focusedElement)) 4105 if (isRootEditableElement(*m_focusedElement))
4112 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); 4106 frame()->spellChecker().didBeginEditing(m_focusedElement.get());
4113 4107
4114 // eww, I suck. set the qt focus correctly 4108 // eww, I suck. set the qt focus correctly
4115 // ### find a better place in the code for this 4109 // ### find a better place in the code for this
4116 if (view()) { 4110 if (view()) {
4117 FrameViewBase* focusFrameViewBase = widgetForElement(*m_focusedElement); 4111 FrameViewBase* focusFrameViewBase = m_focusedElement->frameViewBase();
4118 if (focusFrameViewBase) { 4112 if (focusFrameViewBase) {
4119 // Make sure a FrameViewBase has the right size before giving it focus. 4113 // Make sure a FrameViewBase has the right size before giving it focus.
4120 // Otherwise, we are testing edge cases of the FrameViewBase code. 4114 // Otherwise, we are testing edge cases of the FrameViewBase code.
4121 // Specifically, in WebCore this does not work well for text fields. 4115 // Specifically, in WebCore this does not work well for text fields.
4122 updateStyleAndLayout(); 4116 updateStyleAndLayout();
4123 // Re-get the FrameViewBase in case updating the layout changed things. 4117 // Re-get the FrameViewBase in case updating the layout changed things.
4124 focusFrameViewBase = widgetForElement(*m_focusedElement); 4118 focusFrameViewBase = m_focusedElement->frameViewBase();
4125 } 4119 }
4126 if (focusFrameViewBase) 4120 if (focusFrameViewBase)
4127 focusFrameViewBase->setFocused(true, params.type); 4121 focusFrameViewBase->setFocused(true, params.type);
4128 else 4122 else
4129 view()->setFocused(true, params.type); 4123 view()->setFocused(true, params.type);
4130 } 4124 }
4131 } 4125 }
4132 4126
4133 if (!focusChangeBlocked && m_focusedElement) { 4127 if (!focusChangeBlocked && m_focusedElement) {
4134 // Create the AXObject cache in a focus change because Chromium relies on 4128 // Create the AXObject cache in a focus change because Chromium relies on
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after
6666 } 6660 }
6667 6661
6668 void showLiveDocumentInstances() { 6662 void showLiveDocumentInstances() {
6669 WeakDocumentSet& set = liveDocumentSet(); 6663 WeakDocumentSet& set = liveDocumentSet();
6670 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6671 for (blink::Document* document : set) 6665 for (blink::Document* document : set)
6672 fprintf(stderr, "- Document %p URL: %s\n", document, 6666 fprintf(stderr, "- Document %p URL: %s\n", document,
6673 document->url().getString().utf8().data()); 6667 document->url().getString().utf8().data());
6674 } 6668 }
6675 #endif 6669 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Node.h » ('j') | third_party/WebKit/Source/core/dom/Node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698