Skip to content
Permalink
Browse files
2009-11-11 Kent Tamura <tkent@chromium.org>
        Reviewed by Darin Adler.

        Print the file text of a file upload control in DumpRenderTree for ease of tests.
        https://bugs.webkit.org/show_bug.cgi?id=31195

        * platform/mac-leopard/fast/forms/file-input-disabled-expected.txt:
        * platform/mac/fast/forms/box-shadow-override-expected.txt:
        * platform/mac/fast/forms/file-input-direction-expected.txt:
        * platform/mac/fast/forms/file-input-disabled-expected.txt:
        * platform/mac/fast/forms/form-element-geometry-expected.txt:
        * platform/mac/fast/forms/hidden-input-file-expected.txt:
        * platform/mac/fast/forms/input-appearance-height-expected.txt:
        * platform/mac/fast/forms/input-value-expected.txt:
        * platform/win/fast/forms/box-shadow-override-expected.txt:
        * platform/win/fast/forms/file-input-disabled-expected.txt:
        * platform/win/fast/forms/input-appearance-height-expected.txt:
        * platform/win/fast/forms/input-value-expected.txt:
2009-11-11  Kent Tamura  <tkent@chromium.org>

        Reviewed by Darin Adler.

        Print the file text of a file upload control in DumpRenderTree for ease of tests.
        https://bugs.webkit.org/show_bug.cgi?id=31195

        * rendering/RenderFileUploadControl.cpp:
        (WebCore::RenderFileUploadControl::paintObject):
        (WebCore::RenderFileUploadControl::fileTextValue):
        * rendering/RenderFileUploadControl.h:
        (WebCore::RenderFileUploadControl::isFileUploadControl):
        (WebCore::toRenderFileUploadControl):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::isFileUploadControl):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::operator<<):

Canonical link: https://commits.webkit.org/42280@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Nov 12, 2009
1 parent ce94002 commit 21a673176c9db929fd374e00f73900c03c69d729
@@ -1,3 +1,23 @@
2009-11-11 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Print the file text of a file upload control in DumpRenderTree for ease of tests.
https://bugs.webkit.org/show_bug.cgi?id=31195

* platform/mac-leopard/fast/forms/file-input-disabled-expected.txt:
* platform/mac/fast/forms/box-shadow-override-expected.txt:
* platform/mac/fast/forms/file-input-direction-expected.txt:
* platform/mac/fast/forms/file-input-disabled-expected.txt:
* platform/mac/fast/forms/form-element-geometry-expected.txt:
* platform/mac/fast/forms/hidden-input-file-expected.txt:
* platform/mac/fast/forms/input-appearance-height-expected.txt:
* platform/mac/fast/forms/input-value-expected.txt:
* platform/win/fast/forms/box-shadow-override-expected.txt:
* platform/win/fast/forms/file-input-disabled-expected.txt:
* platform/win/fast/forms/input-appearance-height-expected.txt:
* platform/win/fast/forms/input-value-expected.txt:

2009-11-11 Erik Arvidsson <arv@chromium.org>

Reviewed by Dmitri Titov.
@@ -13,7 +13,7 @@ layer at (0,0) size 800x600
RenderBR {BR} at (0,19) size 0x18
RenderText {#text} at (0,38) size 86x18
text run at (0,38) width 86: " Select File: "
RenderFileUploadControl {INPUT} at (88,39) size 237x18
RenderFileUploadControl {INPUT} at (88,39) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [color=#808080] [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -38,7 +38,7 @@ layer at (0,0) size 800x600
RenderBlock {DIV} at (57,0) size 15x15
RenderText {#text} at (177,9) size 4x18
text run at (177,9) width 4: " "
RenderFileUploadControl {INPUT} at (183,10) size 237x18
RenderFileUploadControl {INPUT} at (183,10) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -20,25 +20,25 @@ layer at (0,0) size 1083x585
RenderTableRow {TR} at (0,24) size 1075x26
RenderTableCell {TH} at (2,36) size 83x2 [r=1 c=0 rs=1 cs=1]
RenderTableCell {TD} at (87,24) size 245x26 [border: (1px solid #000000)] [r=1 c=1 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (334,24) size 245x26 [border: (1px solid #000000)] [r=1 c=2 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (581,24) size 245x26 [border: (1px solid #000000)] [r=1 c=3 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (828,24) size 245x26 [border: (1px solid #000000)] [r=1 c=4 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -48,25 +48,25 @@ layer at (0,0) size 1083x585
RenderText {#text} at (1,1) size 81x18
text run at (1,1) width 81: "direction:ltr"
RenderTableCell {TD} at (87,52) size 245x26 [border: (1px solid #000000)] [r=2 c=1 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (334,52) size 245x26 [border: (1px solid #000000)] [r=2 c=2 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (581,52) size 245x26 [border: (1px solid #000000)] [r=2 c=3 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (828,52) size 245x26 [border: (1px solid #000000)] [r=2 c=4 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -76,25 +76,25 @@ layer at (0,0) size 1083x585
RenderText {#text} at (1,1) size 81x18
text run at (1,1) width 81: "direction:rtl"
RenderTableCell {TD} at (87,80) size 245x26 [border: (1px solid #000000)] [r=3 c=1 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (159,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (334,80) size 245x26 [border: (1px solid #000000)] [r=3 c=2 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (159,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (581,80) size 245x26 [border: (1px solid #000000)] [r=3 c=3 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (159,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
text run at (0,0) width 62: "Choose File"
RenderTableCell {TD} at (828,80) size 245x26 [border: (1px solid #000000)] [r=3 c=4 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (4,4) size 237x18
RenderFileUploadControl {INPUT} at (4,4) size 237x18 "no file selected"
RenderButton {INPUT} at (159,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -13,7 +13,7 @@ layer at (0,0) size 800x600
RenderBR {BR} at (0,19) size 0x18
RenderText {#text} at (0,38) size 86x18
text run at (0,38) width 86: " Select File: "
RenderFileUploadControl {INPUT} at (88,39) size 237x18
RenderFileUploadControl {INPUT} at (88,39) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [color=#7F7F7F] [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -100,7 +100,7 @@ layer at (0,0) size 785x630
RenderListBox {SELECT} at (2,2) size 34x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
RenderTableCell {TD} at (126,2) size 243x24 [r=0 c=2 rs=1 cs=1]
RenderBlock {DIV} at (1,1) size 241x22 [border: (2px solid #0000FF)]
RenderFileUploadControl {INPUT} at (2,2) size 237x18
RenderFileUploadControl {INPUT} at (2,2) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -178,7 +178,7 @@ layer at (0,0) size 785x630
RenderTextControl {INPUT} at (29,22) size 74x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
RenderText {#text} at (105,22) size 4x18
text run at (105,22) width 4: " "
RenderFileUploadControl {INPUT} at (111,23) size 237x18
RenderFileUploadControl {INPUT} at (111,23) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -5,7 +5,7 @@ layer at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderText {#text} at (0,1) size 524x18
text run at (0,1) width 524: "This tests that the whole file input control is hidden when visibility is set to hidden. "
RenderFileUploadControl {INPUT} at (526,2) size 237x18
RenderFileUploadControl {INPUT} at (526,2) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -27,7 +27,7 @@ layer at (0,0) size 800x600
RenderBR {BR} at (87,60) size 0x0
RenderText {#text} at (0,66) size 24x18
text run at (0,66) width 24: "file "
RenderFileUploadControl {INPUT} at (26,67) size 237x18
RenderFileUploadControl {INPUT} at (26,67) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -191,7 +191,7 @@ layer at (0,0) size 800x600
RenderText {#text} at (1,1) size 204x18
text run at (1,1) width 204: "file with value property changed"
RenderTableCell {TD} at (389,318) size 243x24 [r=13 c=1 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (3,3) size 237x18
RenderFileUploadControl {INPUT} at (3,3) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -38,7 +38,7 @@ layer at (0,0) size 800x600
RenderBlock {DIV} at (57,0) size 15x15
RenderText {#text} at (177,9) size 4x18
text run at (177,9) width 4: " "
RenderFileUploadControl {INPUT} at (183,10) size 237x18
RenderFileUploadControl {INPUT} at (183,10) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -13,7 +13,7 @@ layer at (0,0) size 800x600
RenderBR {BR} at (0,19) size 0x18
RenderText {#text} at (0,38) size 86x18
text run at (0,38) width 86: " Select File: "
RenderFileUploadControl {INPUT} at (88,39) size 237x18
RenderFileUploadControl {INPUT} at (88,39) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [color=#808080] [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -27,7 +27,7 @@ layer at (0,0) size 800x600
RenderBR {BR} at (87,60) size 0x0
RenderText {#text} at (0,66) size 24x18
text run at (0,66) width 24: "file "
RenderFileUploadControl {INPUT} at (26,67) size 237x18
RenderFileUploadControl {INPUT} at (26,67) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -191,7 +191,7 @@ layer at (0,0) size 800x600
RenderText {#text} at (1,1) size 204x18
text run at (1,1) width 204: "file with value property changed"
RenderTableCell {TD} at (389,318) size 243x24 [r=13 c=1 rs=1 cs=1]
RenderFileUploadControl {INPUT} at (3,3) size 237x18
RenderFileUploadControl {INPUT} at (3,3) size 237x18 "no file selected"
RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 62x13
RenderText at (0,0) size 62x13
@@ -1,3 +1,21 @@
2009-11-11 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Print the file text of a file upload control in DumpRenderTree for ease of tests.
https://bugs.webkit.org/show_bug.cgi?id=31195

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::fileTextValue):
* rendering/RenderFileUploadControl.h:
(WebCore::RenderFileUploadControl::isFileUploadControl):
(WebCore::toRenderFileUploadControl):
* rendering/RenderObject.h:
(WebCore::RenderObject::isFileUploadControl):
* rendering/RenderTreeAsText.cpp:
(WebCore::operator<<):

2009-11-11 Gavin Barraclough <barraclough@apple.com>

Reviewed by Sam Weinig.
@@ -187,7 +187,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
}

if (paintInfo.phase == PaintPhaseForeground) {
const String& displayedFilename = m_fileChooser->basenameForWidth(style()->font(), maxFilenameWidth());
const String& displayedFilename = fileTextValue();
unsigned length = displayedFilename.length();
const UChar* string = displayedFilename.characters();
TextRun textRun(string, length, false, 0, 0, style()->direction() == RTL, style()->unicodeBidi() == Override);
@@ -287,7 +287,7 @@ String RenderFileUploadControl::buttonValue()
return m_button->value();
}

String RenderFileUploadControl::fileTextValue()
String RenderFileUploadControl::fileTextValue() const
{
return m_fileChooser->basenameForWidth(style()->font(), maxFilenameWidth());
}
@@ -37,14 +37,16 @@ class RenderFileUploadControl : public RenderBlock, private FileChooserClient {
RenderFileUploadControl(HTMLInputElement*);
virtual ~RenderFileUploadControl();

virtual bool isFileUploadControl() const { return true; }

void click();

void valueChanged();

void receiveDroppedFiles(const Vector<String>&);

String buttonValue();
String fileTextValue();
String fileTextValue() const;

bool allowsMultipleFiles();

@@ -66,10 +68,16 @@ class RenderFileUploadControl : public RenderBlock, private FileChooserClient {

inline RenderFileUploadControl* toRenderFileUploadControl(RenderObject* object)
{
ASSERT(!object || !strcmp(object->renderName(), "RenderFileUploadControl"));
ASSERT(!object || object->isFileUploadControl());
return static_cast<RenderFileUploadControl*>(object);
}

inline const RenderFileUploadControl* toRenderFileUploadControl(const RenderObject* object)
{
ASSERT(!object || object->isFileUploadControl());
return static_cast<const RenderFileUploadControl*>(object);
}

// This will catch anyone doing an unnecessary cast.
void toRenderFileUploadControl(const RenderFileUploadControl*);

@@ -253,6 +253,7 @@ class RenderObject : public CachedResourceClient {
virtual bool isBoxModelObject() const { return false; }
virtual bool isCounter() const { return false; }
virtual bool isFieldset() const { return false; }
virtual bool isFileUploadControl() const { return false; }
virtual bool isFrame() const { return false; }
virtual bool isFrameSet() const { return false; }
virtual bool isImage() const { return false; }
@@ -36,6 +36,7 @@
#include "HTMLNames.h"
#include "InlineTextBox.h"
#include "RenderBR.h"
#include "RenderFileUploadControl.h"
#include "RenderInline.h"
#include "RenderListMarker.h"
#include "RenderTableCell.h"
@@ -217,6 +218,9 @@ static TextStream &operator<<(TextStream& ts, const RenderObject& o)
ts << " " << r;

if (!(o.isText() && !o.isBR())) {
if (o.isFileUploadControl()) {
ts << " " << quoteAndEscapeNonPrintables(toRenderFileUploadControl(&o)->fileTextValue());
}
if (o.parent() && (o.parent()->style()->color() != o.style()->color()))
ts << " [color=" << o.style()->color().name() << "]";

0 comments on commit 21a6731

Please sign in to comment.