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

Side by Side Diff: Source/core/html/HTMLTextFormControlElement.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
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | Source/core/html/HTMLTitleElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 if (Frame* frame = document()->frame()) 325 if (Frame* frame = document()->frame())
326 frame->selection()->setSelection(newSelection); 326 frame->selection()->setSelection(newSelection);
327 } 327 }
328 328
329 VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c onst 329 VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c onst
330 { 330 {
331 if (index <= 0) 331 if (index <= 0)
332 return VisiblePosition(firstPositionInNode(innerTextElement()), DOWNSTRE AM); 332 return VisiblePosition(firstPositionInNode(innerTextElement()), DOWNSTRE AM);
333 RefPtr<Range> range = Range::create(document()); 333 RefPtr<Range> range = Range::create(document());
334 range->selectNodeContents(innerTextElement(), ASSERT_NO_EXCEPTION_STATE); 334 range->selectNodeContents(innerTextElement(), ASSERT_NO_EXCEPTION);
335 CharacterIterator it(range.get()); 335 CharacterIterator it(range.get());
336 it.advance(index - 1); 336 it.advance(index - 1);
337 return VisiblePosition(it.range()->endPosition(), UPSTREAM); 337 return VisiblePosition(it.range()->endPosition(), UPSTREAM);
338 } 338 }
339 339
340 int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& p os) const 340 int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& p os) const
341 { 341 {
342 Position indexPosition = pos.deepEquivalent().parentAnchoredEquivalent(); 342 Position indexPosition = pos.deepEquivalent().parentAnchoredEquivalent();
343 if (enclosingTextFormControl(indexPosition) != this) 343 if (enclosingTextFormControl(indexPosition) != this)
344 return 0; 344 return 0;
345 RefPtr<Range> range = Range::create(indexPosition.document()); 345 RefPtr<Range> range = Range::create(indexPosition.document());
346 range->setStart(innerTextElement(), 0, ASSERT_NO_EXCEPTION_STATE); 346 range->setStart(innerTextElement(), 0, ASSERT_NO_EXCEPTION);
347 range->setEnd(indexPosition.containerNode(), indexPosition.offsetInContainer Node(), ASSERT_NO_EXCEPTION_STATE); 347 range->setEnd(indexPosition.containerNode(), indexPosition.offsetInContainer Node(), ASSERT_NO_EXCEPTION);
348 return TextIterator::rangeLength(range.get()); 348 return TextIterator::rangeLength(range.get());
349 } 349 }
350 350
351 int HTMLTextFormControlElement::selectionStart() const 351 int HTMLTextFormControlElement::selectionStart() const
352 { 352 {
353 if (!isTextFormControl()) 353 if (!isTextFormControl())
354 return 0; 354 return 0;
355 if (document()->focusedElement() != this && hasCachedSelection()) 355 if (document()->focusedElement() != this && hasCachedSelection())
356 return m_cachedSelectionStart; 356 return m_cachedSelectionStart;
357 357
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 { 518 {
519 if (!isTextFormControl()) 519 if (!isTextFormControl())
520 return; 520 return;
521 521
522 bool textIsChanged = value != innerTextValue(); 522 bool textIsChanged = value != innerTextValue();
523 if (textIsChanged || !innerTextElement()->hasChildNodes()) { 523 if (textIsChanged || !innerTextElement()->hasChildNodes()) {
524 if (textIsChanged && document() && renderer()) { 524 if (textIsChanged && document() && renderer()) {
525 if (AXObjectCache* cache = document()->existingAXObjectCache()) 525 if (AXObjectCache* cache = document()->existingAXObjectCache())
526 cache->postNotification(this, AXObjectCache::AXValueChanged, fal se); 526 cache->postNotification(this, AXObjectCache::AXValueChanged, fal se);
527 } 527 }
528 innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION_STATE); 528 innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION);
529 529
530 if (value.endsWith('\n') || value.endsWith('\r')) 530 if (value.endsWith('\n') || value.endsWith('\r'))
531 innerTextElement()->appendChild(HTMLBRElement::create(document()), A SSERT_NO_EXCEPTION_STATE, AttachLazily); 531 innerTextElement()->appendChild(HTMLBRElement::create(document()), A SSERT_NO_EXCEPTION, AttachLazily);
532 } 532 }
533 533
534 setFormControlValueMatchesRenderer(true); 534 setFormControlValueMatchesRenderer(true);
535 } 535 }
536 536
537 static String finishText(StringBuilder& result) 537 static String finishText(StringBuilder& result)
538 { 538 {
539 // Remove one trailing newline; there's always one that's collapsed out by r endering. 539 // Remove one trailing newline; there's always one that's collapsed out by r endering.
540 size_t size = result.length(); 540 size_t size = result.length();
541 if (size && result[size - 1] == '\n') 541 if (size && result[size - 1] == '\n')
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 bool isAuto; 657 bool isAuto;
658 TextDirection textDirection = static_cast<const HTMLElement*>(elemen t)->directionalityIfhasDirAutoAttribute(isAuto); 658 TextDirection textDirection = static_cast<const HTMLElement*>(elemen t)->directionalityIfhasDirAutoAttribute(isAuto);
659 return textDirection == RTL ? "rtl" : "ltr"; 659 return textDirection == RTL ? "rtl" : "ltr";
660 } 660 }
661 } 661 }
662 662
663 return "ltr"; 663 return "ltr";
664 } 664 }
665 665
666 } // namespace Webcore 666 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | Source/core/html/HTMLTitleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698