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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1495053002: Rename PaintLayer::enclosingElement -> PaintLayer::enclosingNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: on second thought, go back to the original approach :) Created 5 years 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 | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 // Now determine if the result is inside an anchor - if the urlElement isn't already set. 1539 // Now determine if the result is inside an anchor - if the urlElement isn't already set.
1540 Node* node = result.innerNode(); 1540 Node* node = result.innerNode();
1541 if (node && !result.URLElement()) 1541 if (node && !result.URLElement())
1542 result.setURLElement(node->enclosingLinkEventParentOrSelf()); 1542 result.setURLElement(node->enclosingLinkEventParentOrSelf());
1543 1543
1544 // Now return whether we were inside this layer (this will always be true fo r the root 1544 // Now return whether we were inside this layer (this will always be true fo r the root
1545 // layer). 1545 // layer).
1546 return insideLayer; 1546 return insideLayer;
1547 } 1547 }
1548 1548
1549 Node* PaintLayer::enclosingElement() const 1549 Node* PaintLayer::enclosingNode() const
1550 { 1550 {
1551 for (LayoutObject* r = layoutObject(); r; r = r->parent()) { 1551 for (LayoutObject* r = layoutObject(); r; r = r->parent()) {
1552 if (Node* e = r->node()) 1552 if (Node* e = r->node())
1553 return e; 1553 return e;
1554 } 1554 }
1555 ASSERT_NOT_REACHED(); 1555 ASSERT_NOT_REACHED();
1556 return 0; 1556 return 0;
1557 } 1557 }
1558 1558
1559 bool PaintLayer::isInTopLayer() const 1559 bool PaintLayer::isInTopLayer() const
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 // We hit something anonymous, and we didn't find a DOM node ancestor in this layer. 1905 // We hit something anonymous, and we didn't find a DOM node ancestor in this layer.
1906 1906
1907 if (layoutObject()->isLayoutFlowThread()) { 1907 if (layoutObject()->isLayoutFlowThread()) {
1908 // For a flow thread it's safe to just say that we didn't hit anythi ng. That means that 1908 // For a flow thread it's safe to just say that we didn't hit anythi ng. That means that
1909 // we'll continue as normally, and eventually hit a column set sibli ng instead. Column 1909 // we'll continue as normally, and eventually hit a column set sibli ng instead. Column
1910 // sets are also anonymous, but, unlike flow threads, they don't est ablish layers, so 1910 // sets are also anonymous, but, unlike flow threads, they don't est ablish layers, so
1911 // we'll fall back and hit the multicol container parent (which shou ld have a DOM node). 1911 // we'll fall back and hit the multicol container parent (which shou ld have a DOM node).
1912 return false; 1912 return false;
1913 } 1913 }
1914 1914
1915 Node* e = enclosingElement(); 1915 Node* e = enclosingNode();
1916 // FIXME: should be a call to result.setNodeAndPosition. What we would r eally want to do here is to 1916 // FIXME: should be a call to result.setNodeAndPosition. What we would r eally want to do here is to
1917 // return and look for the nearest non-anonymous ancestor, and ignore au nts and uncles on 1917 // return and look for the nearest non-anonymous ancestor, and ignore au nts and uncles on
1918 // our way. It's bad to look for it manually like we do here, and give u p on setting a local 1918 // our way. It's bad to look for it manually like we do here, and give u p on setting a local
1919 // point in the result, because that has bad implications for text selec tion and 1919 // point in the result, because that has bad implications for text selec tion and
1920 // caretRangeFromPoint(). See crbug.com/461791 1920 // caretRangeFromPoint(). See crbug.com/461791
1921 if (!result.innerNode()) 1921 if (!result.innerNode())
1922 result.setInnerNode(e); 1922 result.setInnerNode(e);
1923 1923
1924 } 1924 }
1925 return true; 1925 return true;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 bool PaintLayer::scrollsOverflow() const 2548 bool PaintLayer::scrollsOverflow() const
2549 { 2549 {
2550 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) 2550 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea())
2551 return scrollableArea->scrollsOverflow(); 2551 return scrollableArea->scrollsOverflow();
2552 2552
2553 return false; 2553 return false;
2554 } 2554 }
2555 2555
2556 namespace { 2556 namespace {
2557 2557
2558 FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOpera tions& filters, float effectiveZoom, Node* enclosingElement) 2558 FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOpera tions& filters, float effectiveZoom, Node* enclosingNode)
2559 { 2559 {
2560 if (filters.hasReferenceFilter()) { 2560 if (filters.hasReferenceFilter()) {
2561 for (size_t i = 0; i < filters.size(); ++i) { 2561 for (size_t i = 0; i < filters.size(); ++i) {
2562 FilterOperation* filterOperation = filters.operations().at(i).get(); 2562 FilterOperation* filterOperation = filters.operations().at(i).get();
2563 if (filterOperation->type() != FilterOperation::REFERENCE) 2563 if (filterOperation->type() != FilterOperation::REFERENCE)
2564 continue; 2564 continue;
2565 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation); 2565 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation);
2566 // FIXME: Cache the Filter if it didn't change. 2566 // FIXME: Cache the Filter if it didn't change.
2567 RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder: :build(effectiveZoom, toElement(enclosingElement), nullptr, referenceOperation); 2567 RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder: :build(effectiveZoom, toElement(enclosingNode), nullptr, referenceOperation);
2568 referenceOperation.setFilter(referenceFilter.release()); 2568 referenceOperation.setFilter(referenceFilter.release());
2569 } 2569 }
2570 } 2570 }
2571 2571
2572 return filters; 2572 return filters;
2573 } 2573 }
2574 2574
2575 } // unnamed namespace 2575 } // unnamed namespace
2576 2576
2577 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style) const 2577 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style) const
2578 { 2578 {
2579 return computeFilterOperationsHandleReferenceFilters(style.filter(), style.e ffectiveZoom(), enclosingElement()); 2579 return computeFilterOperationsHandleReferenceFilters(style.filter(), style.e ffectiveZoom(), enclosingNode());
2580 } 2580 }
2581 2581
2582 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle & style) const 2582 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle & style) const
2583 { 2583 {
2584 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingElement()); 2584 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingNode());
2585 } 2585 }
2586 2586
2587 void PaintLayer::updateOrRemoveFilterClients() 2587 void PaintLayer::updateOrRemoveFilterClients()
2588 { 2588 {
2589 if (!hasFilter()) { 2589 if (!hasFilter()) {
2590 removeFilterInfoIfNeeded(); 2590 removeFilterInfoIfNeeded();
2591 return; 2591 return;
2592 } 2592 }
2593 2593
2594 if (layoutObject()->style()->filter().hasReferenceFilter()) 2594 if (layoutObject()->style()->filter().hasReferenceFilter())
(...skipping 13 matching lines...) Expand all
2608 2608
2609 // Should have been added by updateOrRemoveFilterEffectBuilder(). 2609 // Should have been added by updateOrRemoveFilterEffectBuilder().
2610 ASSERT(filterInfo); 2610 ASSERT(filterInfo);
2611 2611
2612 if (filterInfo->builder()) 2612 if (filterInfo->builder())
2613 return filterInfo->builder(); 2613 return filterInfo->builder();
2614 2614
2615 filterInfo->setBuilder(FilterEffectBuilder::create()); 2615 filterInfo->setBuilder(FilterEffectBuilder::create());
2616 2616
2617 float zoom = layoutObject()->style() ? layoutObject()->style()->effectiveZoo m() : 1.0f; 2617 float zoom = layoutObject()->style() ? layoutObject()->style()->effectiveZoo m() : 1.0f;
2618 if (!filterInfo->builder()->build(toElement(enclosingElement()), computeFilt erOperations(layoutObject()->styleRef()), zoom)) 2618 if (!filterInfo->builder()->build(toElement(enclosingNode()), computeFilterO perations(layoutObject()->styleRef()), zoom))
2619 filterInfo->setBuilder(nullptr); 2619 filterInfo->setBuilder(nullptr);
2620 2620
2621 return filterInfo->builder(); 2621 return filterInfo->builder();
2622 } 2622 }
2623 2623
2624 FilterEffect* PaintLayer::lastFilterEffect() const 2624 FilterEffect* PaintLayer::lastFilterEffect() const
2625 { 2625 {
2626 FilterEffectBuilder* builder = updateFilterEffectBuilder(); 2626 FilterEffectBuilder* builder = updateFilterEffectBuilder();
2627 if (!builder) 2627 if (!builder)
2628 return nullptr; 2628 return nullptr;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 2780
2781 void showLayerTree(const blink::LayoutObject* layoutObject) 2781 void showLayerTree(const blink::LayoutObject* layoutObject)
2782 { 2782 {
2783 if (!layoutObject) { 2783 if (!layoutObject) {
2784 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2784 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2785 return; 2785 return;
2786 } 2786 }
2787 showLayerTree(layoutObject->enclosingLayer()); 2787 showLayerTree(layoutObject->enclosingLayer());
2788 } 2788 }
2789 #endif 2789 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698