Diff
Modified: trunk/Source/WebCore/ChangeLog (130755 => 130756)
--- trunk/Source/WebCore/ChangeLog 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebCore/ChangeLog 2012-10-09 13:43:14 UTC (rev 130756)
@@ -1,3 +1,20 @@
+2012-10-09 Garrett Casto <[email protected]>
+
+ Allow users to specify a different hover image for TextFieldDecorationElement
+ https://bugs.webkit.org/show_bug.cgi?id=93662
+
+ Reviewed by Kent Tamura.
+
+ * html/shadow/TextFieldDecorationElement.cpp:
+ (WebCore::TextFieldDecorationElement::TextFieldDecorationElement):
+ (WebCore::TextFieldDecorationElement::updateImage):
+ (WebCore::TextFieldDecorationElement::defaultEventHandler): Handles mouseover and mouseout events.
+ (WebCore::TextFieldDecorationElement::willRespondToMouseMoveEvents): Now returns true if the element is not disabled.
+ (WebCore):
+ * html/shadow/TextFieldDecorationElement.h:
+ (TextFieldDecorator):
+ (TextFieldDecorationElement):
+
2012-10-09 Allan Sandfeld Jensen <[email protected]>
[Qt] Uploading images to Google+ using QtWebKit does not work.
Modified: trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp (130755 => 130756)
--- trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp 2012-10-09 13:43:14 UTC (rev 130756)
@@ -57,6 +57,7 @@
TextFieldDecorationElement::TextFieldDecorationElement(Document* document, TextFieldDecorator* decorator)
: HTMLDivElement(HTMLNames::divTag, document)
, m_textFieldDecorator(decorator)
+ , m_isInHoverState(false)
{
ASSERT(decorator);
setHasCustomCallbacks();
@@ -137,6 +138,8 @@
image = m_textFieldDecorator->imageForDisabledState();
else if (hostInput()->readOnly())
image = m_textFieldDecorator->imageForReadonlyState();
+ else if (m_isInHoverState)
+ image = m_textFieldDecorator->imageForHoverState();
else
image = m_textFieldDecorator->imageForNormalState();
ASSERT(image);
@@ -194,10 +197,29 @@
event->setDefaultHandled();
}
+ if (event->type() == eventNames().mouseoverEvent) {
+ m_isInHoverState = true;
+ updateImage();
+ }
+
+ if (event->type() == eventNames().mouseoutEvent) {
+ m_isInHoverState = false;
+ updateImage();
+ }
+
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
}
+bool TextFieldDecorationElement::willRespondToMouseMoveEvents()
+{
+ const HTMLInputElement* input = hostInput();
+ if (!input->disabled() && !input->readOnly())
+ return true;
+
+ return HTMLDivElement::willRespondToMouseMoveEvents();
+}
+
bool TextFieldDecorationElement::willRespondToMouseClickEvents()
{
const HTMLInputElement* input = hostInput();
Modified: trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h (130755 => 130756)
--- trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h 2012-10-09 13:43:14 UTC (rev 130756)
@@ -52,6 +52,7 @@
virtual CachedImage* imageForNormalState() = 0;
virtual CachedImage* imageForDisabledState() = 0;
virtual CachedImage* imageForReadonlyState() = 0;
+ virtual CachedImage* imageForHoverState() = 0;
virtual void handleClick(HTMLInputElement*) = 0;
// This function is called just before detaching the decoration. It must not
@@ -71,6 +72,7 @@
TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; }
void decorate(HTMLInputElement*, bool visible);
+ virtual bool willRespondToMouseMoveEvents() OVERRIDE;
virtual bool willRespondToMouseClickEvents() OVERRIDE;
private:
@@ -87,6 +89,7 @@
void updateImage();
TextFieldDecorator* m_textFieldDecorator;
+ bool m_isInHoverState;
};
inline TextFieldDecorationElement* toTextFieldDecorationElement(Node* node)
Modified: trunk/Source/WebKit/chromium/ChangeLog (130755 => 130756)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-09 13:43:14 UTC (rev 130756)
@@ -1,3 +1,20 @@
+2012-10-09 Garrett Casto <[email protected]>
+
+ Allow users to specify a different hover image for TextFieldDecorationElement
+ https://bugs.webkit.org/show_bug.cgi?id=93662
+
+ Reviewed by Kent Tamura.
+
+ * public/WebTextFieldDecoratorClient.h:
+ (WebTextFieldDecoratorClient):
+ (WebKit::WebTextFieldDecoratorClient::imageNameForHoverState): Allow users to specify the name of the image for mouseover.
+ * src/TextFieldDecoratorImpl.cpp:
+ (WebKit::TextFieldDecoratorImpl::imageForReadonlyState):
+ (WebKit::TextFieldDecoratorImpl::imageForHoverState):
+ (WebKit):
+ * src/TextFieldDecoratorImpl.h:
+ (TextFieldDecoratorImpl):
+
2012-10-09 Keishi Hattori <[email protected]>
Page popup should be smarter about its layout
Modified: trunk/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h (130755 => 130756)
--- trunk/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h 2012-10-09 13:43:14 UTC (rev 130756)
@@ -58,9 +58,13 @@
// empty string, imageNameForNormalState() is used even for the disabled
// state.
virtual WebCString imageNameForDisabledState() = 0;
- // Image resource name for the disabled state. If this function returns an
+ // Image resource name for the read only state. If this function returns an
// empty string, the image same as imageNameForDisabledState() is used.
virtual WebCString imageNameForReadOnlyState() = 0;
+ // Image resource name for when the imaged is being hovered over. If this
+ // function returns an empty string, imageNameForNormalState() is used
+ // instead.
+ virtual WebCString imageNameForHoverState() {return WebCString();}
// This is called when the decoration icon is clicked.
virtual void handleClick(WebInputElement&) = 0;
Modified: trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp (130755 => 130756)
--- trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp 2012-10-09 13:43:14 UTC (rev 130756)
@@ -103,7 +103,7 @@
if (!m_cachedImageForReadonlyState) {
WebCString imageName = m_client->imageNameForReadOnlyState();
if (imageName.isEmpty())
- m_cachedImageForDisabledState = imageForDisabledState();
+ m_cachedImageForReadonlyState = imageForDisabledState();
else {
RefPtr<Image> image = Image::loadPlatformResource(imageName.data());
m_cachedImageForReadonlyState = new CachedImage(image.get());
@@ -112,6 +112,20 @@
return m_cachedImageForReadonlyState.get();
}
+CachedImage* TextFieldDecoratorImpl::imageForHoverState()
+{
+ if (!m_cachedImageForHoverState) {
+ WebCString imageName = m_client->imageNameForHoverState();
+ if (imageName.isEmpty())
+ m_cachedImageForHoverState = imageForNormalState();
+ else {
+ RefPtr<Image> image = Image::loadPlatformResource(imageName.data());
+ m_cachedImageForHoverState = new CachedImage(image.get());
+ }
+ }
+ return m_cachedImageForHoverState.get();
+}
+
void TextFieldDecoratorImpl::handleClick(HTMLInputElement* input)
{
ASSERT(input);
Modified: trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h (130755 => 130756)
--- trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h 2012-10-09 13:31:18 UTC (rev 130755)
+++ trunk/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h 2012-10-09 13:43:14 UTC (rev 130756)
@@ -51,6 +51,7 @@
virtual WebCore::CachedImage* imageForNormalState() OVERRIDE;
virtual WebCore::CachedImage* imageForDisabledState() OVERRIDE;
virtual WebCore::CachedImage* imageForReadonlyState() OVERRIDE;
+ virtual WebCore::CachedImage* imageForHoverState() OVERRIDE;
virtual void handleClick(WebCore::HTMLInputElement*) OVERRIDE;
virtual void willDetach(WebCore::HTMLInputElement*) OVERRIDE;
@@ -60,6 +61,7 @@
WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForNormalState;
WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForDisabledState;
WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForReadonlyState;
+ WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForHoverState;
};
}