Skip to content

Commit 450652c

Browse files
author
Adele Peterson
committed
LayoutTests:
Updated results for addition of -webkit-text-security. * fast/css/computed-style-expected.txt: WebCore: Patch by Francisco, Reviewed by me. Preparation for switch to new text field implementation of password field. Added -webkit-text-security property. Tests: updated fast/css/computed-style-expected.txt * css/CSSPropertyNames.in: Added -webkit-text-security. * css/CSSComputedStyleDeclaration.cpp: (WebCore::): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added cases for textSecurity. * css/cssparser.cpp: (WebCore::CSSParser::parseValue): ditto. * css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::applyProperty): ditto. * css/html4.css: Added style for password field to use -webkit-text-security. * html/HTMLInputElement.cpp: Check appearance property to decide which renderer to use. (WebCore::HTMLInputElement::selectionStart): (WebCore::HTMLInputElement::selectionEnd): (WebCore::HTMLInputElement::setSelectionStart): (WebCore::HTMLInputElement::setSelectionEnd): (WebCore::HTMLInputElement::select): (WebCore::HTMLInputElement::setSelectionRange): (WebCore::HTMLInputElement::createRenderer): * html/HTMLInputElement.h: (WebCore::HTMLInputElement::isNonWidgetTextField): Added check for password. * platform/StringImpl.cpp: (WebCore::StringImpl::secure): Added. Converts a string to replace characters with one character, like a bullet. * platform/StringImpl.h: * rendering/RenderStyle.cpp: (WebCore::StyleCSS3InheritedData::StyleCSS3InheritedData): Initialize textSecurity. (WebCore::RenderStyle::diff): Added case for textSecurity. * rendering/RenderStyle.h: (WebCore::): (WebCore::RenderStyle::textSecurity): Added. (WebCore::RenderStyle::setTextSecurity): Added. (WebCore::RenderStyle::initialTextSecurity): Added. * rendering/RenderText.cpp: (WebCore::RenderText::setStyle): Added case for textSecurity. (WebCore::RenderText::setText): ditto. Canonical link: https://commits.webkit.org/13441@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 5e5aa8f commit 450652c

15 files changed

Lines changed: 191 additions & 12 deletions

LayoutTests/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2006-08-25 Adele Peterson <adele@apple.com>
2+
3+
Updated results for addition of -webkit-text-security.
4+
5+
* fast/css/computed-style-expected.txt:
6+
17
2006-08-25 Adele Peterson <adele@apple.com>
28

39
Reviewed by Hyatt.

LayoutTests/fast/css/computed-style-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ text-decoration: none;
9292
-webkit-text-decorations-in-effect: none;
9393
text-indent: 0px;
9494
text-shadow: none;
95+
-webkit-text-security: none;
9596
text-transform: none;
9697
top: auto;
9798
unicode-bidi: normal;

WebCore/ChangeLog

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2006-08-25 Adele Peterson <adele@apple.com>
2+
3+
Patch by Francisco, Reviewed by me.
4+
5+
Preparation for switch to new text field implementation of password field.
6+
7+
Added -webkit-text-security property.
8+
9+
Tests: updated fast/css/computed-style-expected.txt
10+
11+
* css/CSSPropertyNames.in: Added -webkit-text-security.
12+
* css/CSSComputedStyleDeclaration.cpp:
13+
(WebCore::):
14+
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added cases for textSecurity.
15+
* css/cssparser.cpp: (WebCore::CSSParser::parseValue): ditto.
16+
* css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::applyProperty): ditto.
17+
* css/html4.css: Added style for password field to use -webkit-text-security.
18+
19+
* html/HTMLInputElement.cpp: Check appearance property to decide which renderer to use.
20+
(WebCore::HTMLInputElement::selectionStart):
21+
(WebCore::HTMLInputElement::selectionEnd):
22+
(WebCore::HTMLInputElement::setSelectionStart):
23+
(WebCore::HTMLInputElement::setSelectionEnd):
24+
(WebCore::HTMLInputElement::select):
25+
(WebCore::HTMLInputElement::setSelectionRange):
26+
(WebCore::HTMLInputElement::createRenderer):
27+
* html/HTMLInputElement.h: (WebCore::HTMLInputElement::isNonWidgetTextField): Added check for password.
28+
29+
* platform/StringImpl.cpp: (WebCore::StringImpl::secure): Added. Converts a string to replace
30+
characters with one character, like a bullet.
31+
* platform/StringImpl.h:
32+
33+
* rendering/RenderStyle.cpp:
34+
(WebCore::StyleCSS3InheritedData::StyleCSS3InheritedData): Initialize textSecurity.
35+
(WebCore::RenderStyle::diff): Added case for textSecurity.
36+
* rendering/RenderStyle.h:
37+
(WebCore::):
38+
(WebCore::RenderStyle::textSecurity): Added.
39+
(WebCore::RenderStyle::setTextSecurity): Added.
40+
(WebCore::RenderStyle::initialTextSecurity): Added.
41+
* rendering/RenderText.cpp:
42+
(WebCore::RenderText::setStyle): Added case for textSecurity.
43+
(WebCore::RenderText::setText): ditto.
44+
145
2006-08-25 Adele Peterson <adele@apple.com>
246

347
Reviewed by Hyatt.

WebCore/css/CSSComputedStyleDeclaration.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ static const int computedProperties[] = {
136136
CSS_PROP__WEBKIT_TEXT_DECORATIONS_IN_EFFECT,
137137
CSS_PROP_TEXT_INDENT,
138138
CSS_PROP_TEXT_SHADOW,
139+
CSS_PROP__WEBKIT_TEXT_SECURITY,
139140
CSS_PROP_TEXT_TRANSFORM,
140141
CSS_PROP_TOP,
141142
CSS_PROP_UNICODE_BIDI,
@@ -1110,6 +1111,21 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
11101111
return valueForLength(style->textIndent());
11111112
case CSS_PROP_TEXT_SHADOW:
11121113
return valueForShadow(style->textShadow());
1114+
case CSS_PROP__WEBKIT_TEXT_SECURITY:
1115+
{
1116+
switch (style->textSecurity()) {
1117+
case TSNONE:
1118+
return new CSSPrimitiveValue(CSS_VAL_NONE);
1119+
case TSDISC:
1120+
return new CSSPrimitiveValue(CSS_VAL_DISC);
1121+
case TSCIRCLE:
1122+
return new CSSPrimitiveValue(CSS_VAL_CIRCLE);
1123+
case TSSQUARE:
1124+
return new CSSPrimitiveValue(CSS_VAL_SQUARE);
1125+
}
1126+
ASSERT_NOT_REACHED();
1127+
return 0;
1128+
}
11131129
case CSS_PROP__WEBKIT_TEXT_SIZE_ADJUST:
11141130
if (style->textSizeAdjust())
11151131
return new CSSPrimitiveValue(CSS_VAL_AUTO);

WebCore/css/CSSPropertyNames.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ text-overline-color
138138
text-overline-mode
139139
text-overline-style
140140
text-overline-width
141+
-webkit-text-security
141142
text-shadow
142143
text-transform
143144
text-underline

WebCore/css/cssparser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,12 @@ bool CSSParser::parseValue(int propId, bool important)
11751175
valid_primitive = true;
11761176
break;
11771177

1178+
case CSS_PROP__WEBKIT_TEXT_SECURITY:
1179+
// disc | circle | square | none | inherit
1180+
if (id == CSS_VAL_DISC || id == CSS_VAL_CIRCLE || id == CSS_VAL_SQUARE|| id == CSS_VAL_NONE)
1181+
valid_primitive = true;
1182+
break;
1183+
11781184
#if __APPLE__
11791185
case CSS_PROP__WEBKIT_DASHBOARD_REGION: // <dashboard-region> | <dashboard-region>
11801186
if (value->unit == Value::Function || id == CSS_VAL_NONE)

WebCore/css/cssstyleselector.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4003,6 +4003,21 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
40034003
fontDirty = true;
40044004
break;
40054005
}
4006+
case CSS_PROP__WEBKIT_TEXT_SECURITY: {
4007+
HANDLE_INHERIT_AND_INITIAL(textSecurity, TextSecurity)
4008+
if (!primitiveValue) break;
4009+
ETextSecurity textSecurity= TSNONE;
4010+
switch(primitiveValue->getIdent())
4011+
{
4012+
case CSS_VAL_DISC: textSecurity= TSDISC;
4013+
break;
4014+
case CSS_VAL_CIRCLE: textSecurity= TSCIRCLE;
4015+
break;
4016+
case CSS_VAL_SQUARE: textSecurity= TSSQUARE;
4017+
break;
4018+
}
4019+
style->setTextSecurity(textSecurity);
4020+
}
40064021
#if __APPLE__
40074022
case CSS_PROP__WEBKIT_DASHBOARD_REGION: {
40084023
HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)

WebCore/css/html4.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,17 @@ textarea {
330330
resize: auto;
331331
}
332332

333-
input[type="password"], input[type="search"], input[type="hidden"], input[type="image"], input[type="file"] {
333+
input[type="password"] {
334+
// FIXME: Remove these when switching over to the new implementation for password fields.
335+
-webkit-appearance:none;
336+
background-color: initial;
337+
border:initial;
338+
padding:initial;
339+
340+
-webkit-text-security: disc;
341+
}
342+
343+
input[type="search"], input[type="hidden"], input[type="image"], input[type="file"] {
334344
-webkit-appearance: initial;
335345
padding: initial;
336346
background-color: initial;
@@ -518,7 +528,6 @@ input[type="checkbox"]:focus,
518528
input[type="file"]:focus,
519529
input[type="hidden"]:focus,
520530
input[type="image"]:focus,
521-
input[type="password"]:focus,
522531
input[type="radio"]:focus,
523532
input[type="reset"]:focus,
524533
input[type="search"]:focus,

WebCore/html/HTMLInputElement.cpp

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,17 @@ int HTMLInputElement::selectionStart() const
474474
case RESET:
475475
case SUBMIT:
476476
break;
477-
case PASSWORD:
478477
case SEARCH:
479478
return static_cast<RenderLineEdit*>(renderer())->selectionStart();
480479
case TEXT:
481480
if (document()->focusNode() != this && cachedSelStart >= 0)
482481
return cachedSelStart;
483482
return static_cast<RenderTextControl*>(renderer())->selectionStart();
483+
case PASSWORD:
484+
if (renderer()->style()->appearance() == TextFieldAppearance)
485+
return static_cast<RenderTextControl*>(renderer())->selectionStart();
486+
else
487+
return static_cast<RenderLineEdit*>(renderer())->selectionStart();
484488
}
485489
return 0;
486490
}
@@ -502,13 +506,17 @@ int HTMLInputElement::selectionEnd() const
502506
case RESET:
503507
case SUBMIT:
504508
break;
505-
case PASSWORD:
506509
case SEARCH:
507510
return static_cast<RenderLineEdit*>(renderer())->selectionEnd();
508511
case TEXT:
509512
if (document()->focusNode() != this && cachedSelEnd >= 0)
510513
return cachedSelEnd;
511514
return static_cast<RenderTextControl*>(renderer())->selectionEnd();
515+
case PASSWORD:
516+
if (renderer()->style()->appearance() == TextFieldAppearance)
517+
return static_cast<RenderTextControl*>(renderer())->selectionEnd();
518+
else
519+
return static_cast<RenderLineEdit*>(renderer())->selectionEnd();
512520
}
513521
return 0;
514522
}
@@ -530,13 +538,18 @@ void HTMLInputElement::setSelectionStart(int start)
530538
case RESET:
531539
case SUBMIT:
532540
break;
533-
case PASSWORD:
534541
case SEARCH:
535542
static_cast<RenderLineEdit*>(renderer())->setSelectionStart(start);
536543
break;
537544
case TEXT:
538545
static_cast<RenderTextControl*>(renderer())->setSelectionStart(start);
539546
break;
547+
case PASSWORD:
548+
if (renderer()->style()->appearance() == TextFieldAppearance)
549+
static_cast<RenderTextControl*>(renderer())->setSelectionStart(start);
550+
else
551+
static_cast<RenderLineEdit*>(renderer())->setSelectionStart(start);
552+
break;
540553
}
541554
}
542555

@@ -557,13 +570,18 @@ void HTMLInputElement::setSelectionEnd(int end)
557570
case RESET:
558571
case SUBMIT:
559572
break;
560-
case PASSWORD:
561573
case SEARCH:
562574
static_cast<RenderLineEdit*>(renderer())->setSelectionEnd(end);
563575
break;
564576
case TEXT:
565577
static_cast<RenderTextControl*>(renderer())->setSelectionEnd(end);
566578
break;
579+
case PASSWORD:
580+
if (renderer()->style()->appearance() == TextFieldAppearance)
581+
static_cast<RenderTextControl*>(renderer())->setSelectionEnd(end);
582+
else
583+
static_cast<RenderLineEdit*>(renderer())->setSelectionEnd(end);
584+
break;
567585
}
568586
}
569587

@@ -586,13 +604,18 @@ void HTMLInputElement::select()
586604
case FILE:
587605
static_cast<RenderFileButton*>(renderer())->select();
588606
break;
589-
case PASSWORD:
590607
case SEARCH:
591608
static_cast<RenderLineEdit*>(renderer())->select();
592609
break;
593610
case TEXT:
594611
static_cast<RenderTextControl*>(renderer())->select();
595612
break;
613+
case PASSWORD:
614+
if (renderer()->style()->appearance() == TextFieldAppearance)
615+
static_cast<RenderTextControl*>(renderer())->select();
616+
else
617+
static_cast<RenderLineEdit*>(renderer())->select();
618+
break;
596619
}
597620
}
598621

@@ -613,13 +636,18 @@ void HTMLInputElement::setSelectionRange(int start, int end)
613636
case RESET:
614637
case SUBMIT:
615638
break;
616-
case PASSWORD:
617639
case SEARCH:
618640
static_cast<RenderLineEdit*>(renderer())->setSelectionRange(start, end);
619641
break;
620642
case TEXT:
621643
static_cast<RenderTextControl*>(renderer())->setSelectionRange(start, end);
622644
break;
645+
case PASSWORD:
646+
if (renderer()->style()->appearance() == TextFieldAppearance)
647+
static_cast<RenderTextControl*>(renderer())->setSelectionRange(start, end);
648+
else
649+
static_cast<RenderLineEdit*>(renderer())->setSelectionRange(start, end);
650+
break;
623651
}
624652
}
625653

@@ -836,13 +864,17 @@ RenderObject *HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle *
836864
case IMAGE:
837865
return new (arena) RenderImage(this);
838866
case ISINDEX:
839-
case PASSWORD:
840867
case SEARCH:
841868
return new (arena) RenderLineEdit(this);
842869
case RANGE:
843870
return new (arena) DeprecatedSlider(this);
844871
case TEXT:
845872
return new (arena) RenderTextControl(this, false);
873+
case PASSWORD:
874+
if (style->appearance() == TextFieldAppearance)
875+
return new (arena) RenderTextControl(this, false);
876+
else
877+
return new (arena) RenderLineEdit(this);
846878
}
847879
assert(false);
848880
return 0;

WebCore/html/HTMLInputElement.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
#include "HTMLGenericFormElement.h"
3030

31+
// FIXME: Remove these when converting the password field
32+
#include "RenderStyle.h"
33+
#include "RenderObject.h"
34+
3135
namespace WebCore {
3236

3337
class HTMLImageLoader;
@@ -81,7 +85,8 @@ class HTMLInputElement : public HTMLGenericFormElement
8185
bool isTextField() const { return m_type == TEXT || m_type == PASSWORD || m_type == SEARCH; }
8286
// FIXME: When other text fields switch to the non-NSView implementation, we should add them here.
8387
// Once all text fields switch over, we should merge this with isTextField.
84-
bool isNonWidgetTextField() const { return m_type == TEXT; }
88+
bool isNonWidgetTextField() const { return m_type == TEXT || (m_type == PASSWORD /* FIXME: Remove this style check when converting password */
89+
&& renderer() && renderer()->style()->appearance() == TextFieldAppearance); }
8590

8691
bool checked() const { return m_checked; }
8792
void setChecked(bool, bool sendChangeEvent = false);

0 commit comments

Comments
 (0)