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

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

Issue 2650183002: Remove spelling markers when element is not editable (Closed)
Patch Set: Add Mac and Windows baselines 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 28 matching lines...) Expand all
39 #include "core/dom/ElementTraversal.h" 39 #include "core/dom/ElementTraversal.h"
40 #include "core/dom/ExceptionCode.h" 40 #include "core/dom/ExceptionCode.h"
41 #include "core/dom/NodeTraversal.h" 41 #include "core/dom/NodeTraversal.h"
42 #include "core/dom/StyleChangeReason.h" 42 #include "core/dom/StyleChangeReason.h"
43 #include "core/dom/Text.h" 43 #include "core/dom/Text.h"
44 #include "core/dom/shadow/ElementShadow.h" 44 #include "core/dom/shadow/ElementShadow.h"
45 #include "core/dom/shadow/FlatTreeTraversal.h" 45 #include "core/dom/shadow/FlatTreeTraversal.h"
46 #include "core/dom/shadow/ShadowRoot.h" 46 #include "core/dom/shadow/ShadowRoot.h"
47 #include "core/editing/EditingUtilities.h" 47 #include "core/editing/EditingUtilities.h"
48 #include "core/editing/serializers/Serialization.h" 48 #include "core/editing/serializers/Serialization.h"
49 #include "core/editing/spellcheck/SpellChecker.h"
49 #include "core/events/EventListener.h" 50 #include "core/events/EventListener.h"
50 #include "core/events/KeyboardEvent.h" 51 #include "core/events/KeyboardEvent.h"
51 #include "core/frame/Settings.h" 52 #include "core/frame/Settings.h"
52 #include "core/frame/UseCounter.h" 53 #include "core/frame/UseCounter.h"
53 #include "core/html/HTMLBRElement.h" 54 #include "core/html/HTMLBRElement.h"
54 #include "core/html/HTMLDimension.h" 55 #include "core/html/HTMLDimension.h"
55 #include "core/html/HTMLFormElement.h" 56 #include "core/html/HTMLFormElement.h"
56 #include "core/html/HTMLInputElement.h" 57 #include "core/html/HTMLInputElement.h"
57 #include "core/html/HTMLMenuElement.h" 58 #include "core/html/HTMLMenuElement.h"
58 #include "core/html/HTMLTemplateElement.h" 59 #include "core/html/HTMLTemplateElement.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 void HTMLElement::attributeChanged(const AttributeModificationParams& params) { 430 void HTMLElement::attributeChanged(const AttributeModificationParams& params) {
430 Element::attributeChanged(params); 431 Element::attributeChanged(params);
431 if (params.reason != AttributeModificationReason::kDirectly) 432 if (params.reason != AttributeModificationReason::kDirectly)
432 return; 433 return;
433 // adjustedFocusedElementInTreeScope() is not trivial. We should check 434 // adjustedFocusedElementInTreeScope() is not trivial. We should check
434 // attribute names, then call adjustedFocusedElementInTreeScope(). 435 // attribute names, then call adjustedFocusedElementInTreeScope().
435 if (params.name == hiddenAttr && !params.newValue.isNull()) { 436 if (params.name == hiddenAttr && !params.newValue.isNull()) {
436 if (adjustedFocusedElementInTreeScope() == this) 437 if (adjustedFocusedElementInTreeScope() == this)
437 blur(); 438 blur();
438 } else if (params.name == contenteditableAttr) { 439 } else if (params.name == contenteditableAttr) {
440 if (params.newValue.isNull() || equalIgnoringCase(params.newValue, "false"))
441 document().frame()->spellChecker().removeSpellingAndGrammarMarkers(*this);
yosin_UTC9 2017/01/25 02:31:41 Do we really need to remove markers synchronously?
Xiaocheng 2017/01/25 02:56:57 I think synchronous marker removal is fine, as we
Manuel Rego 2017/01/25 08:03:10 Good catch! Probably I should use isEditable() to
439 if (adjustedFocusedElementInTreeScope() != this) 442 if (adjustedFocusedElementInTreeScope() != this)
440 return; 443 return;
441 // The attribute change may cause supportsFocus() to return false 444 // The attribute change may cause supportsFocus() to return false
442 // for the element which had focus. 445 // for the element which had focus.
443 // 446 //
444 // TODO(tkent): We should avoid updating style. We'd like to check only 447 // TODO(tkent): We should avoid updating style. We'd like to check only
445 // DOM-level focusability here. 448 // DOM-level focusability here.
446 document().updateStyleAndLayoutTreeForNode(this); 449 document().updateStyleAndLayoutTreeForNode(this);
447 if (!supportsFocus()) 450 if (!supportsFocus())
448 blur(); 451 blur();
449 } 452 }
450 } 453 }
451 454
452 void HTMLElement::parseAttribute(const AttributeModificationParams& params) { 455 void HTMLElement::parseAttribute(const AttributeModificationParams& params) {
453 if (params.name == tabindexAttr || params.name == XMLNames::langAttr) 456 if (params.name == tabindexAttr || params.name == XMLNames::langAttr)
454 return Element::parseAttribute(params); 457 return Element::parseAttribute(params);
455 458
456 if (params.name == dirAttr) { 459 if (params.name == dirAttr) {
457 dirAttributeChanged(params.newValue); 460 dirAttributeChanged(params.newValue);
458 } else if (params.name == langAttr) { 461 } else if (params.name == langAttr) {
459 pseudoStateChanged(CSSSelector::PseudoLang); 462 pseudoStateChanged(CSSSelector::PseudoLang);
463 } else if (params.name == contenteditableAttr) {
464 if (params.newValue.isNull() ||
465 equalIgnoringCase(params.newValue, "false")) {
466 // document().frame()->spellChecker().removeSpellingAndGrammarMarkers(*thi s);
yosin_UTC9 2017/01/25 02:31:41 Could you remove this comment?
Manuel Rego 2017/01/25 08:03:10 Sure this is a leftover from a previous version of
467 }
460 } else { 468 } else {
461 const AtomicString& eventName = eventNameForAttributeName(params.name); 469 const AtomicString& eventName = eventNameForAttributeName(params.name);
462 if (!eventName.isNull()) { 470 if (!eventName.isNull()) {
463 setAttributeEventListener( 471 setAttributeEventListener(
464 eventName, 472 eventName,
465 createAttributeEventListener(this, params.name, params.newValue, 473 createAttributeEventListener(this, params.name, params.newValue,
466 eventParameterName())); 474 eventParameterName()));
467 } 475 }
468 } 476 }
469 } 477 }
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 1223
1216 #ifndef NDEBUG 1224 #ifndef NDEBUG
1217 1225
1218 // For use in the debugger 1226 // For use in the debugger
1219 void dumpInnerHTML(blink::HTMLElement*); 1227 void dumpInnerHTML(blink::HTMLElement*);
1220 1228
1221 void dumpInnerHTML(blink::HTMLElement* element) { 1229 void dumpInnerHTML(blink::HTMLElement* element) {
1222 printf("%s\n", element->innerHTML().ascii().data()); 1230 printf("%s\n", element->innerHTML().ascii().data());
1223 } 1231 }
1224 #endif 1232 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698