+2009-06-22 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add RenderDataGrid to the build. Give it some basic default styling (that more or less matches a listbox). It has a default size
+ of 300x150.
+
+ * GNUmakefile.am:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ * css/html4.css:
+ * html/HTMLDataGridElement.cpp:
+ (WebCore::HTMLDataGridElement::createRenderer):
+ * html/HTMLDataGridElement.h:
+ * html/HTMLDataGridElement.idl:
+ * rendering/RenderDataGrid.cpp: Added.
+ (WebCore::RenderDataGrid::RenderDataGrid):
+ (WebCore::RenderDataGrid::~RenderDataGrid):
+ (WebCore::RenderDataGrid::calcPrefWidths):
+ (WebCore::RenderDataGrid::paintObject):
+ (WebCore::RenderDataGrid::valueChanged):
+ (WebCore::RenderDataGrid::invalidateScrollbarRect):
+ (WebCore::RenderDataGrid::isActive):
+ * rendering/RenderDataGrid.h: Added.
+ (WebCore::RenderDataGrid::renderName):
+ (WebCore::RenderDataGrid::canHaveChildren):
+ (WebCore::RenderDataGrid::scrollbarCornerPresent):
+
2009-06-22 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
WebCore/rendering/RenderButton.h \
WebCore/rendering/RenderCounter.cpp \
WebCore/rendering/RenderCounter.h \
+ WebCore/rendering/RenderDataGrid.cpp \
+ WebCore/rendering/RenderDataGrid.h \
WebCore/rendering/RenderFieldset.cpp \
WebCore/rendering/RenderFieldset.h \
WebCore/rendering/RenderFileUploadControl.cpp \
rendering/RenderBR.cpp \
rendering/RenderButton.cpp \
rendering/RenderCounter.cpp \
+ rendering/RenderDataGrid.cpp \
rendering/RenderFieldset.cpp \
rendering/RenderFileUploadControl.cpp \
rendering/RenderFlexibleBox.cpp \
RelativePath="..\rendering\RenderCounter.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\rendering\RenderDataGrid.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\rendering\RenderDataGrid.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\rendering\RenderFieldset.cpp"\r
>\r
BC77CDBC0FEFF1420070887B /* HTMLDataGridCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC77CDBB0FEFF1420070887B /* HTMLDataGridCellElement.h */; };
BC77CDCE0FEFF33B0070887B /* JSHTMLDataGridCellElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC77CDCC0FEFF33B0070887B /* JSHTMLDataGridCellElement.cpp */; };
BC77CDCF0FEFF33B0070887B /* JSHTMLDataGridCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC77CDCD0FEFF33B0070887B /* JSHTMLDataGridCellElement.h */; };
+ BC77CEB30FF017F20070887B /* RenderDataGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = BC77CEB20FF017F20070887B /* RenderDataGrid.h */; };
+ BC77CEC80FF01CBE0070887B /* RenderDataGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC77CEC70FF01CBE0070887B /* RenderDataGrid.cpp */; };
BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F44A70B9E324E00A9D081 /* ImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC7FA6200D1F0CBD00DB22A9 /* DynamicNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7FA61E0D1F0CBD00DB22A9 /* DynamicNodeList.cpp */; };
BC7FA6210D1F0CBD00DB22A9 /* DynamicNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7FA61F0D1F0CBD00DB22A9 /* DynamicNodeList.h */; };
BC77CDBB0FEFF1420070887B /* HTMLDataGridCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDataGridCellElement.h; sourceTree = "<group>"; };
BC77CDCC0FEFF33B0070887B /* JSHTMLDataGridCellElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDataGridCellElement.cpp; sourceTree = "<group>"; };
BC77CDCD0FEFF33B0070887B /* JSHTMLDataGridCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataGridCellElement.h; sourceTree = "<group>"; };
+ BC77CEB20FF017F20070887B /* RenderDataGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderDataGrid.h; sourceTree = "<group>"; };
+ BC77CEC70FF01CBE0070887B /* RenderDataGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderDataGrid.cpp; sourceTree = "<group>"; };
BC7B2AF80450824100A8000F /* Scrollbar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Scrollbar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BC7F44A70B9E324E00A9D081 /* ImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageObserver.h; sourceTree = "<group>"; };
BC7FA61E0D1F0CBD00DB22A9 /* DynamicNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicNodeList.cpp; sourceTree = "<group>"; };
BCEA4827097D93020094C9E4 /* RenderButton.h */,
9392F1430AD185FE00691BD4 /* RenderCounter.cpp */,
9392F1410AD185F400691BD4 /* RenderCounter.h */,
+ BC77CEC70FF01CBE0070887B /* RenderDataGrid.cpp */,
+ BC77CEB20FF017F20070887B /* RenderDataGrid.h */,
A8EA73AF0A1900E300A8EF5F /* RenderFieldset.cpp */,
A8EA73B00A1900E300A8EF5F /* RenderFieldset.h */,
066C772E0AB603FD00238CC4 /* RenderFileUploadControl.cpp */,
BC77CD4F0FEFE1610070887B /* JSHTMLDataGridRowElement.h in Headers */,
BC77CDBC0FEFF1420070887B /* HTMLDataGridCellElement.h in Headers */,
BC77CDCF0FEFF33B0070887B /* JSHTMLDataGridCellElement.h in Headers */,
+ BC77CEB30FF017F20070887B /* RenderDataGrid.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BC77CD4E0FEFE1610070887B /* JSHTMLDataGridRowElement.cpp in Sources */,
BC77CDB80FEFF1210070887B /* HTMLDataGridCellElement.cpp in Sources */,
BC77CDCE0FEFF33B0070887B /* JSHTMLDataGridCellElement.cpp in Sources */,
+ BC77CEC80FF01CBE0070887B /* RenderDataGrid.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
rendering/RenderBoxModelObject.cpp
rendering/RenderButton.cpp
rendering/RenderCounter.cpp
+ rendering/RenderDataGrid.cpp
rendering/RenderFieldset.cpp
rendering/RenderFileUploadControl.cpp
rendering/RenderFlexibleBox.cpp
-webkit-appearance: button;
}
-input, textarea, keygen, select, button, isindex {
+input, textarea, keygen, select, button, isindex, datagrid {
margin: 0__qem;
font: -webkit-small-control;
color: initial;
-webkit-appearance: sliderthumb-horizontal;
}
-input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled, input[type="file"]:disabled::-webkit-file-upload-button, button:disabled, select:disabled, keygen:disabled, optgroup:disabled, option:disabled {
+input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled,
+input[type="file"]:disabled::-webkit-file-upload-button, button:disabled,
+select:disabled, keygen:disabled, optgroup:disabled, option:disabled, datagrid:disabled {
color: GrayText
}
font-weight: normal;
}
+/* datagrid */
+
+datagrid {
+ height: 150px; /* We don't use width:300px in CSS, since we want width:intrinsic and width:min-intrinsic to reset to 300 properly. */
+ -webkit-appearance: datagrid;
+ -webkit-box-sizing: border-box;
+ -webkit-rtl-ordering: logical;
+ color: black;
+ background-color: white;
+ cursor: default;
+ border: 1px inset gray;
+ white-space: initial;
+}
+
/* inline elements */
u, ins {
#include "HTMLDataGridElement.h"
#include "HTMLNames.h"
+#include "RenderDataGrid.h"
#include "Text.h"
namespace WebCore {
return newChild->hasTagName(dcolTag) || newChild->hasTagName(drowTag);
}
+RenderObject* HTMLDataGridElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+ return new (arena) RenderDataGrid(this);
+}
+
bool HTMLDataGridElement::autofocus() const
{
return hasAttribute(autofocusAttr);
setAttribute(multipleAttr, multiple ? "" : 0);
}
-int HTMLDataGridElement::size() const
-{
- return getAttribute(sizeAttr).toInt();
-}
-
-void HTMLDataGridElement::setSize(int size)
-{
- setAttribute(sizeAttr, String::number(size));
-}
-
}
virtual int tagPriority() const { return 6; } // Same as <select>s
virtual bool checkDTD(const Node*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
bool autofocus() const;
void setAutofocus(bool);
bool multiple() const;
void setMultiple(bool);
-
- int size() const;
- void setSize(int);
};
} //namespace
attribute boolean autofocus; // Whether or not the datagrid should autofocus.
attribute boolean disabled; // Whether or not the datagrid can be interacted with.
attribute boolean multiple; // Whether or not the datagrid supports multiple selection.
-
- attribute boolean size; // The number of rows that the datagrid should be sized to (excludes column headers).
};
}
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * 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
+ * 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 "RenderDataGrid.h"
+
+#include "FocusController.h"
+#include "Frame.h"
+#include "GraphicsContext.h"
+#include "Page.h"
+#include "Scrollbar.h"
+
+using std::min;
+
+namespace WebCore {
+
+static const int cDefaultWidth = 300;
+
+RenderDataGrid::RenderDataGrid(Element* elt)
+ : RenderBlock(elt)
+{
+}
+
+RenderDataGrid::~RenderDataGrid()
+{
+}
+
+void RenderDataGrid::calcPrefWidths()
+{
+ m_minPrefWidth = 0;
+ m_maxPrefWidth = 0;
+
+ if (style()->width().isFixed() && style()->width().value() > 0)
+ m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ else
+ m_maxPrefWidth = calcContentBoxWidth(cDefaultWidth);
+
+ if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
+ m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+ m_minPrefWidth = 0;
+ else
+ m_minPrefWidth = m_maxPrefWidth;
+
+ if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
+ m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ }
+
+ int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ m_minPrefWidth += toAdd;
+ m_maxPrefWidth += toAdd;
+
+ setPrefWidthsDirty(false);
+}
+
+void RenderDataGrid::paintObject(PaintInfo& paintInfo, int tx, int ty)
+{
+ if (style()->visibility() != VISIBLE)
+ return;
+
+ // FIXME: Column and cell foregrounds will paint here.
+
+ // Paint our background and border.
+ RenderBlock::paintObject(paintInfo, tx, ty);
+
+ // FIXME: Row, cell and column backgrounds will paint here.
+}
+
+// Scrolling implementation functions
+void RenderDataGrid::valueChanged(Scrollbar*)
+{
+ // FIXME: Implement.
+}
+
+void RenderDataGrid::invalidateScrollbarRect(Scrollbar*, const IntRect&)
+{
+ // FIXME: Implement.
+}
+
+bool RenderDataGrid::isActive() const
+{
+ Page* page = document()->frame()->page();
+ return page && page->focusController()->isActive();
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * 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
+ * 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 RenderDataGrid_h
+#define RenderDataGrid_h
+
+#include "RenderBlock.h"
+#include "ScrollbarClient.h"
+
+namespace WebCore {
+
+class RenderDataGrid : public RenderBlock, private ScrollbarClient {
+public:
+ RenderDataGrid(Element*);
+ ~RenderDataGrid();
+
+ virtual const char* renderName() const { return "RenderDataGrid"; }
+
+ virtual bool canHaveChildren() const { return false; }
+
+ virtual void calcPrefWidths();
+
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+
+private:
+ // ScrollbarClient interface.
+ virtual void valueChanged(Scrollbar*);
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual bool isActive() const;
+ virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on data grids yet. If we did this would have to change.
+
+ RefPtr<Scrollbar> m_vBar;
+};
+
+}
+
+#endif // RenderDataGrid_h