| OLD | NEW |
| 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 Loading... |
| 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) { | 371 static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) { |
| 372 LayoutObject* layoutObject = focusedElement.layoutObject(); | 372 LayoutObject* layoutObject = focusedElement.layoutObject(); |
| 373 if (!layoutObject || !layoutObject->isLayoutPart()) | 373 if (!layoutObject || !layoutObject->isLayoutPart()) |
| 374 return 0; | 374 return 0; |
| 375 return toLayoutPart(layoutObject)->frameViewBase(); | 375 return toLayoutPart(layoutObject)->frameViewBase(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 static bool acceptsEditingFocus(const Element& element) { | 378 static bool acceptsEditingFocus(const Element& element) { |
| 379 DCHECK(hasEditableStyle(element)); | 379 DCHECK(hasEditableStyle(element)); |
| 380 | 380 |
| 381 return element.document().frame() && rootEditableElement(element); | 381 return element.document().frame() && rootEditableElement(element); |
| (...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 params.sourceCapabilities); | 4033 params.sourceCapabilities); |
| 4034 | 4034 |
| 4035 if (m_focusedElement) { | 4035 if (m_focusedElement) { |
| 4036 // handler shifted focus | 4036 // handler shifted focus |
| 4037 focusChangeBlocked = true; | 4037 focusChangeBlocked = true; |
| 4038 newFocusedElement = nullptr; | 4038 newFocusedElement = nullptr; |
| 4039 } | 4039 } |
| 4040 } | 4040 } |
| 4041 | 4041 |
| 4042 if (view()) { | 4042 if (view()) { |
| 4043 FrameViewBase* oldFrameViewBase = widgetForElement(*oldFocusedElement); | 4043 FrameViewBase* oldFrameViewBase = |
| 4044 frameViewBaseForElement(*oldFocusedElement); |
| 4044 if (oldFrameViewBase) | 4045 if (oldFrameViewBase) |
| 4045 oldFrameViewBase->setFocused(false, params.type); | 4046 oldFrameViewBase->setFocused(false, params.type); |
| 4046 else | 4047 else |
| 4047 view()->setFocused(false, params.type); | 4048 view()->setFocused(false, params.type); |
| 4048 } | 4049 } |
| 4049 } | 4050 } |
| 4050 | 4051 |
| 4051 if (newFocusedElement) | 4052 if (newFocusedElement) |
| 4052 updateStyleAndLayoutTreeForNode(newFocusedElement); | 4053 updateStyleAndLayoutTreeForNode(newFocusedElement); |
| 4053 if (newFocusedElement && newFocusedElement->isFocusable()) { | 4054 if (newFocusedElement && newFocusedElement->isFocusable()) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 goto SetFocusedElementDone; | 4108 goto SetFocusedElementDone; |
| 4108 } | 4109 } |
| 4109 } | 4110 } |
| 4110 | 4111 |
| 4111 if (isRootEditableElement(*m_focusedElement)) | 4112 if (isRootEditableElement(*m_focusedElement)) |
| 4112 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); | 4113 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); |
| 4113 | 4114 |
| 4114 // eww, I suck. set the qt focus correctly | 4115 // eww, I suck. set the qt focus correctly |
| 4115 // ### find a better place in the code for this | 4116 // ### find a better place in the code for this |
| 4116 if (view()) { | 4117 if (view()) { |
| 4117 FrameViewBase* focusFrameViewBase = widgetForElement(*m_focusedElement); | 4118 FrameViewBase* focusFrameViewBase = |
| 4119 frameViewBaseForElement(*m_focusedElement); |
| 4118 if (focusFrameViewBase) { | 4120 if (focusFrameViewBase) { |
| 4119 // Make sure a FrameViewBase has the right size before giving it focus. | 4121 // Make sure a FrameViewBase has the right size before giving it focus. |
| 4120 // Otherwise, we are testing edge cases of the FrameViewBase code. | 4122 // Otherwise, we are testing edge cases of the FrameViewBase code. |
| 4121 // Specifically, in WebCore this does not work well for text fields. | 4123 // Specifically, in WebCore this does not work well for text fields. |
| 4122 updateStyleAndLayout(); | 4124 updateStyleAndLayout(); |
| 4123 // Re-get the FrameViewBase in case updating the layout changed things. | 4125 // Re-get the FrameViewBase in case updating the layout changed things. |
| 4124 focusFrameViewBase = widgetForElement(*m_focusedElement); | 4126 focusFrameViewBase = frameViewBaseForElement(*m_focusedElement); |
| 4125 } | 4127 } |
| 4126 if (focusFrameViewBase) | 4128 if (focusFrameViewBase) |
| 4127 focusFrameViewBase->setFocused(true, params.type); | 4129 focusFrameViewBase->setFocused(true, params.type); |
| 4128 else | 4130 else |
| 4129 view()->setFocused(true, params.type); | 4131 view()->setFocused(true, params.type); |
| 4130 } | 4132 } |
| 4131 } | 4133 } |
| 4132 | 4134 |
| 4133 if (!focusChangeBlocked && m_focusedElement) { | 4135 if (!focusChangeBlocked && m_focusedElement) { |
| 4134 // Create the AXObject cache in a focus change because Chromium relies on | 4136 // Create the AXObject cache in a focus change because Chromium relies on |
| (...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6678 } | 6680 } |
| 6679 | 6681 |
| 6680 void showLiveDocumentInstances() { | 6682 void showLiveDocumentInstances() { |
| 6681 WeakDocumentSet& set = liveDocumentSet(); | 6683 WeakDocumentSet& set = liveDocumentSet(); |
| 6682 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6684 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6683 for (blink::Document* document : set) | 6685 for (blink::Document* document : set) |
| 6684 fprintf(stderr, "- Document %p URL: %s\n", document, | 6686 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6685 document->url().getString().utf8().data()); | 6687 document->url().getString().utf8().data()); |
| 6686 } | 6688 } |
| 6687 #endif | 6689 #endif |
| OLD | NEW |