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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 if (!node_layout_data->IsSharedEmptyData()) { | 598 if (!node_layout_data->IsSharedEmptyData()) { |
599 node_layout_data->SetLayoutObject(layout_object); | 599 node_layout_data->SetLayoutObject(layout_object); |
600 return; | 600 return; |
601 } | 601 } |
602 | 602 |
603 if (!layout_object) | 603 if (!layout_object) |
604 return; | 604 return; |
605 | 605 |
606 // Swap the NodeLayoutData to point to a new NodeLayoutData instead of the | 606 // Swap the NodeLayoutData to point to a new NodeLayoutData instead of the |
607 // static SharedEmptyData instance. | 607 // static SharedEmptyData instance. |
608 node_layout_data = new NodeLayoutData(layout_object); | 608 DCHECK(!node_layout_data->GetNonAttachedStyle()); |
609 node_layout_data = new NodeLayoutData(layout_object, nullptr); | |
609 if (HasRareData()) | 610 if (HasRareData()) |
nainar
2017/04/19 01:38:34
This can read as below instead:
DCHECK(!node_la
| |
610 data_.rare_data_->SetNodeLayoutData(node_layout_data); | 611 data_.rare_data_->SetNodeLayoutData(node_layout_data); |
611 else | 612 else |
613 data_.node_layout_data_ = node_layout_data; | |
614 } | |
615 | |
616 void Node::SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style) { | |
617 NodeLayoutData* node_layout_data = HasRareData() | |
nainar
2017/04/19 01:38:34
I can pull out this into a getter
| |
618 ? data_.rare_data_->GetNodeLayoutData() | |
619 : data_.node_layout_data_; | |
620 | |
621 // Already pointing to a non empty NodeLayoutData so just set the pointer to | |
622 // the new LayoutObject. | |
623 if (!node_layout_data->IsSharedEmptyData()) { | |
624 node_layout_data->SetNonAttachedStyle(non_attached_style); | |
625 return; | |
626 } | |
627 | |
628 if (!non_attached_style) | |
629 return; | |
630 | |
631 // Swap the NodeLayoutData to point to a new NodeLayoutData instead of the | |
632 // static SharedEmptyData instance. | |
633 DCHECK(!node_layout_data->GetLayoutObject()); | |
634 node_layout_data = new NodeLayoutData(nullptr, non_attached_style); | |
635 if (HasRareData()) | |
636 data_.rare_data_->SetNodeLayoutData(node_layout_data); | |
637 else | |
612 data_.node_layout_data_ = node_layout_data; | 638 data_.node_layout_data_ = node_layout_data; |
613 } | 639 } |
614 | 640 |
615 LayoutBoxModelObject* Node::GetLayoutBoxModelObject() const { | 641 LayoutBoxModelObject* Node::GetLayoutBoxModelObject() const { |
616 LayoutObject* layout_object = this->GetLayoutObject(); | 642 LayoutObject* layout_object = this->GetLayoutObject(); |
617 return layout_object && layout_object->IsBoxModelObject() | 643 return layout_object && layout_object->IsBoxModelObject() |
618 ? ToLayoutBoxModelObject(layout_object) | 644 ? ToLayoutBoxModelObject(layout_object) |
619 : nullptr; | 645 : nullptr; |
620 } | 646 } |
621 | 647 |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2563 if (node) { | 2589 if (node) { |
2564 std::stringstream stream; | 2590 std::stringstream stream; |
2565 node->PrintNodePathTo(stream); | 2591 node->PrintNodePathTo(stream); |
2566 LOG(INFO) << stream.str(); | 2592 LOG(INFO) << stream.str(); |
2567 } else { | 2593 } else { |
2568 LOG(INFO) << "Cannot showNodePath for <null>"; | 2594 LOG(INFO) << "Cannot showNodePath for <null>"; |
2569 } | 2595 } |
2570 } | 2596 } |
2571 | 2597 |
2572 #endif | 2598 #endif |
OLD | NEW |