[webkit-changes] cvs commit: WebCore/khtml/rendering
render_theme.cpp render_theme.h render_theme_mac.h
render_theme_mac.mm render_box.cpp
David
hyatt at opensource.apple.com
Tue Jul 19 17:45:50 PDT 2005
hyatt 05/07/19 17:45:50
Modified: . ChangeLog
WebCore.pbproj project.pbxproj
khtml/css cssstyleselector.cpp html4.css
khtml/html html_formimpl.cpp
khtml/rendering render_box.cpp
Added: khtml/rendering render_theme.cpp render_theme.h
render_theme_mac.h render_theme_mac.mm
Log:
Adding support for the "checkbox" appearance value. This is not yet implemented, but the
methods are now stubbed out and will get called.
Reviewed by mjs
* WebCore.pbproj/project.pbxproj:
* khtml/css/cssstyleselector.cpp:
(khtml::CSSStyleSelector::adjustRenderStyle):
(khtml::CSSStyleSelector::applyProperty):
* khtml/css/html4.css:
* khtml/html/html_formimpl.cpp:
(DOM::HTMLInputElementImpl::createRenderer):
* khtml/rendering/render_box.cpp:
(RenderBox::paintBoxDecorations):
* khtml/rendering/render_theme.cpp: Added.
(khtml::RenderTheme::adjustStyle):
(khtml::RenderTheme::paint):
* khtml/rendering/render_theme.h: Added.
* khtml/rendering/render_theme_mac.h: Added.
* khtml/rendering/render_theme_mac.mm: Added.
(khtml::theme):
(khtml::RenderThemeMac::adjustCheckboxStyle):
(khtml::RenderThemeMac::paintCheckbox):
Revision Changes Path
1.4445 +26 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4444
retrieving revision 1.4445
diff -u -r1.4444 -r1.4445
--- ChangeLog 19 Jul 2005 23:44:03 -0000 1.4444
+++ ChangeLog 20 Jul 2005 00:45:44 -0000 1.4445
@@ -1,5 +1,31 @@
2005-07-19 David Hyatt <hyatt at apple.com>
+ Adding support for the "checkbox" appearance value. This is not yet implemented, but the
+ methods are now stubbed out and will get called.
+
+ Reviewed by mjs
+
+ * WebCore.pbproj/project.pbxproj:
+ * khtml/css/cssstyleselector.cpp:
+ (khtml::CSSStyleSelector::adjustRenderStyle):
+ (khtml::CSSStyleSelector::applyProperty):
+ * khtml/css/html4.css:
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLInputElementImpl::createRenderer):
+ * khtml/rendering/render_box.cpp:
+ (RenderBox::paintBoxDecorations):
+ * khtml/rendering/render_theme.cpp: Added.
+ (khtml::RenderTheme::adjustStyle):
+ (khtml::RenderTheme::paint):
+ * khtml/rendering/render_theme.h: Added.
+ * khtml/rendering/render_theme_mac.h: Added.
+ * khtml/rendering/render_theme_mac.mm: Added.
+ (khtml::theme):
+ (khtml::RenderThemeMac::adjustCheckboxStyle):
+ (khtml::RenderThemeMac::paintCheckbox):
+
+2005-07-19 David Hyatt <hyatt at apple.com>
+
Fix performance regressions from attribute QName landing.
Reviewed by mjs
1.571 +64 -0 WebCore/WebCore.pbproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.pbproj/project.pbxproj,v
retrieving revision 1.570
retrieving revision 1.571
diff -u -r1.570 -r1.571
--- project.pbxproj 18 Jul 2005 21:44:11 -0000 1.570
+++ project.pbxproj 20 Jul 2005 00:45:47 -0000 1.571
@@ -2735,6 +2735,8 @@
65DE852A08765FC30011428A,
BCEF3435087B563E00BBF833,
A8FD8B87087CB45700DC3707,
+ BC179894088D975F006068A5,
+ BC1798DA088DA4F8006068A5,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -5083,6 +5085,8 @@
65F3782A0870D958000B2F94,
BCEF3434087B563E00BBF833,
A8FD8B86087CB44C00DC3707,
+ BC179892088D975F006068A5,
+ BC179893088D975F006068A5,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -11821,6 +11825,62 @@
refType = 4;
sourceTree = "<group>";
};
+ BC17988F088D975F006068A5 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.objcpp;
+ path = render_theme_mac.mm;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BC179890088D975F006068A5 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = render_theme.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BC179891088D975F006068A5 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = render_theme.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BC179892088D975F006068A5 = {
+ fileRef = BC17988F088D975F006068A5;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ BC179893088D975F006068A5 = {
+ fileRef = BC179890088D975F006068A5;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ BC179894088D975F006068A5 = {
+ fileRef = BC179891088D975F006068A5;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ BC1798D9088DA4F8006068A5 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = render_theme_mac.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BC1798DA088DA4F8006068A5 = {
+ fileRef = BC1798D9088DA4F8006068A5;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
BC32C2EC048BF95C00A8000B = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -14286,6 +14346,10 @@
BCF0192403D3802200B2D04D,
BC32C2ED048BF95C00A8000B,
BC32C2EC048BF95C00A8000B,
+ BC17988F088D975F006068A5,
+ BC1798D9088DA4F8006068A5,
+ BC179890088D975F006068A5,
+ BC179891088D975F006068A5,
);
isa = PBXGroup;
path = rendering;
1.193 +6 -1 WebCore/khtml/css/cssstyleselector.cpp
Index: cssstyleselector.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -r1.192 -r1.193
--- cssstyleselector.cpp 19 Jul 2005 00:02:07 -0000 1.192
+++ cssstyleselector.cpp 20 Jul 2005 00:45:48 -0000 1.193
@@ -46,6 +46,7 @@
#include "misc/loader.h"
#include "rendering/font.h"
+#include "render_theme.h"
#include "khtmlview.h"
#include "khtml_part.h"
@@ -957,6 +958,10 @@
// Cull out any useless layers and also repeat patterns into additional layers.
style->adjustBackgroundLayers();
+ // Let the theme get a crack at changing the style if an appearance has been set.
+ if (style->appearance() != NoAppearance)
+ theme()->adjustStyle(style);
+
// Only use slow repaints if we actually have a background image.
// FIXME: We only need to invalidate the fixed regions when scrolling. It's total overkill to
// prevent the entire view from blitting on a scroll.
@@ -3381,7 +3386,7 @@
if (id == CSS_VAL_NONE)
appearance = NoAppearance;
else
- appearance = EAppearance(id - CSS_VAL_CHECKBOX);
+ appearance = EAppearance(id - CSS_VAL_CHECKBOX + 1);
style->setAppearance(appearance);
}
case CSS_PROP__KHTML_BINDING: {
1.70 +11 -2 WebCore/khtml/css/html4.css
Index: html4.css
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/html4.css,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- html4.css 3 May 2005 20:47:27 -0000 1.69
+++ html4.css 20 Jul 2005 00:45:48 -0000 1.70
@@ -278,7 +278,6 @@
}
button {
- display: inline-block;
border: 2px outset ButtonFace;
background-color: ButtonFace;
color: ButtonText;
@@ -298,7 +297,9 @@
input, textarea, select, button {
margin: 0__qem;
font: 11px 'Lucida Grande';
- color: initial
+ color: initial;
+ display: inline-block;
+ -khtml-box-sizing: border-box
}
input[type="hidden"] {
@@ -313,6 +314,14 @@
display: none
}
+/* Comment this section in to enable the new controls
+
+input[type="checkbox"] {
+ -khtml-appearance: checkbox
+}
+
+*/
+
/* inline elements */
u, ins {
1.174 +5 -1 WebCore/khtml/html/html_formimpl.cpp
Index: html_formimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -r1.173 -r1.174
--- html_formimpl.cpp 18 Jul 2005 21:52:25 -0000 1.173
+++ html_formimpl.cpp 20 Jul 2005 00:45:49 -0000 1.174
@@ -1819,7 +1819,11 @@
case SEARCH:
#endif
case ISINDEX: return new (arena) RenderLineEdit(this);
- case CHECKBOX: return new (arena) RenderCheckBox(this);
+ case CHECKBOX: {
+ if (style->appearance() == CheckboxAppearance)
+ return RenderObject::createObject(this, style);
+ return new (arena) RenderCheckBox(this);
+ }
case RADIO: return new (arena) RenderRadioButton(this);
case SUBMIT: return new (arena) RenderSubmitButton(this);
case IMAGE: return new (arena) RenderImageButton(this);
1.158 +6 -1 WebCore/khtml/rendering/render_box.cpp
Index: render_box.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- render_box.cpp 18 Jul 2005 21:52:31 -0000 1.157
+++ render_box.cpp 20 Jul 2005 00:45:49 -0000 1.158
@@ -33,6 +33,7 @@
#include "rendering/render_table.h"
#include "render_flexbox.h"
#include "render_arena.h"
+#include "render_theme.h"
#include "xml/dom_nodeimpl.h"
#include "xml/dom_docimpl.h"
@@ -316,12 +317,16 @@
else
mh = kMin(i.r.height(), h);
+ // If we have a native theme appearance, use that instead of painting our border/background.
+ if (style()->appearance() != NoAppearance)
+ return theme()->paint(this, i, QRect(_tx, _ty, w, h));
+
// The <body> only paints its background if the root element has defined a background
// independent of the body. Go through the DOM to get to the root element's render object,
// since the root could be inline and wrapped in an anonymous block.
if (!isBody() || !document()->isHTMLDocument() || document()->documentElement()->renderer()->style()->hasBackground())
paintBackgrounds(i.p, style()->backgroundColor(), style()->backgroundLayers(), my, mh, _tx, _ty, w, h);
-
+
if (style()->hasBorder())
paintBorder(i.p, _tx, _ty, w, h, style());
}
1.1 WebCore/khtml/rendering/render_theme.cpp
Index: render_theme.cpp
===================================================================
/**
* This file is part of the theme implementation for form controls in WebCore.
*
* 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 "render_theme.h"
#include "render_style.h"
// The methods in this file are shared by all themes on every platform.
namespace khtml {
void RenderTheme::adjustStyle(RenderStyle* style)
{
// Force inline to be inline-block
if (style->display() == INLINE)
style->setDisplay(INLINE_BLOCK);
else if (style->display() == COMPACT || style->display() == RUN_IN || style->display() == LIST_ITEM)
style->setDisplay(BLOCK);
// Call the appropriate style adjustment method based off the appearance value.
switch (style->appearance()) {
case CheckboxAppearance:
return adjustCheckboxStyle(style);
default:
break;
}
}
void RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r)
{
// Call the appropriate paint method based off the appearance value.
switch (o->style()->appearance()) {
case CheckboxAppearance:
return paintCheckbox(o, i, r);
default:
break;
}
}
}
1.1 WebCore/khtml/rendering/render_theme.h
Index: render_theme.h
===================================================================
/*
* This file is part of the theme implementation for form controls in WebCore.
*
* 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.
*
*/
#ifndef RENDER_THEME_H
#define RENDER_THEME_H
#include "render_object.h"
namespace khtml {
class RenderStyle;
class RenderTheme {
public:
// This method is called whenever style has been computed for an element and the appearance
// property has been set to a value other than "none". The theme should map in all of the appropriate
// metrics and defaults given the contents of the style. This includes sophisticated operations like
// selection of control size based off the font, the disabling of appearance when certain other properties like
// "border" are set, or if the appearance is not supported by the theme.
void adjustStyle(RenderStyle* style);
// This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the
// text of a button, is always rendered by the engine itself.
void paint(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r);
// The remaining methods should be implemented by the platform-specific portion of the theme, e.g.,
// render_theme_mac.cpp for Mac OS X.
// This method is called whenever the theme changes on the system in order to flush cached resources from the
// old theme.
void themeChanged();
protected:
// Methods for each appearance value.
virtual void adjustCheckboxStyle(RenderStyle* style) = 0;
virtual void paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r) = 0;
};
// Function to obtain the theme. This is implemented in your platform-specific theme implementation to hand
// back the appropriate platform theme.
RenderTheme* theme();
}
#endif
1.1 WebCore/khtml/rendering/render_theme_mac.h
Index: render_theme_mac.h
===================================================================
/*
* This file is part of the theme implementation for form controls in WebCore.
*
* 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.
*
*/
#ifndef RENDER_THEME_MAC_H
#define RENDER_THEME_MAC_H
#import "render_theme.h"
namespace khtml {
class RenderStyle;
class RenderThemeMac : public RenderTheme {
protected:
// Methods for each appearance value.
virtual void adjustCheckboxStyle(RenderStyle* style);
virtual void paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r);
};
}
#endif
1.1 WebCore/khtml/rendering/render_theme_mac.mm
Index: render_theme_mac.mm
===================================================================
/**
* This file is part of the theme implementation for form controls in WebCore.
*
* 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.
*/
#import "render_theme_mac.h"
#import "render_style.h"
// The methods in this file are specific to the Mac OS X platform.
namespace khtml {
RenderTheme* theme()
{
static RenderThemeMac macTheme;
return &macTheme;
}
void RenderThemeMac::adjustCheckboxStyle(RenderStyle* style)
{
// A summary of the rules for checkbox designed to match WinIE:
// width/height - honored but we won't let ourselves get smaller than the mini checkbox.
// (WinIE actually scales its control for small widths, but lets it overflow for small heights.)
// padding - not honored, needs to be removed.
// border - not honored, needs to be removed (WinIE honors it but just paints it around the control, which just looks awful.)
}
void RenderThemeMac::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const QRect& r)
{
// A summary of the rules for checkbox designed to match WinIE:
//
// width/height - if larger than the control size, then the control should paint itself centered
// within the larger area.
}
}
More information about the webkit-changes
mailing list