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

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

Issue 289273002: Oilpan: make DocumentFragment a heap allocated object. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + add WillBeGarbageCollected FIXME. Created 6 years, 7 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
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/track/vtt/VTTCue.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 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 if (name == dirAttr) { 312 if (name == dirAttr) {
313 dirAttributeChanged(value); 313 dirAttributeChanged(value);
314 } else { 314 } else {
315 const AtomicString& eventName = eventNameForAttributeName(name); 315 const AtomicString& eventName = eventNameForAttributeName(name);
316 if (!eventName.isNull()) 316 if (!eventName.isNull())
317 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value)); 317 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value));
318 } 318 }
319 } 319 }
320 320
321 PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, Exc eptionState& exceptionState) 321 PassRefPtrWillBeRawPtr<DocumentFragment> HTMLElement::textToFragment(const Strin g& text, ExceptionState& exceptionState)
322 { 322 {
323 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); 323 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc ument());
324 unsigned i, length = text.length(); 324 unsigned i, length = text.length();
325 UChar c = 0; 325 UChar c = 0;
326 for (unsigned start = 0; start < length; ) { 326 for (unsigned start = 0; start < length; ) {
327 327
328 // Find next line break. 328 // Find next line break.
329 for (i = start; i < length; i++) { 329 for (i = start; i < length; i++) {
330 c = text[i]; 330 c = text[i];
331 if (c == '\r' || c == '\n') 331 if (c == '\r' || c == '\n')
332 break; 332 break;
333 } 333 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return; 386 return;
387 } 387 }
388 String textWithConsistentLineBreaks = text; 388 String textWithConsistentLineBreaks = text;
389 textWithConsistentLineBreaks.replace("\r\n", "\n"); 389 textWithConsistentLineBreaks.replace("\r\n", "\n");
390 textWithConsistentLineBreaks.replace('\r', '\n'); 390 textWithConsistentLineBreaks.replace('\r', '\n');
391 replaceChildrenWithText(this, textWithConsistentLineBreaks, exceptionSta te); 391 replaceChildrenWithText(this, textWithConsistentLineBreaks, exceptionSta te);
392 return; 392 return;
393 } 393 }
394 394
395 // Add text nodes and <br> elements. 395 // Add text nodes and <br> elements.
396 RefPtr<DocumentFragment> fragment = textToFragment(text, exceptionState); 396 RefPtrWillBeRawPtr<DocumentFragment> fragment = textToFragment(text, excepti onState);
397 if (!exceptionState.hadException()) 397 if (!exceptionState.hadException())
398 replaceChildrenWithFragment(this, fragment.release(), exceptionState); 398 replaceChildrenWithFragment(this, fragment.release(), exceptionState);
399 } 399 }
400 400
401 void HTMLElement::setOuterText(const String &text, ExceptionState& exceptionStat e) 401 void HTMLElement::setOuterText(const String &text, ExceptionState& exceptionStat e)
402 { 402 {
403 if (ieForbidsInsertHTML()) { 403 if (ieForbidsInsertHTML()) {
404 exceptionState.throwDOMException(NoModificationAllowedError, "The '" + l ocalName() + "' element does not support text insertion."); 404 exceptionState.throwDOMException(NoModificationAllowedError, "The '" + l ocalName() + "' element does not support text insertion.");
405 return; 405 return;
406 } 406 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 #ifndef NDEBUG 955 #ifndef NDEBUG
956 956
957 // For use in the debugger 957 // For use in the debugger
958 void dumpInnerHTML(WebCore::HTMLElement*); 958 void dumpInnerHTML(WebCore::HTMLElement*);
959 959
960 void dumpInnerHTML(WebCore::HTMLElement* element) 960 void dumpInnerHTML(WebCore::HTMLElement* element)
961 { 961 {
962 printf("%s\n", element->innerHTML().ascii().data()); 962 printf("%s\n", element->innerHTML().ascii().data());
963 } 963 }
964 #endif 964 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/track/vtt/VTTCue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698