Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Land the new "NSView-less" buttons. With this landing both
<input type=button> and <button> will now look like OS X-style widgets. Customization of background and border is not yet enabled, but this is still a big improvement over the old AppKit widgets. Reviewed by mjs * ForwardingHeaders/qpushbutton.h: Removed. * WebCore.xcodeproj/project.pbxproj: * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::adjustRenderStyle): * khtml/css/cssstyleselector.h: (khtml::CSSStyleSelector::paintMetrics): * khtml/css/cssvalues.in: * khtml/css/html4.css: * khtml/html/html_formimpl.cpp: (DOM::HTMLButtonElementImpl::createRenderer): (DOM::HTMLInputElementImpl::click): (DOM::HTMLInputElementImpl::createRenderer): * khtml/html/html_formimpl.h: (DOM::HTMLInputElementImpl::isTextButton): * khtml/rendering/render_button.cpp: Added. (khtml::m_inner): (khtml::RenderButton::~RenderButton): (khtml::RenderButton::addChild): (khtml::RenderButton::removeChild): (khtml::RenderButton::setStyle): (khtml::RenderButton::updateFromElement): * khtml/rendering/render_button.h: Added. (khtml::RenderButton::removeLeftoverAnonymousBoxes): (khtml::RenderButton::renderName): * khtml/rendering/render_form.cpp: * khtml/rendering/render_form.h: (khtml::RenderFileButton::calcReplacedHeight): (khtml::RenderFileButton::isEditable): * khtml/rendering/render_style.h: (khtml::): * khtml/rendering/render_theme.cpp: (khtml::RenderTheme::adjustStyle): (khtml::RenderTheme::paint): (khtml::RenderTheme::adjustCheckboxStyle): (khtml::RenderTheme::adjustRadioStyle): (khtml::RenderTheme::adjustButtonStyle): * khtml/rendering/render_theme.h: (khtml::RenderTheme::setButtonSize): * khtml/rendering/render_theme_mac.h: * khtml/rendering/render_theme_mac.mm: (khtml::RenderThemeMac::setSizeFromFont): (khtml::RenderThemeMac::setFontFromControlSize): (khtml::RenderThemeMac::addIntrinsicMargins): (khtml::RenderThemeMac::setButtonPaddingFromControlSize): (khtml::RenderThemeMac::adjustButtonStyle): (khtml::RenderThemeMac::buttonSizes): (khtml::RenderThemeMac::buttonMargins): (khtml::RenderThemeMac::setButtonSize): (khtml::RenderThemeMac::setButtonCellState): (khtml::RenderThemeMac::paintButton): * kwq/KWQAccObject.mm: (-[KWQAccObject actionElement]): (-[KWQAccObject role]): (-[KWQAccObject title]): * kwq/KWQButton.h: Removed. * kwq/KWQButton.mm: Removed. * kwq/KWQComboBox.mm: * kwq/KWQLineEdit.h: * kwq/KWQLineEdit.mm: * kwq/KWQPushButton.h: Removed. * kwq/KWQPushButton.mm: Removed. Canonical link: https://commits.webkit.org/9220@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
David Hyatt
committed
Oct 21, 2005
1 parent
2119fe1
commit 100909d
Showing
26 changed files
with
547 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* This file is part of the html renderer for KDE. | ||
* | ||
* Copyright (C) 2005 Apple Computer, Inc. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
* | ||
*/ | ||
|
||
#include "config.h" | ||
#include "render_button.h" | ||
#include "render_text.h" | ||
#include "htmlnames.h" | ||
#include "html_formimpl.h" | ||
|
||
using namespace DOM; | ||
using namespace HTMLNames; | ||
|
||
namespace khtml { | ||
|
||
RenderButton::RenderButton(NodeImpl* node) | ||
:RenderFlexibleBox(node), m_buttonText(0), m_inner(0) | ||
{ | ||
} | ||
|
||
RenderButton::~RenderButton() | ||
{ | ||
} | ||
|
||
void RenderButton::addChild(RenderObject *newChild, RenderObject *beforeChild) | ||
{ | ||
if (!m_inner) { | ||
// Create an anonymous block. | ||
assert(!m_first); | ||
m_inner = createAnonymousBlock(); | ||
m_inner->style()->setBoxFlex(1.0f); | ||
RenderFlexibleBox::addChild(m_inner); | ||
} | ||
|
||
m_inner->addChild(newChild, beforeChild); | ||
} | ||
|
||
void RenderButton::removeChild(RenderObject *oldChild) | ||
{ | ||
if (oldChild == m_inner || !m_inner) { | ||
RenderFlexibleBox::removeChild(oldChild); | ||
m_inner = 0; | ||
} | ||
else | ||
m_inner->removeChild(oldChild); | ||
} | ||
|
||
void RenderButton::setStyle(RenderStyle* style) | ||
{ | ||
RenderBlock::setStyle(style); | ||
if (m_buttonText) | ||
m_buttonText->setStyle(style); | ||
} | ||
|
||
void RenderButton::updateFromElement() | ||
{ | ||
// If we're an input element, we may need to change our button text. | ||
if (element()->hasTagName(inputTag)) { | ||
HTMLInputElementImpl* input = static_cast<HTMLInputElementImpl*>(element()); | ||
DOMString value = input->value(); | ||
if (value.isEmpty()) { | ||
if (m_buttonText) { | ||
m_buttonText->destroy(); | ||
m_buttonText = 0; | ||
} | ||
} else { | ||
if (m_buttonText) | ||
m_buttonText->setText(value.impl()); | ||
else { | ||
m_buttonText = new (renderArena()) RenderText(document(), value.impl()); | ||
m_buttonText->setStyle(style()); | ||
addChild(m_buttonText); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* This file is part of the html renderer for KDE. | ||
* | ||
* Copyright (C) 2005 Apple Computer | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
* | ||
*/ | ||
#ifndef render_button_h | ||
#define render_button_h | ||
|
||
#include "render_flexbox.h" | ||
|
||
namespace khtml | ||
{ | ||
|
||
// RenderButtons are just like normal flexboxes except that they will generate an anonymous block child. | ||
// For inputs, they will also generate an anonymous RenderText and keep its style and content up | ||
// to date as the button changes. | ||
class RenderButton : public RenderFlexibleBox | ||
{ | ||
public: | ||
RenderButton(DOM::NodeImpl* node); | ||
virtual ~RenderButton(); | ||
|
||
virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0); | ||
virtual void removeChild(RenderObject *oldChild); | ||
virtual void removeLeftoverAnonymousBoxes() {}; | ||
|
||
virtual void setStyle(RenderStyle* style); | ||
virtual void updateFromElement(); | ||
|
||
virtual const char *renderName() const { return "RenderButton"; } | ||
|
||
protected: | ||
RenderText* m_buttonText; | ||
RenderBlock* m_inner; | ||
}; | ||
|
||
}; | ||
#endif |
Oops, something went wrong.