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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16045
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-08-25 Adele Peterson <adele@apple.com>
+
+ Updated results for addition of -webkit-text-security.
+
+ * fast/css/computed-style-expected.txt:
+
2006-08-25 Adele Peterson <adele@apple.com>
Reviewed by Hyatt.
-webkit-text-decorations-in-effect: none;
text-indent: 0px;
text-shadow: none;
+-webkit-text-security: none;
text-transform: none;
top: auto;
unicode-bidi: normal;
+2006-08-25 Adele Peterson <adele@apple.com>
+
+ 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.
+
2006-08-25 Adele Peterson <adele@apple.com>
Reviewed by Hyatt.
CSS_PROP__WEBKIT_TEXT_DECORATIONS_IN_EFFECT,
CSS_PROP_TEXT_INDENT,
CSS_PROP_TEXT_SHADOW,
+ CSS_PROP__WEBKIT_TEXT_SECURITY,
CSS_PROP_TEXT_TRANSFORM,
CSS_PROP_TOP,
CSS_PROP_UNICODE_BIDI,
return valueForLength(style->textIndent());
case CSS_PROP_TEXT_SHADOW:
return valueForShadow(style->textShadow());
+ case CSS_PROP__WEBKIT_TEXT_SECURITY:
+ {
+ switch (style->textSecurity()) {
+ case TSNONE:
+ return new CSSPrimitiveValue(CSS_VAL_NONE);
+ case TSDISC:
+ return new CSSPrimitiveValue(CSS_VAL_DISC);
+ case TSCIRCLE:
+ return new CSSPrimitiveValue(CSS_VAL_CIRCLE);
+ case TSSQUARE:
+ return new CSSPrimitiveValue(CSS_VAL_SQUARE);
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
case CSS_PROP__WEBKIT_TEXT_SIZE_ADJUST:
if (style->textSizeAdjust())
return new CSSPrimitiveValue(CSS_VAL_AUTO);
text-overline-mode
text-overline-style
text-overline-width
+-webkit-text-security
text-shadow
text-transform
text-underline
valid_primitive = true;
break;
+ case CSS_PROP__WEBKIT_TEXT_SECURITY:
+ // disc | circle | square | none | inherit
+ if (id == CSS_VAL_DISC || id == CSS_VAL_CIRCLE || id == CSS_VAL_SQUARE|| id == CSS_VAL_NONE)
+ valid_primitive = true;
+ break;
+
#if __APPLE__
case CSS_PROP__WEBKIT_DASHBOARD_REGION: // <dashboard-region> | <dashboard-region>
if (value->unit == Value::Function || id == CSS_VAL_NONE)
fontDirty = true;
break;
}
+ case CSS_PROP__WEBKIT_TEXT_SECURITY: {
+ HANDLE_INHERIT_AND_INITIAL(textSecurity, TextSecurity)
+ if (!primitiveValue) break;
+ ETextSecurity textSecurity= TSNONE;
+ switch(primitiveValue->getIdent())
+ {
+ case CSS_VAL_DISC: textSecurity= TSDISC;
+ break;
+ case CSS_VAL_CIRCLE: textSecurity= TSCIRCLE;
+ break;
+ case CSS_VAL_SQUARE: textSecurity= TSSQUARE;
+ break;
+ }
+ style->setTextSecurity(textSecurity);
+ }
#if __APPLE__
case CSS_PROP__WEBKIT_DASHBOARD_REGION: {
HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
resize: auto;
}
-input[type="password"], input[type="search"], input[type="hidden"], input[type="image"], input[type="file"] {
+input[type="password"] {
+ // FIXME: Remove these when switching over to the new implementation for password fields.
+ -webkit-appearance:none;
+ background-color: initial;
+ border:initial;
+ padding:initial;
+
+ -webkit-text-security: disc;
+}
+
+input[type="search"], input[type="hidden"], input[type="image"], input[type="file"] {
-webkit-appearance: initial;
padding: initial;
background-color: initial;
input[type="file"]:focus,
input[type="hidden"]:focus,
input[type="image"]:focus,
-input[type="password"]:focus,
input[type="radio"]:focus,
input[type="reset"]:focus,
input[type="search"]:focus,
case RESET:
case SUBMIT:
break;
- case PASSWORD:
case SEARCH:
return static_cast<RenderLineEdit*>(renderer())->selectionStart();
case TEXT:
if (document()->focusNode() != this && cachedSelStart >= 0)
return cachedSelStart;
return static_cast<RenderTextControl*>(renderer())->selectionStart();
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ return static_cast<RenderTextControl*>(renderer())->selectionStart();
+ else
+ return static_cast<RenderLineEdit*>(renderer())->selectionStart();
}
return 0;
}
case RESET:
case SUBMIT:
break;
- case PASSWORD:
case SEARCH:
return static_cast<RenderLineEdit*>(renderer())->selectionEnd();
case TEXT:
if (document()->focusNode() != this && cachedSelEnd >= 0)
return cachedSelEnd;
return static_cast<RenderTextControl*>(renderer())->selectionEnd();
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ return static_cast<RenderTextControl*>(renderer())->selectionEnd();
+ else
+ return static_cast<RenderLineEdit*>(renderer())->selectionEnd();
}
return 0;
}
case RESET:
case SUBMIT:
break;
- case PASSWORD:
case SEARCH:
static_cast<RenderLineEdit*>(renderer())->setSelectionStart(start);
break;
case TEXT:
static_cast<RenderTextControl*>(renderer())->setSelectionStart(start);
break;
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ static_cast<RenderTextControl*>(renderer())->setSelectionStart(start);
+ else
+ static_cast<RenderLineEdit*>(renderer())->setSelectionStart(start);
+ break;
}
}
case RESET:
case SUBMIT:
break;
- case PASSWORD:
case SEARCH:
static_cast<RenderLineEdit*>(renderer())->setSelectionEnd(end);
break;
case TEXT:
static_cast<RenderTextControl*>(renderer())->setSelectionEnd(end);
break;
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ static_cast<RenderTextControl*>(renderer())->setSelectionEnd(end);
+ else
+ static_cast<RenderLineEdit*>(renderer())->setSelectionEnd(end);
+ break;
}
}
case FILE:
static_cast<RenderFileButton*>(renderer())->select();
break;
- case PASSWORD:
case SEARCH:
static_cast<RenderLineEdit*>(renderer())->select();
break;
case TEXT:
static_cast<RenderTextControl*>(renderer())->select();
break;
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ static_cast<RenderTextControl*>(renderer())->select();
+ else
+ static_cast<RenderLineEdit*>(renderer())->select();
+ break;
}
}
case RESET:
case SUBMIT:
break;
- case PASSWORD:
case SEARCH:
static_cast<RenderLineEdit*>(renderer())->setSelectionRange(start, end);
break;
case TEXT:
static_cast<RenderTextControl*>(renderer())->setSelectionRange(start, end);
break;
+ case PASSWORD:
+ if (renderer()->style()->appearance() == TextFieldAppearance)
+ static_cast<RenderTextControl*>(renderer())->setSelectionRange(start, end);
+ else
+ static_cast<RenderLineEdit*>(renderer())->setSelectionRange(start, end);
+ break;
}
}
case IMAGE:
return new (arena) RenderImage(this);
case ISINDEX:
- case PASSWORD:
case SEARCH:
return new (arena) RenderLineEdit(this);
case RANGE:
return new (arena) DeprecatedSlider(this);
case TEXT:
return new (arena) RenderTextControl(this, false);
+ case PASSWORD:
+ if (style->appearance() == TextFieldAppearance)
+ return new (arena) RenderTextControl(this, false);
+ else
+ return new (arena) RenderLineEdit(this);
}
assert(false);
return 0;
#include "HTMLGenericFormElement.h"
+// FIXME: Remove these when converting the password field
+#include "RenderStyle.h"
+#include "RenderObject.h"
+
namespace WebCore {
class HTMLImageLoader;
bool isTextField() const { return m_type == TEXT || m_type == PASSWORD || m_type == SEARCH; }
// FIXME: When other text fields switch to the non-NSView implementation, we should add them here.
// Once all text fields switch over, we should merge this with isTextField.
- bool isNonWidgetTextField() const { return m_type == TEXT; }
+ bool isNonWidgetTextField() const { return m_type == TEXT || (m_type == PASSWORD /* FIXME: Remove this style check when converting password */
+ && renderer() && renderer()->style()->appearance() == TextFieldAppearance); }
bool checked() const { return m_checked; }
void setChecked(bool, bool sendChangeEvent = false);
return c;
}
+StringImpl* StringImpl::secure(UChar aChar) const
+{
+ StringImpl* c= new StringImpl;
+ c->m_data = newUCharVector(c->m_length= m_length);
+
+ u_memset(c->m_data, aChar, m_length);
+
+ return c;
+}
+
StringImpl* StringImpl::foldCase() const
{
StringImpl* c = new StringImpl;
bool isLower() const;
StringImpl* lower() const;
StringImpl* upper() const;
+ StringImpl* secure(UChar aChar) const;
StringImpl* capitalize(UChar previousCharacter) const;
StringImpl* foldCase() const;
StyleCSS3InheritedData::StyleCSS3InheritedData()
: textShadow(0)
+ , textSecurity(RenderStyle::initialTextSecurity())
, userModify(READ_ONLY)
, wordWrap(WBNORMAL)
, nbspMode(NBNORMAL)
: Shared<StyleCSS3InheritedData>()
, textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
, highlight(o.highlight)
+ , textSecurity(o.textSecurity)
, userModify(o.userModify)
, wordWrap(o.wordWrap)
, nbspMode(o.nbspMode)
visual->colspan != other->visual->colspan ||
visual->counter_increment != other->visual->counter_increment ||
visual->counter_reset != other->visual->counter_reset ||
- css3NonInheritedData->textOverflow != other->css3NonInheritedData->textOverflow)
+ css3NonInheritedData->textOverflow != other->css3NonInheritedData->textOverflow ||
+ (css3InheritedData->textSecurity != other->css3InheritedData->textSecurity))
return Layout;
// changes causing Layout changes:
#endif
//------------------------------------------------
+
+enum ETextSecurity {
+ TSNONE, TSDISC, TSCIRCLE, TSSQUARE
+};
+
// CSS3 User Modify Properties
enum EUserModify {
ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
AtomicString highlight; // Apple-specific extension for custom highlight rendering.
+ unsigned textSecurity : 2; // ETextSecurity
unsigned userModify : 2; // EUserModify (editing)
unsigned wordWrap : 1; // EWordWrap
unsigned nbspMode : 1; // ENBSPMode
// Apple-specific property getter methods
int lineClamp() const { return css3NonInheritedData->lineClamp; }
bool textSizeAdjust() const { return css3InheritedData->textSizeAdjust; }
+ ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(css3InheritedData->textSecurity); }
// attribute setter methods
// Apple-specific property setters
void setLineClamp(int c) { SET_VAR(css3NonInheritedData, lineClamp, c); }
void setTextSizeAdjust(bool b) { SET_VAR(css3InheritedData, textSizeAdjust, b); }
+ void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(css3InheritedData, textSecurity, aTextSecurity); }
#ifdef SVG_SUPPORT
const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
// Keep these at the end.
static int initialLineClamp() { return -1; }
static bool initialTextSizeAdjust() { return true; }
+ static ETextSecurity initialTextSecurity() { return TSNONE; }
static const DeprecatedValueList<StyleDashboardRegion>& initialDashboardRegions();
static const DeprecatedValueList<StyleDashboardRegion>& noneDashboardRegions();
};
bool needToTransformText = (!style() && _style->textTransform() != TTNONE) ||
(style() && style()->textTransform() != _style->textTransform());
+ bool needToSecureText = (!style() && _style->textSecurity() != TSNONE);
+
RenderObject::setStyle( _style );
- if (needToTransformText) {
+ if (needToTransformText || needToSecureText) {
RefPtr<StringImpl> textToTransform = originalString();
if (textToTransform)
setText(textToTransform.get(), true);
setText(text, force);
}
+#define BULLET_CHAR 0x2022
+#define SQUARE_CHAR 0x25AA
+#define CIRCLE_CHAR 0x25E6
+
void RenderText::setText(StringImpl *text, bool force)
{
if (!text)
case NONE:
default:;
}
+
+ switch(style()->textSecurity())
+ {
+ case TSDISC:
+ str= str->secure(BULLET_CHAR);
+ break;
+ case TSCIRCLE:
+ str= str->secure(CIRCLE_CHAR);
+ break;
+ case TSSQUARE:
+ str= str->secure(SQUARE_CHAR);
+ break;
+ case TSNONE:
+ break;
+ }
}
}