Commit 28732958 authored by adele's avatar adele

Reviewed by Anders.

        - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10667
          Password: Double-click should select-all to avoid exposing word boundaries

        Test: fast/forms/password-doubleclick-selection.html

        * editing/visible_units.cpp:
        (WebCore::previousBoundary): When searching for boundaries in renderers that use the textSecurity property, 
         convert characters in strings to alpha-numeric characters (in this case, all 'x's) so that every character
         isn't treated as a punctuation boundary.
        (WebCore::nextBoundary): ditto.
        * editing/TextIterator.cpp: (WebCore::SimplifiedBackwardsTextIterator::handleTextNode): Updated to use the renderer's 
          string instead of the node value.  This matches the base class implementation of handleTextNode.

        Code cleanup.
        * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): 
          Avoid unnecessary check for password field case if the smart replace condition is false.
        * page/Frame.cpp: (WebCore::Frame::mayCopy): Removed duplicate code.  Calls isSelectionInPasswordField now.
        * rendering/RenderText.cpp: (WebCore::RenderText::setText): Updated formatting.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a9c6a344
2006-09-02 Adele Peterson <adele@apple.com>
Reviewed by Anders.
- Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10667
Password: Double-click should select-all to avoid exposing word boundaries
Test: fast/forms/password-doubleclick-selection.html
* editing/visible_units.cpp:
(WebCore::previousBoundary): When searching for boundaries in renderers that use the textSecurity property,
convert characters in strings to alpha-numeric characters (in this case, all 'x's) so that every character
isn't treated as a punctuation boundary.
(WebCore::nextBoundary): ditto.
* editing/TextIterator.cpp: (WebCore::SimplifiedBackwardsTextIterator::handleTextNode): Updated to use the renderer's
string instead of the node value. This matches the base class implementation of handleTextNode.
Code cleanup.
* editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply):
Avoid unnecessary check for password field case if the smart replace condition is false.
* page/Frame.cpp: (WebCore::Frame::mayCopy): Removed duplicate code. Calls isSelectionInPasswordField now.
* rendering/RenderText.cpp: (WebCore::RenderText::setText): Updated formatting.
2006-09-01 David Hyatt <hyatt@apple.com>
Fix for 10682, refine the FOUC paint suppression logic so that it
......
......@@ -637,13 +637,13 @@ void ReplaceSelectionCommand::doApply()
endOfInsertedContent = VisiblePosition(Position(m_lastNodeInserted.get(), maxDeepOffset(m_lastNodeInserted.get())));
startOfInsertedContent = VisiblePosition(Position(m_firstNodeInserted.get(), 0));
if (currentRoot) {
// Add spaces for smart replace.
if (m_smartReplace && currentRoot) {
// Disable smart replace for password fields.
Node* start = currentRoot->shadowAncestorNode();
if (start->hasTagName(inputTag) && static_cast<HTMLInputElement*>(start)->inputType() == HTMLInputElement::PASSWORD)
m_smartReplace = false;
}
// Add spaces for smart replace.
if (m_smartReplace) {
bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) &&
!frame->isCharacterSmartReplaceExempt(endOfInsertedContent.characterAfter(), false);
......
......@@ -678,7 +678,7 @@ bool SimplifiedBackwardsTextIterator::handleTextNode()
m_lastTextNode = m_node;
RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
String str = m_node->nodeValue();
String str = renderer->string();
if (!renderer->firstTextBox() && str.length() > 0)
return true;
......
......@@ -70,9 +70,14 @@ static VisiblePosition previousBoundary(const VisiblePosition &c, unsigned (*sea
SimplifiedBackwardsTextIterator it(searchRange.get());
DeprecatedString string;
unsigned next = 0;
bool inTextSecurityMode = start.node() && start.node()->renderer() && start.node()->renderer()->style()->textSecurity() != TSNONE;
while (!it.atEnd() && it.length() > 0) {
// iterate to get chunks until the searchFunction returns a non-zero value.
string.prepend(reinterpret_cast<const DeprecatedChar*>(it.characters()), it.length());
String iteratorString(it.characters(), it.length());
// Treat bullets used in the text security mode as regular characters when looking for boundaries
if (inTextSecurityMode)
iteratorString = iteratorString.impl()->secure('x');
string.prepend(iteratorString.deprecatedString());
next = searchFunction(reinterpret_cast<const UChar*>(string.unicode()), string.length());
if (next != 0)
break;
......@@ -140,10 +145,15 @@ static VisiblePosition nextBoundary(const VisiblePosition &c, unsigned (*searchF
TextIterator it(searchRange.get(), RUNFINDER);
DeprecatedString string;
unsigned next = 0;
bool inTextSecurityMode = start.node() && start.node()->renderer() && start.node()->renderer()->style()->textSecurity() != TSNONE;
while (!it.atEnd() && it.length() > 0) {
// Keep asking the iterator for chunks until the search function
// returns an end value not equal to the length of the string passed to it.
string.append(reinterpret_cast<const DeprecatedChar*>(it.characters()), it.length());
String iteratorString(it.characters(), it.length());
// Treat bullets used in the text security mode as regular characters when looking for boundaries
if (inTextSecurityMode)
iteratorString = iteratorString.impl()->secure('x');
string.append(iteratorString.deprecatedString());
next = searchFunction(reinterpret_cast<const UChar*>(string.unicode()), string.length());
if (next != string.length())
break;
......
......@@ -2189,13 +2189,7 @@ void Frame::pasteAndMatchStyle()
bool Frame::mayCopy()
{
Node* startNode = selection().start().node();
if (startNode) {
startNode = startNode->shadowAncestorNode();
if (startNode->hasTagName(inputTag) && static_cast<HTMLInputElement*>(startNode)->inputType() == HTMLInputElement::PASSWORD)
return false;
}
return true;
return !isSelectionInPasswordField();
}
void Frame::transpose()
......
......@@ -913,16 +913,15 @@ void RenderText::setText(StringImpl *text, bool force)
default:;
}
switch(style()->textSecurity())
{
switch(style()->textSecurity()) {
case TSDISC:
str= str->secure(BULLET_CHAR);
str = str->secure(BULLET_CHAR);
break;
case TSCIRCLE:
str= str->secure(CIRCLE_CHAR);
str = str->secure(CIRCLE_CHAR);
break;
case TSSQUARE:
str= str->secure(SQUARE_CHAR);
str = str->secure(SQUARE_CHAR);
break;
case TSNONE:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment