From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../WebCore/html/shadow/TextControlInnerElements.h | 127 ++++++--------------- 1 file changed, 37 insertions(+), 90 deletions(-) (limited to 'Source/WebCore/html/shadow/TextControlInnerElements.h') diff --git a/Source/WebCore/html/shadow/TextControlInnerElements.h b/Source/WebCore/html/shadow/TextControlInnerElements.h index 73e79c230..b16e1e736 100644 --- a/Source/WebCore/html/shadow/TextControlInnerElements.h +++ b/Source/WebCore/html/shadow/TextControlInnerElements.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2010, 2014 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. 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 @@ -24,145 +24,92 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TextControlInnerElements_h -#define TextControlInnerElements_h +#pragma once #include "HTMLDivElement.h" -#include "SpeechInputListener.h" #include namespace WebCore { class RenderTextControlInnerBlock; -class SpeechInput; class TextControlInnerContainer final : public HTMLDivElement { public: - static PassRefPtr create(Document&); + static Ref create(Document&); protected: TextControlInnerContainer(Document&); - virtual RenderPtr createElementRenderer(PassRef) override; + RenderPtr createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; }; class TextControlInnerElement final : public HTMLDivElement { public: - static PassRefPtr create(Document&); + static Ref create(Document&); protected: TextControlInnerElement(Document&); - virtual PassRefPtr customStyleForRenderer() override; + std::optional resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; private: - virtual bool isMouseFocusable() const override { return false; } + bool isMouseFocusable() const override { return false; } }; class TextControlInnerTextElement final : public HTMLDivElement { public: - static PassRefPtr create(Document&); + static Ref create(Document&); - virtual void defaultEventHandler(Event*) override; + void defaultEventHandler(Event&) override; RenderTextControlInnerBlock* renderer() const; private: TextControlInnerTextElement(Document&); - virtual RenderPtr createElementRenderer(PassRef) override; - virtual PassRefPtr customStyleForRenderer() override; - virtual bool isMouseFocusable() const override { return false; } - virtual bool isTextControlInnerTextElement() const override { return true; } + RenderPtr createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; + std::optional resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; + bool isMouseFocusable() const override { return false; } + bool isTextControlInnerTextElement() const override { return true; } }; -inline bool isTextControlInnerTextElement(const HTMLElement& element) { return element.isTextControlInnerTextElement(); } -inline bool isTextControlInnerTextElement(const Node& node) { return node.isHTMLElement() && isTextControlInnerTextElement(toHTMLElement(node)); } -NODE_TYPE_CASTS(TextControlInnerTextElement) - -class SearchFieldResultsButtonElement final : public HTMLDivElement { +class TextControlPlaceholderElement final : public HTMLDivElement { public: - static PassRefPtr create(Document&); - - virtual void defaultEventHandler(Event*) override; -#if !PLATFORM(IOS) - virtual bool willRespondToMouseClickEvents() override; -#endif + static Ref create(Document& document) { return adoptRef(*new TextControlPlaceholderElement(document)); } private: - SearchFieldResultsButtonElement(Document&); - virtual const AtomicString& shadowPseudoId() const override; - virtual bool isMouseFocusable() const override { return false; } + TextControlPlaceholderElement(Document&); + + std::optional resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; }; -class SearchFieldCancelButtonElement final : public HTMLDivElement { +class SearchFieldResultsButtonElement final : public HTMLDivElement { public: - static PassRefPtr create(Document&); + static Ref create(Document&); - virtual void defaultEventHandler(Event*) override; - virtual bool isSearchFieldCancelButtonElement() const override { return true; } + void defaultEventHandler(Event&) override; #if !PLATFORM(IOS) - virtual bool willRespondToMouseClickEvents() override; + bool willRespondToMouseClickEvents() override; #endif private: - SearchFieldCancelButtonElement(Document&); - virtual const AtomicString& shadowPseudoId() const override; - virtual void willDetachRenderers() override; - virtual bool isMouseFocusable() const override { return false; } - - bool m_capturing; + SearchFieldResultsButtonElement(Document&); + bool isMouseFocusable() const override { return false; } }; -#if ENABLE(INPUT_SPEECH) - -class InputFieldSpeechButtonElement final - : public HTMLDivElement, - public SpeechInputListener { +class SearchFieldCancelButtonElement final : public HTMLDivElement { public: - enum SpeechInputState { - Idle, - Recording, - Recognizing, - }; + static Ref create(Document&); - static PassRefPtr create(Document&); - virtual ~InputFieldSpeechButtonElement(); - - virtual void defaultEventHandler(Event*); + void defaultEventHandler(Event&) override; #if !PLATFORM(IOS) - virtual bool willRespondToMouseClickEvents(); + bool willRespondToMouseClickEvents() override; #endif - virtual bool isInputFieldSpeechButtonElement() const { return true; } - SpeechInputState state() const { return m_state; } - void startSpeechInput(); - void stopSpeechInput(); - - // SpeechInputListener methods. - void didCompleteRecording(int); - void didCompleteRecognition(int); - void setRecognitionResult(int, const SpeechInputResultArray&); private: - InputFieldSpeechButtonElement(Document&); - SpeechInput* speechInput(); - void setState(SpeechInputState state); - virtual const AtomicString& shadowPseudoId() const; - virtual bool isMouseFocusable() const override { return false; } - virtual void willAttachRenderers() override; - virtual void willDetachRenderers() override; - - - bool m_capturing; - SpeechInputState m_state; - int m_listenerId; - SpeechInputResultArray m_results; + SearchFieldCancelButtonElement(Document&); + bool isMouseFocusable() const override { return false; } }; -inline InputFieldSpeechButtonElement* toInputFieldSpeechButtonElement(Element* element) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isInputFieldSpeechButtonElement()); - return static_cast(element); -} - -#endif // ENABLE(INPUT_SPEECH) +} // namespace WebCore -} // namespace - -#endif +SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::TextControlInnerTextElement) + static bool isType(const WebCore::HTMLElement& element) { return element.isTextControlInnerTextElement(); } + static bool isType(const WebCore::Node& node) { return is(node) && isType(downcast(node)); } +SPECIALIZE_TYPE_TRAITS_END() -- cgit v1.2.1