| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/html/HTMLFieldSetElement.h" | 30 #include "core/html/HTMLFieldSetElement.h" |
| 31 #include "core/html/HTMLFormElement.h" | 31 #include "core/html/HTMLFormElement.h" |
| 32 #include "core/html/HTMLInputElement.h" | 32 #include "core/html/HTMLInputElement.h" |
| 33 #include "core/html/HTMLLegendElement.h" | 33 #include "core/html/HTMLLegendElement.h" |
| 34 #include "core/html/ValidityState.h" | 34 #include "core/html/ValidityState.h" |
| 35 #include "core/frame/UseCounter.h" | 35 #include "core/frame/UseCounter.h" |
| 36 #include "core/page/Page.h" | 36 #include "core/page/Page.h" |
| 37 #include "core/page/ValidationMessageClient.h" | 37 #include "core/page/ValidationMessageClient.h" |
| 38 #include "core/rendering/RenderBox.h" | 38 #include "core/rendering/RenderBox.h" |
| 39 #include "core/rendering/RenderTheme.h" | 39 #include "core/rendering/RenderTheme.h" |
| 40 #include "platform/text/BidiTextRun.h" |
| 40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 using namespace HTMLNames; | 45 using namespace HTMLNames; |
| 45 | 46 |
| 46 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) | 47 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) |
| 47 : LabelableElement(tagName, document) | 48 : LabelableElement(tagName, document) |
| 48 , m_disabled(false) | 49 , m_disabled(false) |
| 49 , m_isAutofilled(false) | 50 , m_isAutofilled(false) |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (m_willValidateInitialized && m_willValidate == newWillValidate) | 399 if (m_willValidateInitialized && m_willValidate == newWillValidate) |
| 399 return; | 400 return; |
| 400 m_willValidateInitialized = true; | 401 m_willValidateInitialized = true; |
| 401 m_willValidate = newWillValidate; | 402 m_willValidate = newWillValidate; |
| 402 setNeedsValidityCheck(); | 403 setNeedsValidityCheck(); |
| 403 setNeedsStyleRecalc(SubtreeStyleChange); | 404 setNeedsStyleRecalc(SubtreeStyleChange); |
| 404 if (!m_willValidate) | 405 if (!m_willValidate) |
| 405 hideVisibleValidationMessage(); | 406 hideVisibleValidationMessage(); |
| 406 } | 407 } |
| 407 | 408 |
| 409 void HTMLFormControlElement::findCustomValidationMessageTextDirection(const Stri
ng& message, TextDirection &messageDir, String& subMessage, TextDirection &subMe
ssageDir) |
| 410 { |
| 411 bool hasStrongDirection; |
| 412 subMessage = fastGetAttribute(titleAttr); |
| 413 messageDir = determineDirectionality(message, hasStrongDirection); |
| 414 if (!subMessage.isEmpty()) |
| 415 subMessageDir = renderer()->style()->direction(); |
| 416 } |
| 417 |
| 408 void HTMLFormControlElement::updateVisibleValidationMessage() | 418 void HTMLFormControlElement::updateVisibleValidationMessage() |
| 409 { | 419 { |
| 410 Page* page = document().page(); | 420 Page* page = document().page(); |
| 411 if (!page) | 421 if (!page) |
| 412 return; | 422 return; |
| 413 String message; | 423 String message; |
| 414 if (renderer() && willValidate()) | 424 if (renderer() && willValidate()) |
| 415 message = validationMessage().stripWhiteSpace(); | 425 message = validationMessage().stripWhiteSpace(); |
| 416 | 426 |
| 417 m_hasValidationMessage = true; | 427 m_hasValidationMessage = true; |
| 418 ValidationMessageClient* client = &page->validationMessageClient(); | 428 ValidationMessageClient* client = &page->validationMessageClient(); |
| 429 TextDirection messageDir = LTR; |
| 430 TextDirection subMessageDir = LTR; |
| 431 String subMessage = String(); |
| 419 if (message.isEmpty()) | 432 if (message.isEmpty()) |
| 420 client->hideValidationMessage(*this); | 433 client->hideValidationMessage(*this); |
| 421 else | 434 else |
| 422 client->showValidationMessage(*this, message); | 435 findCustomValidationMessageTextDirection(message, messageDir, subMessage
, subMessageDir); |
| 436 client->showValidationMessage(*this, message, messageDir, subMessage, subMes
sageDir); |
| 423 } | 437 } |
| 424 | 438 |
| 425 void HTMLFormControlElement::hideVisibleValidationMessage() | 439 void HTMLFormControlElement::hideVisibleValidationMessage() |
| 426 { | 440 { |
| 427 if (!m_hasValidationMessage) | 441 if (!m_hasValidationMessage) |
| 428 return; | 442 return; |
| 429 | 443 |
| 430 if (ValidationMessageClient* client = validationMessageClient()) | 444 if (ValidationMessageClient* client = validationMessageClient()) |
| 431 client->hideValidationMessage(*this); | 445 client->hideValidationMessage(*this); |
| 432 } | 446 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 546 |
| 533 void HTMLFormControlElement::setFocus(bool flag) | 547 void HTMLFormControlElement::setFocus(bool flag) |
| 534 { | 548 { |
| 535 LabelableElement::setFocus(flag); | 549 LabelableElement::setFocus(flag); |
| 536 | 550 |
| 537 if (!flag && wasChangedSinceLastFormControlChangeEvent()) | 551 if (!flag && wasChangedSinceLastFormControlChangeEvent()) |
| 538 dispatchFormControlChangeEvent(); | 552 dispatchFormControlChangeEvent(); |
| 539 } | 553 } |
| 540 | 554 |
| 541 } // namespace Webcore | 555 } // namespace Webcore |
| OLD | NEW |