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 * (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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 } | 602 } |
| 603 | 603 |
| 604 LayoutBoxModelObject* Node::layoutBoxModelObject() const | 604 LayoutBoxModelObject* Node::layoutBoxModelObject() const |
| 605 { | 605 { |
| 606 LayoutObject* layoutObject = this->layoutObject(); | 606 LayoutObject* layoutObject = this->layoutObject(); |
| 607 return layoutObject && layoutObject->isBoxModelObject() ? toLayoutBoxModelOb ject(layoutObject) : nullptr; | 607 return layoutObject && layoutObject->isBoxModelObject() ? toLayoutBoxModelOb ject(layoutObject) : nullptr; |
| 608 } | 608 } |
| 609 | 609 |
| 610 LayoutRect Node::boundingBox() const | 610 LayoutRect Node::boundingBox() const |
| 611 { | 611 { |
| 612 if (layoutObject()) | 612 if (hasLayoutObject()) |
|
sashab
2016/07/04 07:57:13
I think you forgot to upload the code for this fun
nainar
2016/07/05 00:26:55
Took a look at this. The code for hasLayoutObject
| |
| 613 return LayoutRect(layoutObject()->absoluteBoundingBoxRect()); | 613 return LayoutRect(layoutObject()->absoluteBoundingBoxRect()); |
| 614 return LayoutRect(); | 614 return LayoutRect(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 #ifndef NDEBUG | 617 #ifndef NDEBUG |
| 618 inline static ShadowRoot* oldestShadowRootFor(const Node* node) | 618 inline static ShadowRoot* oldestShadowRootFor(const Node* node) |
| 619 { | 619 { |
| 620 if (!node->isElementNode()) | 620 if (!node->isElementNode()) |
| 621 return nullptr; | 621 return nullptr; |
| 622 if (ElementShadow* shadow = toElement(node)->shadow()) | 622 if (ElementShadow* shadow = toElement(node)->shadow()) |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 | 937 |
| 938 if (AXObjectCache* cache = document().axObjectCache()) | 938 if (AXObjectCache* cache = document().axObjectCache()) |
| 939 cache->updateCacheAfterNodeIsAttached(this); | 939 cache->updateCacheAfterNodeIsAttached(this); |
| 940 } | 940 } |
| 941 | 941 |
| 942 void Node::detach(const AttachContext& context) | 942 void Node::detach(const AttachContext& context) |
| 943 { | 943 { |
| 944 DCHECK(document().lifecycle().stateAllowsDetach()); | 944 DCHECK(document().lifecycle().stateAllowsDetach()); |
| 945 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); | 945 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); |
| 946 | 946 |
| 947 if (layoutObject()) | 947 if (hasLayoutObject()) |
| 948 layoutObject()->destroyAndCleanupAnonymousWrappers(); | 948 layoutObject()->destroyAndCleanupAnonymousWrappers(); |
| 949 setLayoutObject(nullptr); | 949 setLayoutObject(nullptr); |
| 950 setStyleChange(NeedsReattachStyleChange); | 950 setStyleChange(NeedsReattachStyleChange); |
| 951 clearChildNeedsStyleInvalidation(); | 951 clearChildNeedsStyleInvalidation(); |
| 952 } | 952 } |
| 953 | 953 |
| 954 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) | 954 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) |
| 955 { | 955 { |
| 956 ScriptForbiddenScope forbidScriptDuringRawIteration; | 956 ScriptForbiddenScope forbidScriptDuringRawIteration; |
| 957 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { | 957 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 979 return 0; | 979 return 0; |
| 980 } | 980 } |
| 981 | 981 |
| 982 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class | 982 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class |
| 983 // is obviously misplaced. | 983 // is obviously misplaced. |
| 984 bool Node::canStartSelection() const | 984 bool Node::canStartSelection() const |
| 985 { | 985 { |
| 986 if (hasEditableStyle()) | 986 if (hasEditableStyle()) |
| 987 return true; | 987 return true; |
| 988 | 988 |
| 989 if (layoutObject()) { | 989 if (hasLayoutObject()) { |
| 990 const ComputedStyle& style = layoutObject()->styleRef(); | 990 const ComputedStyle& style = layoutObject()->styleRef(); |
| 991 // We allow selections to begin within an element that has -webkit-user- select: none set, | 991 // We allow selections to begin within an element that has -webkit-user- select: none set, |
| 992 // but if the element is draggable then dragging should take priority ov er selection. | 992 // but if the element is draggable then dragging should take priority ov er selection. |
| 993 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E) | 993 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E) |
| 994 return false; | 994 return false; |
| 995 } | 995 } |
| 996 ContainerNode* parent = FlatTreeTraversal::parent(*this); | 996 ContainerNode* parent = FlatTreeTraversal::parent(*this); |
| 997 return parent ? parent->canStartSelection() : true; | 997 return parent ? parent->canStartSelection() : true; |
| 998 } | 998 } |
| 999 | 999 |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2503 | 2503 |
| 2504 void showNodePath(const blink::Node* node) | 2504 void showNodePath(const blink::Node* node) |
| 2505 { | 2505 { |
| 2506 if (node) | 2506 if (node) |
| 2507 node->showNodePathForThis(); | 2507 node->showNodePathForThis(); |
| 2508 else | 2508 else |
| 2509 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2509 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2510 } | 2510 } |
| 2511 | 2511 |
| 2512 #endif | 2512 #endif |
| OLD | NEW |