| 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 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "sky/engine/core/dom/shadow/InsertionPoint.h" | 61 #include "sky/engine/core/dom/shadow/InsertionPoint.h" |
| 62 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 62 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 63 #include "sky/engine/core/editing/FrameSelection.h" | 63 #include "sky/engine/core/editing/FrameSelection.h" |
| 64 #include "sky/engine/core/editing/TextIterator.h" | 64 #include "sky/engine/core/editing/TextIterator.h" |
| 65 #include "sky/engine/core/editing/htmlediting.h" | 65 #include "sky/engine/core/editing/htmlediting.h" |
| 66 #include "sky/engine/core/events/EventDispatcher.h" | 66 #include "sky/engine/core/events/EventDispatcher.h" |
| 67 #include "sky/engine/core/events/FocusEvent.h" | 67 #include "sky/engine/core/events/FocusEvent.h" |
| 68 #include "sky/engine/core/frame/FrameView.h" | 68 #include "sky/engine/core/frame/FrameView.h" |
| 69 #include "sky/engine/core/frame/LocalFrame.h" | 69 #include "sky/engine/core/frame/LocalFrame.h" |
| 70 #include "sky/engine/core/frame/Settings.h" | 70 #include "sky/engine/core/frame/Settings.h" |
| 71 #include "sky/engine/core/html/HTMLCanvasElement.h" | |
| 72 #include "sky/engine/core/html/HTMLElement.h" | 71 #include "sky/engine/core/html/HTMLElement.h" |
| 73 #include "sky/engine/core/html/HTMLTemplateElement.h" | 72 #include "sky/engine/core/html/HTMLTemplateElement.h" |
| 74 #include "sky/engine/core/html/parser/HTMLDocumentParser.h" | 73 #include "sky/engine/core/html/parser/HTMLDocumentParser.h" |
| 75 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" | 74 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" |
| 76 #include "sky/engine/core/page/ChromeClient.h" | 75 #include "sky/engine/core/page/ChromeClient.h" |
| 77 #include "sky/engine/core/page/FocusController.h" | 76 #include "sky/engine/core/page/FocusController.h" |
| 78 #include "sky/engine/core/page/Page.h" | 77 #include "sky/engine/core/page/Page.h" |
| 79 #include "sky/engine/core/painting/PaintingCallback.h" | 78 #include "sky/engine/core/painting/PaintingCallback.h" |
| 80 #include "sky/engine/core/painting/PaintingTasks.h" | 79 #include "sky/engine/core/painting/PaintingTasks.h" |
| 81 #include "sky/engine/core/rendering/RenderLayer.h" | 80 #include "sky/engine/core/rendering/RenderLayer.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return hasRareData() ? elementRareData()->tabIndex() : 0; | 132 return hasRareData() ? elementRareData()->tabIndex() : 0; |
| 134 return -1; | 133 return -1; |
| 135 } | 134 } |
| 136 | 135 |
| 137 bool Element::rendererIsFocusable() const | 136 bool Element::rendererIsFocusable() const |
| 138 { | 137 { |
| 139 // FIXME: These asserts should be in Node::isFocusable, but there are some | 138 // FIXME: These asserts should be in Node::isFocusable, but there are some |
| 140 // callsites like Document::setFocusedElement that would currently fail on | 139 // callsites like Document::setFocusedElement that would currently fail on |
| 141 // them. See crbug.com/251163 | 140 // them. See crbug.com/251163 |
| 142 if (!renderer()) { | 141 if (!renderer()) { |
| 143 // Elements in canvas fallback content are not rendered, but they are al
lowed to be | |
| 144 // focusable as long as their canvas is displayed and visible. | |
| 145 if (const HTMLCanvasElement* canvas = Traversal<HTMLCanvasElement>::firs
tAncestorOrSelf(*this)) | |
| 146 return canvas->renderer(); | |
| 147 // We can't just use needsStyleRecalc() because if the node is in a | 142 // We can't just use needsStyleRecalc() because if the node is in a |
| 148 // display:none tree it might say it needs style recalc but the whole | 143 // display:none tree it might say it needs style recalc but the whole |
| 149 // document is actually up to date. | 144 // document is actually up to date. |
| 150 ASSERT(!document().childNeedsStyleRecalc()); | 145 ASSERT(!document().childNeedsStyleRecalc()); |
| 151 } | 146 } |
| 152 | 147 |
| 153 // FIXME: Even if we are not visible, we might have a child that is visible. | 148 // FIXME: Even if we are not visible, we might have a child that is visible. |
| 154 // Hyatt wants to fix that some day with a "has visible content" flag or the
like. | 149 // Hyatt wants to fix that some day with a "has visible content" flag or the
like. |
| 155 if (!renderer()) | 150 if (!renderer()) |
| 156 return false; | 151 return false; |
| (...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 // Ids stop style sharing if they show up in the stylesheets. | 1515 // Ids stop style sharing if they show up in the stylesheets. |
| 1521 if (hasID() && affectedByIdSelector(idForStyleResolution())) | 1516 if (hasID() && affectedByIdSelector(idForStyleResolution())) |
| 1522 return false; | 1517 return false; |
| 1523 // :active and :hover elements always make a chain towards the document node | 1518 // :active and :hover elements always make a chain towards the document node |
| 1524 // and no siblings or cousins will have the same state. There's also only on
e | 1519 // and no siblings or cousins will have the same state. There's also only on
e |
| 1525 // :focus element per scope so we don't need to attempt to share. | 1520 // :focus element per scope so we don't need to attempt to share. |
| 1526 if (isUserActionElement()) | 1521 if (isUserActionElement()) |
| 1527 return false; | 1522 return false; |
| 1528 if (hasActiveAnimations()) | 1523 if (hasActiveAnimations()) |
| 1529 return false; | 1524 return false; |
| 1530 // Turn off style sharing for elements that can gain layers for reasons outs
ide of the style system. | |
| 1531 // See comments in RenderObject::setStyle(). | |
| 1532 // FIXME: Why does gaining a layer from outside the style system require dis
abling sharing? | |
| 1533 if (isHTMLCanvasElement(*this)) | |
| 1534 return false; | |
| 1535 return true; | 1525 return true; |
| 1536 } | 1526 } |
| 1537 | 1527 |
| 1538 bool Element::affectedByAttributeSelector(const AtomicString& attributeName) con
st | 1528 bool Element::affectedByAttributeSelector(const AtomicString& attributeName) con
st |
| 1539 { | 1529 { |
| 1540 if (attributeName.isEmpty()) | 1530 if (attributeName.isEmpty()) |
| 1541 return false; | 1531 return false; |
| 1542 if (treeScope().scopedStyleResolver().hasSelectorForAttribute(attributeName)
) | 1532 if (treeScope().scopedStyleResolver().hasSelectorForAttribute(attributeName)
) |
| 1543 return true; | 1533 return true; |
| 1544 // Host rules could also have effects. | 1534 // Host rules could also have effects. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1565 return false; | 1555 return false; |
| 1566 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue)) | 1556 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue)) |
| 1567 return true; | 1557 return true; |
| 1568 // Host rules could also have effects. | 1558 // Host rules could also have effects. |
| 1569 if (ShadowRoot* shadowRoot = this->shadowRoot()) | 1559 if (ShadowRoot* shadowRoot = this->shadowRoot()) |
| 1570 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue); | 1560 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue); |
| 1571 return false; | 1561 return false; |
| 1572 } | 1562 } |
| 1573 | 1563 |
| 1574 } // namespace blink | 1564 } // namespace blink |
| OLD | NEW |