Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: Source/core/html/shadow/DateTimeEditElement.cpp

Issue 22417002: Rename ASSERT_NO_EXCEPTION_STATE and IGNORE_EXCEPTION_STATE (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text ", AtomicString::ConstructFromLiteral)); 403 DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text ", AtomicString::ConstructFromLiteral));
404 ASSERT(text.length()); 404 ASSERT(text.length());
405 RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.docume nt()); 405 RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.docume nt());
406 element->setPseudo(textPseudoId); 406 element->setPseudo(textPseudoId);
407 if (m_parameters.locale.isRTL() && text.length()) { 407 if (m_parameters.locale.isRTL() && text.length()) {
408 Direction dir = direction(text[0]); 408 Direction dir = direction(text[0]);
409 if (dir == SegmentSeparator || dir == WhiteSpaceNeutral || dir == OtherN eutral) 409 if (dir == SegmentSeparator || dir == WhiteSpaceNeutral || dir == OtherN eutral)
410 element->appendChild(Text::create(m_editElement.document(), String(& rightToLeftMark, 1))); 410 element->appendChild(Text::create(m_editElement.document(), String(& rightToLeftMark, 1)));
411 } 411 }
412 element->appendChild(Text::create(m_editElement.document(), text)); 412 element->appendChild(Text::create(m_editElement.document(), text));
413 m_editElement.fieldsWrapperElement()->appendChild(element, ASSERT_NO_EXCEPTI ON_STATE, AttachLazily); 413 m_editElement.fieldsWrapperElement()->appendChild(element, ASSERT_NO_EXCEPTI ON, AttachLazily);
414 } 414 }
415 415
416 DateTimeNumericFieldElement::Step DateTimeEditBuilder::createStep(double msPerFi eldUnit, double msPerFieldSize) const 416 DateTimeNumericFieldElement::Step DateTimeEditBuilder::createStep(double msPerFi eldUnit, double msPerFieldSize) const
417 { 417 {
418 const Decimal msPerFieldUnitDecimal(static_cast<int>(msPerFieldUnit)); 418 const Decimal msPerFieldUnitDecimal(static_cast<int>(msPerFieldUnit));
419 const Decimal msPerFieldSizeDecimal(static_cast<int>(msPerFieldSize)); 419 const Decimal msPerFieldSizeDecimal(static_cast<int>(msPerFieldSize));
420 Decimal stepMilliseconds = stepRange().step(); 420 Decimal stepMilliseconds = stepRange().step();
421 ASSERT(!msPerFieldUnitDecimal.isZero()); 421 ASSERT(!msPerFieldUnitDecimal.isZero());
422 ASSERT(!msPerFieldSizeDecimal.isZero()); 422 ASSERT(!msPerFieldSizeDecimal.isZero());
423 ASSERT(!stepMilliseconds.isZero()); 423 ASSERT(!stepMilliseconds.isZero());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 { 457 {
458 ASSERT(firstChild()); 458 ASSERT(firstChild());
459 return toElement(firstChild()); 459 return toElement(firstChild());
460 } 460 }
461 461
462 void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field) 462 void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field)
463 { 463 {
464 if (m_fields.size() == m_fields.capacity()) 464 if (m_fields.size() == m_fields.capacity())
465 return; 465 return;
466 m_fields.append(field.get()); 466 m_fields.append(field.get());
467 fieldsWrapperElement()->appendChild(field, ASSERT_NO_EXCEPTION_STATE, Attach Lazily); 467 fieldsWrapperElement()->appendChild(field, ASSERT_NO_EXCEPTION, AttachLazily );
468 } 468 }
469 469
470 bool DateTimeEditElement::anyEditableFieldsHaveValues() const 470 bool DateTimeEditElement::anyEditableFieldsHaveValues() const
471 { 471 {
472 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { 472 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) {
473 if (!m_fields[fieldIndex]->isDisabled() && m_fields[fieldIndex]->hasValu e()) 473 if (!m_fields[fieldIndex]->isDisabled() && m_fields[fieldIndex]->hasValu e())
474 return true; 474 return true;
475 } 475 }
476 return false; 476 return false;
477 } 477 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 { 646 {
647 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly( ); 647 return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly( );
648 } 648 }
649 649
650 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue) 650 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue)
651 { 651 {
652 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime- edit-fields-wrapper", AtomicString::ConstructFromLiteral)); 652 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime- edit-fields-wrapper", AtomicString::ConstructFromLiteral));
653 if (!firstChild()) { 653 if (!firstChild()) {
654 RefPtr<HTMLDivElement> element = HTMLDivElement::create(document()); 654 RefPtr<HTMLDivElement> element = HTMLDivElement::create(document());
655 element->setPseudo(fieldsWrapperPseudoId); 655 element->setPseudo(fieldsWrapperPseudoId);
656 appendChild(element.get(), ASSERT_NO_EXCEPTION_STATE, AttachLazily); 656 appendChild(element.get(), ASSERT_NO_EXCEPTION, AttachLazily);
657 } 657 }
658 Element* fieldsWrapper = fieldsWrapperElement(); 658 Element* fieldsWrapper = fieldsWrapperElement();
659 659
660 size_t focusedFieldIndex = this->focusedFieldIndex(); 660 size_t focusedFieldIndex = this->focusedFieldIndex();
661 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex); 661 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex);
662 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud oId() : nullAtom; 662 const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseud oId() : nullAtom;
663 663
664 DateTimeEditBuilder builder(*this, layoutParameters, dateValue); 664 DateTimeEditBuilder builder(*this, layoutParameters, dateValue);
665 Node* lastChildToBeRemoved = fieldsWrapper->lastChild(); 665 Node* lastChildToBeRemoved = fieldsWrapper->lastChild();
666 if (!builder.build(layoutParameters.dateTimeFormat) || m_fields.isEmpty()) { 666 if (!builder.build(layoutParameters.dateTimeFormat) || m_fields.isEmpty()) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 790 {
791 DateTimeFieldsState dateTimeFieldsState; 791 DateTimeFieldsState dateTimeFieldsState;
792 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) 792 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex)
793 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); 793 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState);
794 return dateTimeFieldsState; 794 return dateTimeFieldsState;
795 } 795 }
796 796
797 } // namespace WebCore 797 } // namespace WebCore
798 798
799 #endif 799 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLTreeBuilder.cpp ('k') | Source/core/html/shadow/MediaControlElementTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698