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

Side by Side Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 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/HTMLTextFormControlElement.h ('k') | Source/core/html/HTMLTitleElement.h » ('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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/page/UseCounter.h" 42 #include "core/page/UseCounter.h"
43 #include "core/rendering/RenderBlock.h" 43 #include "core/rendering/RenderBlock.h"
44 #include "core/rendering/RenderTheme.h" 44 #include "core/rendering/RenderTheme.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 std; 50 using namespace std;
51 51
52 HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagN ame, Document* doc, HTMLFormElement* form) 52 HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagN ame, Document& doc, HTMLFormElement* form)
53 : HTMLFormControlElementWithState(tagName, doc, form) 53 : HTMLFormControlElementWithState(tagName, doc, form)
54 , m_lastChangeWasUserEdit(false) 54 , m_lastChangeWasUserEdit(false)
55 , m_cachedSelectionStart(-1) 55 , m_cachedSelectionStart(-1)
56 , m_cachedSelectionEnd(-1) 56 , m_cachedSelectionEnd(-1)
57 , m_cachedSelectionDirection(SelectionHasNoDirection) 57 , m_cachedSelectionDirection(SelectionHasNoDirection)
58 { 58 {
59 } 59 }
60 60
61 HTMLTextFormControlElement::~HTMLTextFormControlElement() 61 HTMLTextFormControlElement::~HTMLTextFormControlElement()
62 { 62 {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 bool textIsChanged = value != innerTextValue(); 503 bool textIsChanged = value != innerTextValue();
504 if (textIsChanged || !innerTextElement()->hasChildNodes()) { 504 if (textIsChanged || !innerTextElement()->hasChildNodes()) {
505 if (textIsChanged && renderer()) { 505 if (textIsChanged && renderer()) {
506 if (AXObjectCache* cache = document().existingAXObjectCache()) 506 if (AXObjectCache* cache = document().existingAXObjectCache())
507 cache->postNotification(this, AXObjectCache::AXValueChanged, fal se); 507 cache->postNotification(this, AXObjectCache::AXValueChanged, fal se);
508 } 508 }
509 innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION); 509 innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION);
510 510
511 if (value.endsWith('\n') || value.endsWith('\r')) 511 if (value.endsWith('\n') || value.endsWith('\r'))
512 innerTextElement()->appendChild(HTMLBRElement::create(&document())); 512 innerTextElement()->appendChild(HTMLBRElement::create(document()));
513 } 513 }
514 514
515 setFormControlValueMatchesRenderer(true); 515 setFormControlValueMatchesRenderer(true);
516 } 516 }
517 517
518 static String finishText(StringBuilder& result) 518 static String finishText(StringBuilder& result)
519 { 519 {
520 // Remove one trailing newline; there's always one that's collapsed out by r endering. 520 // Remove one trailing newline; there's always one that's collapsed out by r endering.
521 size_t size = result.length(); 521 size_t size = result.length();
522 if (size && result[size - 1] == '\n') 522 if (size && result[size - 1] == '\n')
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 bool isAuto; 638 bool isAuto;
639 TextDirection textDirection = static_cast<const HTMLElement*>(elemen t)->directionalityIfhasDirAutoAttribute(isAuto); 639 TextDirection textDirection = static_cast<const HTMLElement*>(elemen t)->directionalityIfhasDirAutoAttribute(isAuto);
640 return textDirection == RTL ? "rtl" : "ltr"; 640 return textDirection == RTL ? "rtl" : "ltr";
641 } 641 }
642 } 642 }
643 643
644 return "ltr"; 644 return "ltr";
645 } 645 }
646 646
647 } // namespace Webcore 647 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.h ('k') | Source/core/html/HTMLTitleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698