Implement form validation message UI
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jan 2011 06:21:51 +0000 (06:21 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jan 2011 06:21:51 +0000 (06:21 +0000)
commit1dcc83e74b7ec83da2bb3dbf0711658b66bc15a3
tree5f4d24ff5249927223e68edb496986f75721f384
parent5e11a65073f222b2ea5d3920e970fc7264048b7c
Implement form validation message UI
https://bugs.webkit.org/show_bug.cgi?id=48980

Reviewed by Dimitri Glazkov.

* Add four internal pseudo selectors:
  - -webkit-validation-bubble
  - -webkit-validation-bubble-message
  - -webkit-validation-bubble-top-outer-arrow
  - -webkit-validation-bubble-top-inner-arrow

* Implement ValidationMessage functions
  Show the message for <the number of characters> / 20.0 seconds.

No new tests because the feature is disabled by default for now and the
new behavior is strongly timing-dependent.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::canShareStyleWithElement):
  Do not share a style with elements with different shadowPseudoId().
* css/html.css: Define appearance for the internal selectors.
(::-webkit-validation-bubble):
(::-webkit-validation-bubble-message):
(::-webkit-validation-bubble-top-outer-arrow):
(::-webkit-validation-bubble-top-inner-arrow):
* dom/Node.cpp:
(WebCore::Node::createRendererIfNeeded):
  Allow to add shadow renderers even if canHaveChildren() returns false.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::detach):
  Remove m_validationMessage immediately because we can't use
  hideVisibleValidationMessage(), which calls a ValidationMessage function later.
(WebCore::HTMLFormControlElement::updateVisibleValidationMessage):
  - Don't create ValidationMessage if the message is empty.
  - Remove the check for message equality.
(WebCore::HTMLFormControlElement::hideVisibleValidationMessage):
  Don't remove m_validationMessage immediately. We shouldn't make the
  element needsLayout() state in this context.
* html/ValidationMessage.cpp:
(WebCore::ValidationMessage::~ValidationMessage):
  hideMessage() -> deleteBubbleTree() renaming.
(WebCore::ValidationMessage::setMessage): Implemented.
(WebCore::ValidationMessage::setMessageDOMAndStartTimer):
  Added. This updates the validation message and starts the timer to hide it.
(WebCore::ElementWithPseudoId):
  Added to help implementations of styled shadow nodes.
(WebCore::ValidationMessage::buildBubbleTree): Added.
(WebCore::ValidationMessage::requestToHideMessage): Added.
(WebCore::ValidationMessage::deleteBubbleTree):
  Renamed from hideMessage(), and implemented.
* html/ValidationMessage.h: Add declarations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/html.css
Source/WebCore/dom/Node.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/ValidationMessage.cpp
Source/WebCore/html/ValidationMessage.h