OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "PlatformLocale.h" | 40 #include "PlatformLocale.h" |
41 #include "RenderStyle.h" | 41 #include "RenderStyle.h" |
42 #include "StyleResolver.h" | 42 #include "StyleResolver.h" |
43 #include "Text.h" | 43 #include "Text.h" |
44 #include <wtf/DateMath.h> | 44 #include <wtf/DateMath.h> |
45 #include <wtf/text/StringBuilder.h> | 45 #include <wtf/text/StringBuilder.h> |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 50 using namespace WTF::Unicode; |
50 | 51 |
51 class DateTimeEditBuilder : private DateTimeFormat::TokenHandler { | 52 class DateTimeEditBuilder : private DateTimeFormat::TokenHandler { |
52 WTF_MAKE_NONCOPYABLE(DateTimeEditBuilder); | 53 WTF_MAKE_NONCOPYABLE(DateTimeEditBuilder); |
53 | 54 |
54 public: | 55 public: |
55 // The argument objects must be alive until this object dies. | 56 // The argument objects must be alive until this object dies. |
56 DateTimeEditBuilder(DateTimeEditElement&, const DateTimeEditElement::LayoutP
arameters&, const DateComponents&); | 57 DateTimeEditBuilder(DateTimeEditElement&, const DateTimeEditElement::LayoutP
arameters&, const DateComponents&); |
57 | 58 |
58 bool build(const String&); | 59 bool build(const String&); |
59 | 60 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 Decimal secondPartOfMinimum = (stepRange().minimum().abs().remainder(decimal
MsPerMinute) / static_cast<int>(msPerSecond)).floor(); | 282 Decimal secondPartOfMinimum = (stepRange().minimum().abs().remainder(decimal
MsPerMinute) / static_cast<int>(msPerSecond)).floor(); |
282 return secondPartOfMinimum == m_dateValue.second() && stepRange().step().rem
ainder(decimalMsPerMinute).isZero(); | 283 return secondPartOfMinimum == m_dateValue.second() && stepRange().step().rem
ainder(decimalMsPerMinute).isZero(); |
283 } | 284 } |
284 | 285 |
285 void DateTimeEditBuilder::visitLiteral(const String& text) | 286 void DateTimeEditBuilder::visitLiteral(const String& text) |
286 { | 287 { |
287 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text
", AtomicString::ConstructFromLiteral)); | 288 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text
", AtomicString::ConstructFromLiteral)); |
288 ASSERT(text.length()); | 289 ASSERT(text.length()); |
289 RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.docume
nt()); | 290 RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.docume
nt()); |
290 element->setShadowPseudoId(textPseudoId); | 291 element->setShadowPseudoId(textPseudoId); |
| 292 if (m_parameters.locale.isRTL() && text.length()) { |
| 293 Direction dir = direction(text[0]); |
| 294 if (dir == SegmentSeparator || dir == WhiteSpaceNeutral || dir == OtherN
eutral) |
| 295 element->appendChild(Text::create(m_editElement.document(), String(&
rightToLeftMark, 1))); |
| 296 } |
291 element->appendChild(Text::create(m_editElement.document(), text)); | 297 element->appendChild(Text::create(m_editElement.document(), text)); |
292 m_editElement.appendChild(element); | 298 m_editElement.appendChild(element); |
293 } | 299 } |
294 | 300 |
295 // ---------------------------- | 301 // ---------------------------- |
296 | 302 |
297 DateTimeEditElement::EditControlOwner::~EditControlOwner() | 303 DateTimeEditElement::EditControlOwner::~EditControlOwner() |
298 { | 304 { |
299 } | 305 } |
300 | 306 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 { | 595 { |
590 DateTimeFieldsState dateTimeFieldsState; | 596 DateTimeFieldsState dateTimeFieldsState; |
591 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) | 597 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) |
592 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); | 598 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); |
593 return dateTimeFieldsState; | 599 return dateTimeFieldsState; |
594 } | 600 } |
595 | 601 |
596 } // namespace WebCore | 602 } // namespace WebCore |
597 | 603 |
598 #endif | 604 #endif |
OLD | NEW |