Reviewed by Justin.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8106
REGRESSION (NativeTextField): New text fields don't scroll to the beginning when losing focus
* fast/forms/input-text-scroll-left-on-blur-expected.png: Added.
* fast/forms/input-text-scroll-left-on-blur-expected.txt: Added.
* fast/forms/input-text-scroll-left-on-blur-expected.checksum: Added.
* fast/forms/input-text-scroll-left-on-blur.html: Added.
WebCore:
Reviewed by Justin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8106
REGRESSION (NativeTextField): New text fields don't scroll to the beginning when losing focus
Test: fast/forms/input-text-scroll-left-on-blur.html
* html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): Pass blur events
through to the RenderTextField, as well as mouse, drag, and wheel events.
* rendering/RenderTextField.cpp: (WebCore::RenderTextField::forwardEvent): Scroll all the way to
the left on a blur.
- unrelated small changes
* html/HTMLTextFieldInnerElement.cpp: Removed excess includes.
(WebCore::HTMLTextFieldInnerElement::defaultEventHandler): Tweaked comments a bit.
* dom/Element.cpp:
(WebCore::Element::scrollIntoView): Removed unneeded this-> before function call.
(WebCore::Element::scrollIntoViewIfNeeded): Ditto.
* page/FrameView.cpp: (WebCore::FrameView::dispatchMouseEvent): Removed obsolete comment.
WebKitTools:
Reviewed by Justin.
* DumpRenderTree/EventSendingController.m: (-[EventSendingController keyDown:withModifiers:]):
Fixed keyDown function so that it will work if you don't pass an array of modifiers or if
elements in that array are not strings.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13630
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-04-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Justin.
+
+ - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8106
+ REGRESSION (NativeTextField): New text fields don't scroll to the beginning when losing focus
+
+ * fast/forms/input-text-scroll-left-on-blur-expected.png: Added.
+ * fast/forms/input-text-scroll-left-on-blur-expected.txt: Added.
+ * fast/forms/input-text-scroll-left-on-blur-expected.checksum: Added.
+ * fast/forms/input-text-scroll-left-on-blur.html: Added.
+
2006-04-01 Darin Adler <darin@apple.com>
- re-updated many pixel results to try to create a new baseline
--- /dev/null
+861eb966f62499267d70711e0fc911f8
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:l replacingDOMRange:range from 65 of #text > DIV to 65 of #text > DIV givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 65 of #text > DIV to 65 of #text > DIV toDOMRange:range from 66 of #text > DIV to 66 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:l replacingDOMRange:range from 65 of #text > DIV to 65 of #text > DIV givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 65 of #text > DIV to 65 of #text > DIV toDOMRange:range from 66 of #text > DIV to 66 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock (anonymous) at (0,0) size 784x23
+ RenderTextField {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+ RenderText {TEXT} at (152,2) size 4x18
+ text run at (152,2) width 4: " "
+ RenderTextField {INPUT} at (158,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {P} at (0,39) size 784x36
+ RenderText {TEXT} at (0,0) size 777x36
+ text run at (0,0) width 777: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second scrolled"
+ text run at (0,18) width 72: "to the right."
+layer at (13,13) size 142x13 scrollWidth 321
+ RenderBlock {DIV} at (3,3) size 142x13
+ RenderText {TEXT} at (1,0) size 319x13
+ text run at (1,0) width 319: "this text field has a lot of text in it so that it needs to scroll"
+layer at (169,13) size 142x13 scrollX 179 scrollWidth 321
+ RenderBlock {DIV} at (3,3) size 142x13
+ RenderText {TEXT} at (1,0) size 319x13
+ text run at (1,0) width 319: "this text field has a lot of text in it so that it needs to scroll"
+caret: position 66 of child 0 {TEXT} of document
--- /dev/null
+<input id="a" type="text" value="this text field has a lot of text in it so that it needs to scrol">
+<input id="b" type="text" value="this text field has a lot of text in it so that it needs to scrol">
+<p>Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second scrolled to the right.</p>
+<script>
+var a = document.getElementById("a");
+a.focus();
+a.setSelectionRange(66, 66);
+if (window.eventSender) {
+ eventSender.keyDown("l");
+}
+a.blur();
+var b = document.getElementById("b");
+b.focus();
+b.setSelectionRange(66, 66);
+if (window.eventSender) {
+ eventSender.keyDown("l");
+}
+</script>
+2006-04-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Justin.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8106
+ REGRESSION (NativeTextField): New text fields don't scroll to the beginning when losing focus
+
+ Test: fast/forms/input-text-scroll-left-on-blur.html
+
+ * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): Pass blur events
+ through to the RenderTextField, as well as mouse, drag, and wheel events.
+ * rendering/RenderTextField.cpp: (WebCore::RenderTextField::forwardEvent): Scroll all the way to
+ the left on a blur.
+
+ - unrelated small changes
+
+ * html/HTMLTextFieldInnerElement.cpp: Removed excess includes.
+ (WebCore::HTMLTextFieldInnerElement::defaultEventHandler): Tweaked comments a bit.
+
+ * dom/Element.cpp:
+ (WebCore::Element::scrollIntoView): Removed unneeded this-> before function call.
+ (WebCore::Element::scrollIntoViewIfNeeded): Ditto.
+
+ * page/FrameView.cpp: (WebCore::FrameView::dispatchMouseEvent): Removed obsolete comment.
+
2006-03-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adele.
void Element::scrollIntoView(bool alignToTop)
{
- IntRect bounds = this->getRect();
+ IntRect bounds = getRect();
if (renderer()) {
// Align to the top / bottom and to the closest edge.
if (alignToTop)
void Element::scrollIntoViewIfNeeded(bool centerIfNeeded)
{
- IntRect bounds = this->getRect();
+ IntRect bounds = getRect();
if (renderer()) {
if (centerIfNeeded)
renderer()->enclosingLayer()->scrollRectToVisible(bounds, RenderLayer::gAlignCenterIfNeeded, RenderLayer::gAlignCenterIfNeeded);
}
}
- if (m_type == TEXT && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent()) && renderer())
+ if (m_type == TEXT && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == blurEvent) && renderer())
static_cast<RenderTextField*>(renderer())->forwardEvent(evt);
HTMLGenericFormElement::defaultEventHandler(evt);
#include "BeforeTextInsertedEvent.h"
#include "EventNames.h"
-#include "dom2_eventsimpl.h"
-#include "HTMLDocument.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
-#include "RenderObject.h"
#include "RenderTextField.h"
namespace WebCore {
void HTMLTextFieldInnerElement::defaultEventHandler(Event* evt)
{
- // FIXME: In the future, we should add a way to have default event listeners. Then we would add one to the text field's inner div, and we wouldn't need this subclass.
+ // FIXME: In the future, we should add a way to have default event listeners. Then we would add one to the text field's inner div, and we wouldn't need this subclass.
if (shadowParentNode() && shadowParentNode()->hasTagName(inputTag) && shadowParentNode()->renderer() && shadowParentNode()->renderer()->isTextField()) {
if (evt->isBeforeTextInsertedEvent())
static_cast<HTMLInputElement*>(shadowParentNode())->defaultEventHandler(evt);
if (evt->type() == khtmlEditableContentChangedEvent) {
- // FIXME: When other text fields switch to the Non-NSView implementation, we may beed to add them here.
+ // FIXME: When other text fields switch to the Non-NSView implementation, we may beed to add them here.
if (static_cast<HTMLInputElement*>(shadowParentNode())->inputType() == HTMLInputElement::TEXT)
static_cast<RenderTextField*>(shadowParentNode()->renderer())->subtreeHasChanged();
}
}
+
HTMLDivElement::defaultEventHandler(evt);
}
swallowEvent = EventTargetNodeCast(targetNode)->dispatchMouseEvent(mouseEvent, eventType, clickCount);
if (!swallowEvent && eventType == mousedownEvent) {
- // Focus should be shifted on mouse down, not on a click. -dwh
// Blur current focus node when a link/button is clicked; this
// is expected by some sites that rely on onChange handlers running
// from form fields before the button click is processed.
#include "config.h"
#include "RenderTextField.h"
-#include <algorithm>
#include "Document.h"
+#include "EventNames.h"
#include "Frame.h"
-#include "RenderText.h"
-#include "HTMLNames.h"
#include "HTMLInputElement.h"
+#include "HTMLNames.h"
#include "HTMLTextFieldInnerElement.h"
+#include "RenderText.h"
#include "SelectionController.h"
-#include "VisiblePosition.h"
#include "TextIterator.h"
+#include "VisiblePosition.h"
+#include "dom2_eventsimpl.h"
+#include <algorithm>
namespace WebCore {
+using namespace EventNames;
using namespace HTMLNames;
using namespace std;
RenderTextField::RenderTextField(Node* node)
-:RenderBlock(node), m_dirty(false)
+ : RenderBlock(node), m_dirty(false)
{
}
}
}
-
int RenderTextField::selectionStart()
{
return indexForVisiblePosition(document()->frame()->selection().start());
void RenderTextField::forwardEvent(Event* evt)
{
- m_div->defaultEventHandler(evt);
+ if (evt->type() == blurEvent) {
+ RenderObject* innerRenderer = m_div->renderer();
+ if (innerRenderer) {
+ RenderLayer* innerLayer = innerRenderer->layer();
+ if (innerLayer)
+ innerLayer->scrollToOffset(0, 0);
+ }
+ } else
+ m_div->defaultEventHandler(evt);
}
}
+2006-04-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Justin.
+
+ * DumpRenderTree/EventSendingController.m: (-[EventSendingController keyDown:withModifiers:]):
+ Fixed keyDown function so that it will work if you don't pass an array of modifiers or if
+ elements in that array are not strings.
+
2006-03-31 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
NSString *modifier = nil;
int mask = 0;
- for (unsigned i = 0; modifiers && [modifiers webScriptValueAtIndex:i]; i++) {
- modifier = (NSString *)[modifiers webScriptValueAtIndex:i];
- if ([modifier isEqual:@"ctrlKey"])
- mask |= NSControlKeyMask;
- else if ([modifier isEqual:@"shiftKey"])
- mask |= NSShiftKeyMask;
- else if ([modifier isEqual:@"altKey"])
- mask |= NSAlternateKeyMask;
- else if ([modifier isEqual:@"metaKey"])
- mask |= NSCommandKeyMask;
- else
- break;
- }
+ if ([modifiers isKindOfClass:[WebScriptObject class]])
+ for (unsigned i = 0; [[modifiers webScriptValueAtIndex:i] isKindOfClass:[NSString class]]; i++) {
+ modifier = (NSString *)[modifiers webScriptValueAtIndex:i];
+ if ([modifier isEqual:@"ctrlKey"])
+ mask |= NSControlKeyMask;
+ else if ([modifier isEqual:@"shiftKey"])
+ mask |= NSShiftKeyMask;
+ else if ([modifier isEqual:@"altKey"])
+ mask |= NSAlternateKeyMask;
+ else if ([modifier isEqual:@"metaKey"])
+ mask |= NSCommandKeyMask;
+ else
+ break;
+ }
[[[frame frameView] documentView] layout];