hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 1 | /* |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 2 | * Copyright (C) 2005 Apple Inc. |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 18 | * |
| 19 | */ |
darin | 9d0a628 | 2006-03-01 07:49:33 +0000 | [diff] [blame] | 20 | |
commit-queue@webkit.org | 46c0f52 | 2016-11-13 10:05:43 +0000 | [diff] [blame] | 21 | #pragma once |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 22 | |
commit-queue@webkit.org | e7c35fc | 2013-02-21 20:56:18 +0000 | [diff] [blame] | 23 | #include "RenderFlexibleBox.h" |
sfalken@apple.com | 14e9c0b | 2008-05-05 20:51:32 +0000 | [diff] [blame] | 24 | #include "Timer.h" |
zandobersek@gmail.com | 31dae99 | 2014-03-31 10:12:49 +0000 | [diff] [blame] | 25 | #include <memory> |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 26 | |
darin | 9d0a628 | 2006-03-01 07:49:33 +0000 | [diff] [blame] | 27 | namespace WebCore { |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 28 | |
akling@apple.com | b82aab5 | 2013-09-13 09:00:04 +0000 | [diff] [blame] | 29 | class HTMLFormControlElement; |
bdash | 9f45d10 | 2007-10-14 11:44:20 +0000 | [diff] [blame] | 30 | class RenderTextFragment; |
| 31 | |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 32 | // RenderButtons are just like normal flexboxes except that they will generate an anonymous block child. |
| 33 | // For inputs, they will also generate an anonymous RenderText and keep its style and content up |
| 34 | // to date as the button changes. |
andersca@apple.com | 16d2dd4 | 2014-01-16 23:08:24 +0000 | [diff] [blame] | 35 | class RenderButton final : public RenderFlexibleBox { |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 36 | public: |
antti@apple.com | 454418f | 2016-04-25 19:49:23 +0000 | [diff] [blame] | 37 | RenderButton(HTMLFormControlElement&, RenderStyle&&); |
commit-queue@webkit.org | 7538c25 | 2010-10-09 02:00:07 +0000 | [diff] [blame] | 38 | virtual ~RenderButton(); |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 39 | |
akling@apple.com | b82aab5 | 2013-09-13 09:00:04 +0000 | [diff] [blame] | 40 | HTMLFormControlElement& formControlElement() const; |
weinig | c24ab18 | 2006-10-30 22:41:29 +0000 | [diff] [blame] | 41 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 42 | bool canBeSelectionLeaf() const override; |
rniwa@webkit.org | 85059ba | 2012-03-24 00:54:04 +0000 | [diff] [blame] | 43 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 44 | void addChild(RenderObject* newChild, RenderObject *beforeChild = 0) override; |
| 45 | void removeChild(RenderObject&) override; |
| 46 | void removeLeftoverAnonymousBlock(RenderBlock*) override { } |
| 47 | bool createsAnonymousWrapper() const override { return true; } |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 48 | |
darin@chromium.org | e040ff2 | 2008-12-09 21:46:03 +0000 | [diff] [blame] | 49 | void setupInnerStyle(RenderStyle*); |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 50 | void updateFromElement() override; |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 51 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 52 | bool canHaveGeneratedChildren() const override; |
| 53 | bool hasControlClip() const override { return true; } |
| 54 | LayoutRect controlClipRect(const LayoutPoint&) const override; |
hyatt | ebae6a8 | 2005-10-22 18:19:27 +0000 | [diff] [blame] | 55 | |
commit-queue@webkit.org | e27a918 | 2012-09-21 09:22:51 +0000 | [diff] [blame] | 56 | void setText(const String&); |
| 57 | String text() const; |
| 58 | |
joepeck@webkit.org | b982bd0 | 2014-01-11 01:33:47 +0000 | [diff] [blame] | 59 | #if PLATFORM(IOS) |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 60 | void layout() override; |
joepeck@webkit.org | b982bd0 | 2014-01-11 01:33:47 +0000 | [diff] [blame] | 61 | #endif |
| 62 | |
mitz@apple.com | 55bf872 | 2010-05-21 00:37:06 +0000 | [diff] [blame] | 63 | private: |
commit-queue@webkit.org | e722745 | 2014-01-17 12:24:16 +0000 | [diff] [blame] | 64 | void element() const = delete; |
akling@apple.com | b82aab5 | 2013-09-13 09:00:04 +0000 | [diff] [blame] | 65 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 66 | const char* renderName() const override { return "RenderButton"; } |
| 67 | bool isRenderButton() const override { return true; } |
akling@apple.com | b82aab5 | 2013-09-13 09:00:04 +0000 | [diff] [blame] | 68 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 69 | void styleWillChange(StyleDifference, const RenderStyle& newStyle) override; |
| 70 | void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; |
simon.fraser@apple.com | a89b8cd | 2008-10-10 03:15:31 +0000 | [diff] [blame] | 71 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 72 | bool hasLineIfEmpty() const override; |
adele | 05abee3 | 2006-08-25 23:44:05 +0000 | [diff] [blame] | 73 | |
svillar@igalia.com | e2c9352 | 2015-09-10 11:58:24 +0000 | [diff] [blame] | 74 | bool isFlexibleBoxImpl() const override { return true; } |
| 75 | |
commit-queue@webkit.org | e27a918 | 2012-09-21 09:22:51 +0000 | [diff] [blame] | 76 | RenderTextFragment* m_buttonText; |
hyatt | 82bdd23 | 2005-10-21 21:27:51 +0000 | [diff] [blame] | 77 | RenderBlock* m_inner; |
| 78 | }; |
| 79 | |
weinig | c24ab18 | 2006-10-30 22:41:29 +0000 | [diff] [blame] | 80 | } // namespace WebCore |
darin | 9d0a628 | 2006-03-01 07:49:33 +0000 | [diff] [blame] | 81 | |
cdumez@apple.com | f85e2f6 | 2014-10-07 00:26:25 +0000 | [diff] [blame] | 82 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderButton, isRenderButton()) |