- fixed <rdar://problem/
3943038> <input type=search> that is focused in onload handler doesn't have a visible editor
* khtml/xml/dom_docimpl.cpp: (DocumentImpl::setFocusNode): Always update layout before giving focus to a widget.
This prevents the bad case where we give a widget focus before it has been positioned or sized, causing us to
exercise edge cases AppKit doesn't handle well.
* kwq/KWQTextField.mm: (-[KWQTextFieldController initWithTextField:QLineEdit:]): Remove workaround code I added
to fix bug
3943049. Updating the layout fixes the same problem in a cleaner, safer way, and solves another problem,
with the way the clip view is set up.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8533
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-02-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3943038> <input type=search> that is focused in onload handler doesn't have a visible editor
+
+ * khtml/xml/dom_docimpl.cpp: (DocumentImpl::setFocusNode): Always update layout before giving focus to a widget.
+ This prevents the bad case where we give a widget focus before it has been positioned or sized, causing us to
+ exercise edge cases AppKit doesn't handle well.
+
+ * kwq/KWQTextField.mm: (-[KWQTextFieldController initWithTextField:QLineEdit:]): Remove workaround code I added
+ to fix bug 3943049. Updating the layout fixes the same problem in a cleaner, safer way, and solves another problem,
+ with the way the clip view is set up.
+
2005-02-06 Darin Adler <darin@apple.com>
Reviewed by Maciej.
if (getDocument()->view()) {
if (!m_focusNode->renderer() || !m_focusNode->renderer()->isWidget())
getDocument()->view()->setFocus();
- else if (static_cast<RenderWidget*>(m_focusNode->renderer())->widget())
+ else if (static_cast<RenderWidget*>(m_focusNode->renderer())->widget()) {
+ // Make sure a widget has the right size before giving it focus.
+ // Otherwise, we are testing edge cases of the QWidget code.
+ // Specifically, in WebCore this does not work well for text fields.
+ getDocument()->updateLayout();
static_cast<RenderWidget*>(m_focusNode->renderer())->widget()->setFocus();
+ }
}
}
[field setAction:@selector(action:)];
}
- // Set a non-empty size in case the field is made first responder before it
- // is positioned and sized by KHTML code. This dodges bad behavior in AppKit
- // if you try to create an editor for a 0-sized text field.
- // For a secure text field, this is both unnecessary and harmful, so leave
- // it out; worth figuring out why at some point.
- if (![field isKindOfClass:[NSSecureTextField class]]) {
- [field setFrameSize:NSMakeSize(100, 100)];
- }
-
return self;
}