OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // DCHECK_GE(node.document().lifecycle().state(), | 309 // DCHECK_GE(node.document().lifecycle().state(), |
310 // DocumentLifecycle::StyleClean); | 310 // DocumentLifecycle::StyleClean); |
311 if (node.isPseudoElement()) | 311 if (node.isPseudoElement()) |
312 return false; | 312 return false; |
313 | 313 |
314 // Ideally we'd call DCHECK(!needsStyleRecalc()) here, but | 314 // Ideally we'd call DCHECK(!needsStyleRecalc()) here, but |
315 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion | 315 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion |
316 // would fire in the middle of Document::setFocusedNode(). | 316 // would fire in the middle of Document::setFocusedNode(). |
317 | 317 |
318 for (const Node& ancestor : NodeTraversal::inclusiveAncestorsOf(node)) { | 318 for (const Node& ancestor : NodeTraversal::inclusiveAncestorsOf(node)) { |
319 if ((ancestor.isHTMLElement() || ancestor.isDocumentNode()) && | 319 if (!ancestor.isHTMLElement() && !ancestor.isDocumentNode()) |
320 ancestor.layoutObject()) { | 320 continue; |
321 switch (ancestor.layoutObject()->style()->userModify()) { | 321 const ComputedStyle* style = ancestor.computedStyle(); |
322 case READ_ONLY: | 322 if (!style) |
323 return false; | 323 continue; |
324 case READ_WRITE: | 324 switch (style->userModify()) { |
325 return true; | 325 case READ_ONLY: |
326 case READ_WRITE_PLAINTEXT_ONLY: | 326 return false; |
327 return editableLevel != RichlyEditable; | 327 case READ_WRITE: |
328 } | 328 return true; |
329 NOTREACHED(); | 329 case READ_WRITE_PLAINTEXT_ONLY: |
330 return false; | 330 return editableLevel != RichlyEditable; |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 return false; | 334 return false; |
335 } | 335 } |
336 | 336 |
337 bool hasEditableStyle(const Node& node) { | 337 bool hasEditableStyle(const Node& node) { |
338 // TODO(editing-dev): We shouldn't check editable style in inactive documents. | 338 // TODO(editing-dev): We shouldn't check editable style in inactive documents. |
339 // We should hoist this check in the call stack, replace it by a DCHECK of | 339 // We should hoist this check in the call stack, replace it by a DCHECK of |
340 // active document and ultimately cleanup the code paths with inactive | 340 // active document and ultimately cleanup the code paths with inactive |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 return InputType::DeleteWordBackward; | 2179 return InputType::DeleteWordBackward; |
2180 if (granularity == LineBoundary) | 2180 if (granularity == LineBoundary) |
2181 return InputType::DeleteLineBackward; | 2181 return InputType::DeleteLineBackward; |
2182 return InputType::DeleteContentBackward; | 2182 return InputType::DeleteContentBackward; |
2183 default: | 2183 default: |
2184 return InputType::None; | 2184 return InputType::None; |
2185 } | 2185 } |
2186 } | 2186 } |
2187 | 2187 |
2188 } // namespace blink | 2188 } // namespace blink |
OLD | NEW |