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

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

Issue 2667393005: Fix crash when "contenteditable" attribute changes (Closed)
Patch Set: Use testharness.js in the test Created 3 years, 10 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
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-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 void HTMLElement::attributeChanged(const AttributeModificationParams& params) { 430 void HTMLElement::attributeChanged(const AttributeModificationParams& params) {
431 Element::attributeChanged(params); 431 Element::attributeChanged(params);
432 if (params.reason != AttributeModificationReason::kDirectly) 432 if (params.reason != AttributeModificationReason::kDirectly)
433 return; 433 return;
434 // adjustedFocusedElementInTreeScope() is not trivial. We should check 434 // adjustedFocusedElementInTreeScope() is not trivial. We should check
435 // attribute names, then call adjustedFocusedElementInTreeScope(). 435 // attribute names, then call adjustedFocusedElementInTreeScope().
436 if (params.name == hiddenAttr && !params.newValue.isNull()) { 436 if (params.name == hiddenAttr && !params.newValue.isNull()) {
437 if (adjustedFocusedElementInTreeScope() == this) 437 if (adjustedFocusedElementInTreeScope() == this)
438 blur(); 438 blur();
439 } else if (params.name == contenteditableAttr) { 439 } else if (params.name == contenteditableAttr) {
440 document().frame()->spellChecker().removeSpellingAndGrammarMarkers( 440 if (document().frame()) {
441 *this, SpellChecker::ElementsType::kOnlyNonEditable); 441 document().frame()->spellChecker().removeSpellingAndGrammarMarkers(
442 *this, SpellChecker::ElementsType::kOnlyNonEditable);
443 }
442 if (adjustedFocusedElementInTreeScope() != this) 444 if (adjustedFocusedElementInTreeScope() != this)
443 return; 445 return;
444 // The attribute change may cause supportsFocus() to return false 446 // The attribute change may cause supportsFocus() to return false
445 // for the element which had focus. 447 // for the element which had focus.
446 // 448 //
447 // TODO(tkent): We should avoid updating style. We'd like to check only 449 // TODO(tkent): We should avoid updating style. We'd like to check only
448 // DOM-level focusability here. 450 // DOM-level focusability here.
449 document().updateStyleAndLayoutTreeForNode(this); 451 document().updateStyleAndLayoutTreeForNode(this);
450 if (!supportsFocus()) 452 if (!supportsFocus())
451 blur(); 453 blur();
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 1220
1219 #ifndef NDEBUG 1221 #ifndef NDEBUG
1220 1222
1221 // For use in the debugger 1223 // For use in the debugger
1222 void dumpInnerHTML(blink::HTMLElement*); 1224 void dumpInnerHTML(blink::HTMLElement*);
1223 1225
1224 void dumpInnerHTML(blink::HTMLElement* element) { 1226 void dumpInnerHTML(blink::HTMLElement* element) {
1225 printf("%s\n", element->innerHTML().ascii().data()); 1227 printf("%s\n", element->innerHTML().ascii().data());
1226 } 1228 }
1227 #endif 1229 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698