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

Side by Side Diff: sky/engine/core/dom/Node.cpp

Issue 716223003: Fix contenteditable (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | sky/viewer/document_view.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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEditable); 393 return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEditable);
394 } 394 }
395 395
396 bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment treatment) const 396 bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment treatment) const
397 { 397 {
398 // Ideally we'd call ASSERT(!needsStyleRecalc()) here, but 398 // Ideally we'd call ASSERT(!needsStyleRecalc()) here, but
399 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion 399 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion
400 // would fire in the middle of Document::setFocusedNode(). 400 // would fire in the middle of Document::setFocusedNode().
401 401
402 for (const Node* node = this; node; node = node->parentNode()) { 402 for (const Node* node = this; node; node = node->parentNode()) {
403 if ((node->isHTMLElement() || node->isDocumentNode()) && node->renderer( )) { 403 if (node->isHTMLElement() && node->renderer()) {
404 // Elements with user-select: all style are considered atomic 404 // Elements with user-select: all style are considered atomic
405 // therefore non editable. 405 // therefore non editable.
406 if (Position::nodeIsUserSelectAll(node) && treatment == UserSelectAl lIsAlwaysNonEditable) 406 if (Position::nodeIsUserSelectAll(node) && treatment == UserSelectAl lIsAlwaysNonEditable)
407 return false; 407 return false;
408 switch (node->renderer()->style()->userModify()) { 408 if (static_cast<const Element*>(node)->hasAttribute(HTMLNames::conte nteditableAttr))
409 case READ_ONLY:
410 return false;
411 case READ_WRITE:
412 return true;
413 case READ_WRITE_PLAINTEXT_ONLY:
414 return editableLevel != RichlyEditable; 409 return editableLevel != RichlyEditable;
415 }
416 ASSERT_NOT_REACHED();
417 return false; 410 return false;
418 } 411 }
419 } 412 }
420 413
421 return false; 414 return false;
422 } 415 }
423 416
424 bool Node::isEditableToAccessibility(EditableLevel editableLevel) const 417 bool Node::isEditableToAccessibility(EditableLevel editableLevel) const
425 { 418 {
426 return hasEditableStyle(editableLevel); 419 return hasEditableStyle(editableLevel);
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 node->showTreeForThis(); 1850 node->showTreeForThis();
1858 } 1851 }
1859 1852
1860 void showNodePath(const blink::Node* node) 1853 void showNodePath(const blink::Node* node)
1861 { 1854 {
1862 if (node) 1855 if (node)
1863 node->showNodePathForThis(); 1856 node->showNodePathForThis();
1864 } 1857 }
1865 1858
1866 #endif 1859 #endif
OLDNEW
« no previous file with comments | « no previous file | sky/viewer/document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698