diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-29 10:36:30 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-29 10:41:41 (GMT) |
commit | bb917438a942da68e065a4810b29697a1340cdd6 (patch) | |
tree | 84f2f55fda1d2895bc2d0f10529fcdbbef76adef /src/3rdparty/webkit/WebCore/html | |
parent | f234e50f3d29c4a7dfefd89d537787b1fc327eb2 (diff) | |
download | Qt-bb917438a942da68e065a4810b29697a1340cdd6.zip Qt-bb917438a942da68e065a4810b29697a1340cdd6.tar.gz Qt-bb917438a942da68e065a4810b29697a1340cdd6.tar.bz2 |
Updated WebKit from /home/joce/dev/qtwebkit/ to qtwebkit-4.6-snapshot-29092009-2 ( 999c28aa9f6ad9e0d6a26a794220e1cb45408a97 )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2009-09-28 HJK
Reviewed by Simon Hausmann.
Compile fix with namespaced Qt.
* Api/qwebinspector_p.h:
2009-09-27 Joe Ligman <joseph.ligman@mindspring.com>
Reviewed by Simon Hausmann.
[Qt] Adding API setFocus and hasFocus to QWebElement. This API is needed for
clients that want to check/set the focus node of the document.
https://bugs.webkit.org/show_bug.cgi?id=29682
* Api/qwebelement.cpp:
(QWebElement::hasFocus):
(QWebElement::setFocus):
* Api/qwebelement.h:
* tests/qwebelement/tst_qwebelement.cpp:
(tst_QWebElement::hasSetFocus):
2009-09-25 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Simon Hausmann.
[Qt] Make tst_qwebframe work if Qt built without SSL support
https://bugs.webkit.org/show_bug.cgi?id=29735
* tests/qwebframe/tst_qwebframe.cpp: Missing #ifndef blocks added.
2009-09-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Update QWebElement API to remove script related methods.
QWebElement::evaluateScript is the only one kept, these are
removed to postpone most of the QtWebKit<->JavaScript API design
after 4.6.
https://bugs.webkit.org/show_bug.cgi?id=29708
* Api/qwebelement.cpp:
* Api/qwebelement.h:
Methods removed:
- QWebElement::callFunction
- QWebElement::functions
- QWebElement::scriptableProperty
- QWebElement::setScriptableProperty
- QWebElement::scriptableProperties
* tests/qwebelement/tst_qwebelement.cpp:
(tst_QWebElement::evaluateScript):
2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Rename QWebElement::evaluateScript
to QWebElement::evaluateJavaScript.
https://bugs.webkit.org/show_bug.cgi?id=29709
* Api/qwebelement.cpp:
(QWebElement::evaluateJavaScript):
* Api/qwebelement.h:
* tests/qwebelement/tst_qwebelement.cpp:
(tst_QWebElement::evaluateJavaScript):
2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Update the stypeProperty API of QWebElement.
https://bugs.webkit.org/show_bug.cgi?id=29711
* Api/qwebelement.cpp:
(QWebElement::styleProperty):
- Merge the stypeProperty and the computedStyleProperty methods
- Remove the default value for the style resolving enum
- Rename ResolveRule to StyleResolveStrategy
(QWebElement::setStyleProperty):
- Remove the priority argument since it is possible to control the
behaviour by adding !important or removing in the value.
* Api/qwebelement.h:
* tests/qwebelement/tst_qwebelement.cpp:
(tst_QWebElement::style):
(tst_QWebElement::computedStyle):
* tests/qwebframe/tst_qwebframe.cpp:
2009-09-24 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by Alice Liu.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
Pass 0 for new Page constructor argument.
Diffstat (limited to 'src/3rdparty/webkit/WebCore/html')
7 files changed, 82 insertions, 59 deletions
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp index bc74ecf..8e66fe0 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp @@ -39,6 +39,7 @@ #include "MappedAttribute.h" #include "Page.h" #include "RenderBox.h" +#include "RenderTextControl.h" #include "RenderTheme.h" #include "ValidityState.h" @@ -368,4 +369,43 @@ void HTMLFormControlElementWithState::finishParsingChildren() } } +HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* form) + : HTMLFormControlElementWithState(tagName, doc, form) +{ +} + +HTMLTextFormControlElement::~HTMLTextFormControlElement() +{ +} + +void HTMLTextFormControlElement::dispatchFocusEvent() +{ + if (supportsPlaceholder()) + updatePlaceholderVisibility(false); + handleFocusEvent(); + HTMLFormControlElementWithState::dispatchFocusEvent(); +} + +void HTMLTextFormControlElement::dispatchBlurEvent() +{ + if (supportsPlaceholder()) + updatePlaceholderVisibility(false); + handleBlurEvent(); + HTMLFormControlElementWithState::dispatchBlurEvent(); +} + +bool HTMLTextFormControlElement::placeholderShouldBeVisible() const +{ + return supportsPlaceholder() + && isEmptyValue() + && document()->focusedNode() != this + && !getAttribute(placeholderAttr).isEmpty(); +} + +void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderValueChanged) +{ + if (supportsPlaceholder() && renderer()) + toRenderTextControl(renderer())->updatePlaceholderVisibility(placeholderShouldBeVisible(), placeholderValueChanged); +} + } // namespace Webcore diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h index ee7d772..7b3cfbd 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h @@ -143,6 +143,28 @@ protected: virtual void didMoveToNewOwnerDocument(); }; +class HTMLTextFormControlElement : public HTMLFormControlElementWithState { +public: + HTMLTextFormControlElement(const QualifiedName&, Document*, HTMLFormElement*); + virtual ~HTMLTextFormControlElement(); + virtual void dispatchFocusEvent(); + virtual void dispatchBlurEvent(); + +protected: + bool placeholderShouldBeVisible() const; + void updatePlaceholderVisibility(bool); + +private: + // A subclass should return true if placeholder processing is needed. + virtual bool supportsPlaceholder() const = 0; + // Returns true if user-editable value is empty. This is used to check placeholder visibility. + virtual bool isEmptyValue() const = 0; + // Called in dispatchFocusEvent(), after placeholder process, before calling parent's dispatchFocusEvent(). + virtual void handleFocusEvent() { } + // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent(). + virtual void handleBlurEvent() { } +}; + } //namespace #endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index 5ba780a..0aefe7f 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -71,7 +71,7 @@ using namespace HTMLNames; const int maxSavedResults = 256; HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f) - : HTMLFormControlElementWithState(tagName, doc, f) + : HTMLTextFormControlElement(tagName, doc, f) , m_xPos(0) , m_yPos(0) , m_maxResults(-1) @@ -257,20 +257,17 @@ bool HTMLInputElement::shouldUseInputMethod() const return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX; } -void HTMLInputElement::dispatchFocusEvent() +void HTMLInputElement::handleFocusEvent() { InputElement::dispatchFocusEvent(this, this); if (isTextField()) m_autofilled = false; - - HTMLFormControlElementWithState::dispatchFocusEvent(); } -void HTMLInputElement::dispatchBlurEvent() +void HTMLInputElement::handleBlurEvent() { InputElement::dispatchBlurEvent(this, this); - HTMLFormControlElementWithState::dispatchBlurEvent(); } void HTMLInputElement::setType(const String& t) @@ -741,8 +738,7 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) } setNeedsStyleRecalc(); } else if (attr->name() == placeholderAttr) { - if (isTextField()) - updatePlaceholderVisibility(); + updatePlaceholderVisibility(true); } else if (attr->name() == autosaveAttr || attr->name() == incrementalAttr || attr->name() == minAttr || @@ -814,7 +810,7 @@ RenderObject *HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle * case TELEPHONE: case TEXT: case URL: - return new (arena) RenderTextControlSingleLine(this); + return new (arena) RenderTextControlSingleLine(this, placeholderShouldBeVisible()); } ASSERT(false); return 0; @@ -1111,7 +1107,7 @@ void HTMLInputElement::setValue(const String& value) else { m_data.setValue(sanitizeValue(value)); if (isTextField()) { - InputElement::updatePlaceholderVisibility(this, this); + updatePlaceholderVisibility(false); if (inDocument()) document()->updateStyleIfNeeded(); } @@ -1151,6 +1147,7 @@ void HTMLInputElement::setValueFromRenderer(const String& value) { // File upload controls will always use setFileListFromRenderer. ASSERT(inputType() != FILE); + updatePlaceholderVisibility(false); InputElement::setValueFromRenderer(m_data, this, this, value); } @@ -1790,11 +1787,6 @@ bool HTMLInputElement::willValidate() const inputType() != BUTTON && inputType() != RESET; } -bool HTMLInputElement::placeholderShouldBeVisible() const -{ - return InputElement::placeholderShouldBeVisible(this, this); -} - bool HTMLInputElement::formStringToDouble(const String& src, double* out) { // See HTML5 2.4.4.3 `Real numbers.' diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h index 8f273cb..63d1634 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h @@ -37,7 +37,7 @@ class HTMLOptionElement; class KURL; class VisibleSelection; -class HTMLInputElement : public HTMLFormControlElementWithState, public InputElement { +class HTMLInputElement : public HTMLTextFormControlElement, public InputElement { public: enum InputType { TEXT, @@ -75,8 +75,6 @@ public: virtual bool isKeyboardFocusable(KeyboardEvent*) const; virtual bool isMouseFocusable() const; virtual bool isEnumeratable() const { return inputType() != IMAGE; } - virtual void dispatchFocusEvent(); - virtual void dispatchBlurEvent(); virtual void updateFocusAppearance(bool restorePreviousSelection); virtual void aboutToUnload(); virtual bool shouldUseInputMethod() const; @@ -230,8 +228,6 @@ public: virtual bool willValidate() const; - virtual bool placeholderShouldBeVisible() const; - // Converts the specified string to a floating number. // If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures. This returns false for an empty string input. // The double* parameter may be 0. @@ -241,11 +237,6 @@ protected: virtual void willMoveToNewOwnerDocument(); virtual void didMoveToNewOwnerDocument(); - void updatePlaceholderVisibility() - { - InputElement::updatePlaceholderVisibility(this, this, true); - } - private: bool storesValueSeparateFromAttribute() const; @@ -253,6 +244,11 @@ private: void registerForActivationCallbackIfNeeded(); void unregisterForActivationCallbackIfNeeded(); + virtual bool supportsPlaceholder() const { return isTextField(); } + virtual bool isEmptyValue() const { return value().isEmpty(); } + virtual void handleFocusEvent(); + virtual void handleBlurEvent(); + virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.cpp index bcfa623..31fafa6 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.cpp @@ -44,7 +44,7 @@ void HTMLIsIndexElement::parseMappedAttribute(MappedAttribute* attr) if (attr->name() == promptAttr) setValue(attr->value()); else if (attr->name() == placeholderAttr) - updatePlaceholderVisibility(); + updatePlaceholderVisibility(true); else // don't call HTMLInputElement::parseMappedAttribute here, as it would // accept attributes this element does not support diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp index 3cf4852..f398fc2 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp @@ -63,7 +63,7 @@ static inline void notifyFormStateChanged(const HTMLTextAreaElement* element) } HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) - : HTMLFormControlElementWithState(tagName, document, form) + : HTMLTextFormControlElement(tagName, document, form) , m_rows(defaultRows) , m_cols(defaultCols) , m_wrap(SoftWrap) @@ -211,7 +211,7 @@ void HTMLTextAreaElement::parseMappedAttribute(MappedAttribute* attr) RenderObject* HTMLTextAreaElement::createRenderer(RenderArena* arena, RenderStyle*) { - return new (arena) RenderTextControlMultiLine(this); + return new (arena) RenderTextControlMultiLine(this, placeholderShouldBeVisible()); } bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool) @@ -448,29 +448,4 @@ bool HTMLTextAreaElement::shouldUseInputMethod() const return true; } -bool HTMLTextAreaElement::placeholderShouldBeVisible() const -{ - return value().isEmpty() - && document()->focusedNode() != this - && !getAttribute(placeholderAttr).isEmpty(); -} - -void HTMLTextAreaElement::updatePlaceholderVisibility(bool placeholderValueChanged) -{ - if (renderer()) - toRenderTextControl(renderer())->updatePlaceholderVisibility(placeholderShouldBeVisible(), placeholderValueChanged); -} - -void HTMLTextAreaElement::dispatchFocusEvent() -{ - updatePlaceholderVisibility(false); - HTMLFormControlElementWithState::dispatchFocusEvent(); -} - -void HTMLTextAreaElement::dispatchBlurEvent() -{ - updatePlaceholderVisibility(false); - HTMLFormControlElementWithState::dispatchBlurEvent(); -} - } // namespace diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h index fbf519d..ef96fc5 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h @@ -31,7 +31,7 @@ namespace WebCore { class BeforeTextInsertedEvent; class VisibleSelection; -class HTMLTextAreaElement : public HTMLFormControlElementWithState { +class HTMLTextAreaElement : public HTMLTextFormControlElement { public: HTMLTextAreaElement(const QualifiedName&, Document*, HTMLFormElement* = 0); @@ -97,17 +97,15 @@ public: virtual bool shouldUseInputMethod() const; - bool placeholderShouldBeVisible() const; - private: enum WrapMethod { NoWrap, SoftWrap, HardWrap }; void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; static String sanitizeUserInputValue(const String&, unsigned maxLength); void updateValue() const; - void updatePlaceholderVisibility(bool placeholderValueChanged); - virtual void dispatchFocusEvent(); - virtual void dispatchBlurEvent(); + + virtual bool supportsPlaceholder() const { return true; } + virtual bool isEmptyValue() const { return value().isEmpty(); } virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const { return required(); } |