Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. (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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 else if (equalIgnoringCase(enabled, "false")) | 579 else if (equalIgnoringCase(enabled, "false")) |
| 580 setAttribute(contenteditableAttr, "false"); | 580 setAttribute(contenteditableAttr, "false"); |
| 581 else if (equalIgnoringCase(enabled, "plaintext-only")) | 581 else if (equalIgnoringCase(enabled, "plaintext-only")) |
| 582 setAttribute(contenteditableAttr, "plaintext-only"); | 582 setAttribute(contenteditableAttr, "plaintext-only"); |
| 583 else if (equalIgnoringCase(enabled, "inherit")) | 583 else if (equalIgnoringCase(enabled, "inherit")) |
| 584 removeAttribute(contenteditableAttr); | 584 removeAttribute(contenteditableAttr); |
| 585 else | 585 else |
| 586 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + enabled + "') is not one of 'true', 'false', 'plaintext-only', or 'inherit'."); | 586 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + enabled + "') is not one of 'true', 'false', 'plaintext-only', or 'inherit'."); |
| 587 } | 587 } |
| 588 | 588 |
| 589 bool HTMLElement::isContentEditable() const | |
|
yosin_UTC9
2016/07/21 08:25:02
Why do we need to have |HTMLElement::isContentEdit
tkent
2016/07/21 08:29:54
HTMLElement::isContentEditable is a web-exposed ID
| |
| 590 { | |
| 591 return blink::isContentEditable(*this); | |
| 592 } | |
| 593 | |
| 589 bool HTMLElement::draggable() const | 594 bool HTMLElement::draggable() const |
| 590 { | 595 { |
| 591 return equalIgnoringCase(getAttribute(draggableAttr), "true"); | 596 return equalIgnoringCase(getAttribute(draggableAttr), "true"); |
| 592 } | 597 } |
| 593 | 598 |
| 594 void HTMLElement::setDraggable(bool value) | 599 void HTMLElement::setDraggable(bool value) |
| 595 { | 600 { |
| 596 setAttribute(draggableAttr, value ? "true" : "false"); | 601 setAttribute(draggableAttr, value ? "true" : "false"); |
| 597 } | 602 } |
| 598 | 603 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 return parentElement() && parentElement()->hasEditableStyle(); | 1036 return parentElement() && parentElement()->hasEditableStyle(); |
| 1032 } | 1037 } |
| 1033 | 1038 |
| 1034 void HTMLElement::handleKeypressEvent(KeyboardEvent* event) | 1039 void HTMLElement::handleKeypressEvent(KeyboardEvent* event) |
| 1035 { | 1040 { |
| 1036 if (!isSpatialNavigationEnabled(document().frame()) || !supportsFocus()) | 1041 if (!isSpatialNavigationEnabled(document().frame()) || !supportsFocus()) |
| 1037 return; | 1042 return; |
| 1038 // if the element is a text form control (like <input type=text> or <textare a>) | 1043 // if the element is a text form control (like <input type=text> or <textare a>) |
| 1039 // or has contentEditable attribute on, we should enter a space or newline | 1044 // or has contentEditable attribute on, we should enter a space or newline |
| 1040 // even in spatial navigation mode instead of handling it as a "click" actio n. | 1045 // even in spatial navigation mode instead of handling it as a "click" actio n. |
| 1041 if (isTextFormControl() || isContentEditable()) | 1046 if (isTextFormControl() || blink::isContentEditable(*this)) |
| 1042 return; | 1047 return; |
| 1043 int charCode = event->charCode(); | 1048 int charCode = event->charCode(); |
| 1044 if (charCode == '\r' || charCode == ' ') { | 1049 if (charCode == '\r' || charCode == ' ') { |
| 1045 dispatchSimulatedClick(event); | 1050 dispatchSimulatedClick(event); |
| 1046 event->setDefaultHandled(); | 1051 event->setDefaultHandled(); |
| 1047 } | 1052 } |
| 1048 } | 1053 } |
| 1049 | 1054 |
| 1050 const AtomicString& HTMLElement::eventParameterName() | 1055 const AtomicString& HTMLElement::eventParameterName() |
| 1051 { | 1056 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1101 #ifndef NDEBUG | 1106 #ifndef NDEBUG |
| 1102 | 1107 |
| 1103 // For use in the debugger | 1108 // For use in the debugger |
| 1104 void dumpInnerHTML(blink::HTMLElement*); | 1109 void dumpInnerHTML(blink::HTMLElement*); |
| 1105 | 1110 |
| 1106 void dumpInnerHTML(blink::HTMLElement* element) | 1111 void dumpInnerHTML(blink::HTMLElement* element) |
| 1107 { | 1112 { |
| 1108 printf("%s\n", element->innerHTML().ascii().data()); | 1113 printf("%s\n", element->innerHTML().ascii().data()); |
| 1109 } | 1114 } |
| 1110 #endif | 1115 #endif |
| OLD | NEW |