Diff
Modified: trunk/Source/WebCore/ChangeLog (149014 => 149015)
--- trunk/Source/WebCore/ChangeLog 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/ChangeLog 2013-04-24 01:59:21 UTC (rev 149015)
@@ -1,3 +1,25 @@
+2013-04-23 Kent Tamura <[email protected]>
+
+ Remove TextFieldDecoration feature
+ https://bugs.webkit.org/show_bug.cgi?id=115068
+
+ Reviewed by Andreas Kling.
+
+ Only Chromium port used this feature.
+
+ * dom/Element.h: Remove isTextFieldDecoration.
+ * html/InputType.cpp:
+ (WebCore::InputType::destroyShadowSubtree):
+ Update a comment.
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::createShadowSubtree):
+ Remove call sites of willAddTextFieldDecorationsTo and addTextFieldDecorationsTo.
+ * html/shadow/TextFieldDecorationElement.cpp: Removed.
+ * html/shadow/TextFieldDecorationElement.h: Removed.
+ * page/ChromeClient.h:
+ (ChromeClient): Remove willAddTextFieldDecorationsTo and
+ addTextFieldDecorationsTo
+
2013-04-23 Andreas Kling <[email protected]>
Micro-optimize Length::initFromLength().
Modified: trunk/Source/WebCore/dom/Element.h (149014 => 149015)
--- trunk/Source/WebCore/dom/Element.h 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/dom/Element.h 2013-04-24 01:59:21 UTC (rev 149015)
@@ -552,7 +552,6 @@
virtual bool isInRange() const { return false; }
virtual bool isOutOfRange() const { return false; }
virtual bool isFrameElementBase() const { return false; }
- virtual bool isTextFieldDecoration() const { return false; }
virtual bool canContainRangeEndPoint() const { return true; }
Modified: trunk/Source/WebCore/html/InputType.cpp (149014 => 149015)
--- trunk/Source/WebCore/html/InputType.cpp 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/html/InputType.cpp 2013-04-24 01:59:21 UTC (rev 149015)
@@ -488,9 +488,8 @@
root->removeChildren();
- // It's ok to clear contents of all other ShadowRoots because they must have
- // been created by TextFieldDecorationElement, and we don't allow adding
- // AuthorShadowRoot to HTMLInputElement.
+ // It's ok to clear contents of all other ShadowRoots because we don't allow
+ // adding AuthorShadowRoot to HTMLInputElement.
while ((root = root->youngerShadowRoot())) {
#if ENABLE(SHADOW_DOM)
root->removeChildren();
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (149014 => 149015)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2013-04-24 01:59:21 UTC (rev 149015)
@@ -34,7 +34,6 @@
#include "BeforeTextInsertedEvent.h"
#include "Chrome.h"
-#include "ChromeClient.h"
#include "Editor.h"
#include "ElementShadow.h"
#include "FormDataList.h"
@@ -233,10 +232,8 @@
ASSERT(!m_innerSpinButton);
Document* document = element()->document();
- ChromeClient* chromeClient = document->page() ? document->page()->chrome()->client() : 0;
- bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element());
bool shouldHaveSpinButton = this->shouldHaveSpinButton();
- bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations;
+ bool createsContainer = shouldHaveSpinButton || needsContainer();
m_innerText = TextControlInnerTextElement::create(document);
if (!createsContainer) {
@@ -265,9 +262,6 @@
m_innerSpinButton = SpinButtonElement::create(document, *this);
m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
}
-
- if (shouldAddDecorations)
- chromeClient->addTextFieldDecorationsTo(element());
}
HTMLElement* TextFieldInputType::containerElement() const
Deleted: trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp (149014 => 149015)
--- trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp 2013-04-24 01:59:21 UTC (rev 149015)
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "TextFieldDecorationElement.h"
-
-#include "CSSPropertyNames.h"
-#include "CSSValueKeywords.h"
-#include "ElementShadow.h"
-#include "Event.h"
-#include "HTMLInputElement.h"
-#include "HTMLShadowElement.h"
-#include "NodeRenderStyle.h"
-#include "RenderImage.h"
-#include "ShadowRoot.h"
-#include "StyleResolver.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-// TextFieldDecorator ----------------------------------------------------------------
-
-TextFieldDecorator::~TextFieldDecorator()
-{
-}
-
-// TextFieldDecorationElement ----------------------------------------------------------------
-
-// FIXME: This class is only used in Chromium, and has no layout tests!!
-
-TextFieldDecorationElement::TextFieldDecorationElement(Document* document, TextFieldDecorator* decorator)
- : HTMLDivElement(HTMLNames::divTag, document)
- , m_textFieldDecorator(decorator)
- , m_isInHoverState(false)
-{
- ASSERT(decorator);
- setHasCustomStyleCallbacks();
-}
-
-PassRefPtr<TextFieldDecorationElement> TextFieldDecorationElement::create(Document* document, TextFieldDecorator* decorator)
-{
- return adoptRef(new TextFieldDecorationElement(document, decorator));
-}
-
-TextFieldDecorationElement* TextFieldDecorationElement::fromShadowRoot(ShadowRoot* shadowRoot)
-{
- if (!shadowRoot->firstChild()
- || !shadowRoot->firstChild()->lastChild()
- || !shadowRoot->firstChild()->lastChild()->isElementNode()
- || !toElement(shadowRoot->firstChild()->lastChild())->isTextFieldDecoration())
- return 0;
- return toTextFieldDecorationElement(shadowRoot->firstChild()->lastChild());
-}
-
-static inline void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot)
-{
- ShadowRoot* existingRoot = input->youngestShadowRoot();
- ShadowRoot* newRoot = 0;
- while (existingRoot->childNodeCount() == 1 && existingRoot->firstChild()->hasTagName(shadowTag)) {
- newRoot = existingRoot;
- existingRoot = existingRoot->olderShadowRoot();
- ASSERT(existingRoot);
- }
- if (newRoot)
- newRoot->removeChild(newRoot->firstChild());
- else {
- // FIXME: This interacts really badly with author shadow roots because now
- // we can interleave user agent and author shadow roots on the element meaning
- // input.shadowRoot may be inaccessible if the browser has decided to decorate
- // the input.
- newRoot = input->ensureShadow()->addShadowRoot(input, ShadowRoot::UserAgentShadowRoot);
- }
- decorationRoot = newRoot;
- decoratedRoot = existingRoot;
-}
-
-void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible)
-{
- ASSERT(input);
- ShadowRoot* existingRoot;
- ShadowRoot* decorationRoot;
- getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot);
- ASSERT(decorationRoot);
- ASSERT(existingRoot);
- RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document());
- decorationRoot->appendChild(box);
- box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueWebkitFlex);
- box->setInlineStyleProperty(CSSPropertyWebkitAlignItems, CSSValueCenter);
- ASSERT(existingRoot->childNodeCount() == 1);
- toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyWebkitFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER);
-#if ENABLE(SHADOW_DOM)
- box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document()));
-#endif
- setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValueNone);
- box->appendChild(this);
-}
-
-inline HTMLInputElement* TextFieldDecorationElement::hostInput()
-{
- // TextFieldDecorationElement is created only by C++ code, and it is always
- // in <input> shadow.
- ASSERT_WITH_SECURITY_IMPLICATION(!shadowHost() || shadowHost()->hasTagName(inputTag));
- return static_cast<HTMLInputElement*>(shadowHost());
-}
-
-bool TextFieldDecorationElement::isTextFieldDecoration() const
-{
- return true;
-}
-
-void TextFieldDecorationElement::updateImage()
-{
- if (!renderer() || !renderer()->isImage())
- return;
- RenderImageResource* resource = toRenderImage(renderer())->imageResource();
- CachedImage* image;
- if (hostInput()->isDisabledFormControl())
- image = m_textFieldDecorator->imageForDisabledState();
- else if (hostInput()->isReadOnly())
- image = m_textFieldDecorator->imageForReadonlyState();
- else if (m_isInHoverState)
- image = m_textFieldDecorator->imageForHoverState();
- else
- image = m_textFieldDecorator->imageForNormalState();
- ASSERT(image);
- resource->setCachedImage(image);
-}
-
-PassRefPtr<RenderStyle> TextFieldDecorationElement::customStyleForRenderer()
-{
- RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this);
- RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
- RenderStyle* inputStyle = hostInput()->renderStyle();
- ASSERT(inputStyle);
- style->setWidth(Length(inputStyle->fontSize(), Fixed));
- style->setHeight(Length(inputStyle->fontSize(), Fixed));
- updateImage();
- return style.release();
-}
-
-RenderObject* TextFieldDecorationElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
- RenderImage* image = new (arena) RenderImage(this);
- image->setImageResource(RenderImageResource::create());
- return image;
-}
-
-void TextFieldDecorationElement::attach()
-{
- HTMLDivElement::attach();
- updateImage();
-}
-
-void TextFieldDecorationElement::detach()
-{
- m_textFieldDecorator->willDetach(hostInput());
- HTMLDivElement::detach();
-}
-
-bool TextFieldDecorationElement::isMouseFocusable() const
-{
- return false;
-}
-
-void TextFieldDecorationElement::defaultEventHandler(Event* event)
-{
- RefPtr<HTMLInputElement> input(hostInput());
- if (!input || input->isDisabledOrReadOnly() || !event->isMouseEvent()) {
- if (!event->defaultHandled())
- HTMLDivElement::defaultEventHandler(event);
- return;
- }
-
- RefPtr<TextFieldDecorationElement> protector(this);
- if (event->type() == eventNames().clickEvent) {
- m_textFieldDecorator->handleClick(input.get());
- 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->isDisabledOrReadOnly())
- return true;
-
- return HTMLDivElement::willRespondToMouseMoveEvents();
-}
-
-bool TextFieldDecorationElement::willRespondToMouseClickEvents()
-{
- const HTMLInputElement* input = hostInput();
- if (!input->isDisabledOrReadOnly())
- return true;
-
- return HTMLDivElement::willRespondToMouseClickEvents();
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h (149014 => 149015)
--- trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h 2013-04-24 01:59:21 UTC (rev 149015)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TextFieldDecorationElement_h
-#define TextFieldDecorationElement_h
-
-#include "HTMLDivElement.h"
-
-namespace WebCore {
-
-class CachedImage;
-class HTMLInputElement;
-class ShadowRoot;
-
-// A TextFieldDecorator object must live until all of text fields which were
-// decorated by it die.
-class TextFieldDecorator {
-public:
- // Returns true if this TextFieldDecorator wants to add a
- // decoration to the specified text field.
- virtual bool willAddDecorationTo(HTMLInputElement*) = 0;
- virtual bool visibleByDefault() = 0;
-
- // A TextFieldDecorator object should own the CachedImage objects.
- 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
- // call functions which updating state of the specified HTMLInputElement
- // object.
- virtual void willDetach(HTMLInputElement*) = 0;
-
- virtual ~TextFieldDecorator();
-};
-
-// A TextFieldDecorationElement object must be in a shadow tree of an
-// HTMLInputElement.
-class TextFieldDecorationElement : public HTMLDivElement {
-public:
- static PassRefPtr<TextFieldDecorationElement> create(Document*, TextFieldDecorator*);
- static TextFieldDecorationElement* fromShadowRoot(ShadowRoot*);
- TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; }
- void decorate(HTMLInputElement*, bool visible);
-
- virtual bool willRespondToMouseMoveEvents() OVERRIDE;
- virtual bool willRespondToMouseClickEvents() OVERRIDE;
-
-private:
- TextFieldDecorationElement(Document*, TextFieldDecorator*);
- virtual bool isTextFieldDecoration() const OVERRIDE;
- virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
- virtual void attach() OVERRIDE;
- virtual void detach() OVERRIDE;
- virtual bool isMouseFocusable() const OVERRIDE;
- virtual void defaultEventHandler(Event*) OVERRIDE;
-
- HTMLInputElement* hostInput();
- void updateImage();
-
- TextFieldDecorator* m_textFieldDecorator;
- bool m_isInHoverState;
-};
-
-inline TextFieldDecorationElement* toTextFieldDecorationElement(Node* node)
-{
- ASSERT(node);
- ASSERT_WITH_SECURITY_IMPLICATION(node->isElementNode());
- ASSERT_WITH_SECURITY_IMPLICATION(toElement(node)->isTextFieldDecoration());
- return static_cast<TextFieldDecorationElement*>(node);
-}
-
-}
-#endif
Modified: trunk/Source/WebCore/page/ChromeClient.h (149014 => 149015)
--- trunk/Source/WebCore/page/ChromeClient.h 2013-04-24 01:23:42 UTC (rev 149014)
+++ trunk/Source/WebCore/page/ChromeClient.h 2013-04-24 01:59:21 UTC (rev 149015)
@@ -339,14 +339,6 @@
virtual void setPagePopupDriver(PagePopupDriver*) = 0;
virtual void resetPagePopupDriver() = 0;
#endif
- // This function is called whenever a text field <input> is created. The
- // implementation should return true if it wants to do something in
- // addTextFieldDecorationsTo().
- // The argument is always non-0.
- virtual bool willAddTextFieldDecorationsTo(HTMLInputElement*) { return false; }
- // The argument is always non-0.
- virtual void addTextFieldDecorationsTo(HTMLInputElement*) { }
-
virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }