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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2126973004: [Layout API] Use layoutViewItem() in Document (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/api/LayoutBlockItem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 404aa19578c1ea05a6455f1637beee564da6d90c..c45b8dbb2ef7387015d8345c725409045ebbe1cd 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1117,7 +1117,7 @@ AtomicString Document::contentType() const
Element* Document::elementFromPoint(int x, int y) const
{
- if (!layoutView())
+ if (layoutViewItem().isNull())
return 0;
return TreeScope::elementFromPoint(x, y);
@@ -1125,14 +1125,14 @@ Element* Document::elementFromPoint(int x, int y) const
HeapVector<Member<Element>> Document::elementsFromPoint(int x, int y) const
{
- if (!layoutView())
+ if (layoutViewItem().isNull())
return HeapVector<Member<Element>>();
return TreeScope::elementsFromPoint(x, y);
}
Range* Document::caretRangeFromPoint(int x, int y)
{
- if (!layoutView())
+ if (layoutViewItem().isNull())
return nullptr;
HitTestResult result = hitTestInDocument(this, x, y);
@@ -1428,7 +1428,7 @@ bool Document::needsLayoutTreeUpdate() const
return true;
if (childNeedsStyleInvalidation())
return true;
- if (layoutView()->wasNotifiedOfSubtreeChange())
+ if (layoutViewItem().wasNotifiedOfSubtreeChange())
return true;
return false;
}
@@ -1605,7 +1605,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
ScrollSnapType snapType = overflowStyle->getScrollSnapType();
const LengthPoint& snapDestination = overflowStyle->scrollSnapDestination();
- RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle();
+ RefPtr<ComputedStyle> documentStyle = layoutViewItem().mutableStyle();
if (documentStyle->getWritingMode() != rootWritingMode
|| documentStyle->direction() != rootDirection
|| documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor
@@ -1627,7 +1627,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
newStyle->setColumnGap(columnGap);
newStyle->setScrollSnapType(snapType);
newStyle->setScrollSnapDestination(snapDestination);
- layoutView()->setStyle(newStyle);
+ layoutViewItem().setStyle(newStyle);
setupFontBuilder(*newStyle);
}
@@ -1735,7 +1735,7 @@ void Document::updateStyleAndLayoutTree()
if (m_focusedElement && !m_focusedElement->isFocusable())
clearFocusedElementSoon();
- layoutView()->clearHitTestCache();
+ layoutViewItem().clearHitTestCache();
DCHECK(!DocumentAnimations::needsAnimationTimingUpdate(*this));
@@ -1771,9 +1771,9 @@ void Document::updateStyle()
if (change == Force) {
m_hasNodesWithPlaceholderStyle = false;
RefPtr<ComputedStyle> documentStyle = StyleResolver::styleForDocument(*this);
- StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(documentStyle.get(), layoutView()->style());
+ StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(documentStyle.get(), layoutViewItem().style());
if (localChange != NoChange)
- layoutView()->setStyle(documentStyle.release());
+ layoutViewItem().setStyle(documentStyle.release());
}
clearNeedsStyleRecalc();
@@ -1818,13 +1818,13 @@ void Document::updateStyle()
void Document::notifyLayoutTreeOfSubtreeChanges()
{
- if (!layoutView()->wasNotifiedOfSubtreeChange())
+ if (!layoutViewItem().wasNotifiedOfSubtreeChange())
return;
m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange);
- layoutView()->handleSubtreeModifications();
- DCHECK(!layoutView()->wasNotifiedOfSubtreeChange());
+ layoutViewItem().handleSubtreeModifications();
+ DCHECK(!layoutViewItem().wasNotifiedOfSubtreeChange());
m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean);
}
@@ -2641,13 +2641,13 @@ void Document::implicitClose()
updateStyleAndLayoutTree();
// Always do a layout after loading if needed.
- if (view() && layoutView() && (!layoutView()->firstChild() || layoutView()->needsLayout()))
+ if (view() && !layoutViewItem().isNull() && (!layoutViewItem().firstChild() || layoutViewItem().needsLayout()))
view()->layout();
}
m_loadEventProgress = LoadEventCompleted;
- if (frame() && layoutView() && settings()->accessibilityEnabled()) {
+ if (frame() && !layoutViewItem().isNull() && settings()->accessibilityEnabled()) {
if (AXObjectCache* cache = axObjectCache()) {
if (this == &axObjectCacheOwner())
cache->handleLoadComplete(this);
@@ -3157,11 +3157,11 @@ MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r
// mousemove events before the first layout should not lead to a premature layout()
// happening, which could show a flash of white.
// See also the similar code in EventHandler::hitTestResultAtPoint.
- if (!layoutView() || !view() || !view()->didFirstLayout())
+ if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout())
return MouseEventWithHitTestResults(event, HitTestResult(request, LayoutPoint()));
HitTestResult result(request, documentPoint);
- layoutView()->hitTest(result);
+ layoutViewItem().hitTest(result);
if (!request.readOnly())
updateHoverActiveState(request, result.innerElement());
@@ -3418,9 +3418,9 @@ void Document::styleResolverMayHaveChanged()
// recalc while sheets are still loading to avoid FOUC.
m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
- DCHECK(layoutView() || importsController());
- if (layoutView())
- layoutView()->invalidatePaintForViewAndCompositedLayers();
+ DCHECK(!layoutViewItem().isNull() || importsController());
+ if (!layoutViewItem().isNull())
+ layoutViewItem().invalidatePaintForViewAndCompositedLayers();
}
}
@@ -4403,8 +4403,8 @@ void Document::setEncodingData(const DocumentEncodingData& newData)
if (shouldUseVisualOrdering != m_visuallyOrdered) {
m_visuallyOrdered = shouldUseVisualOrdering;
// FIXME: How is possible to not have a layoutObject here?
- if (layoutView())
- layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
+ if (!layoutViewItem().isNull())
+ layoutViewItem().mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::VisuallyOrdered));
}
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/api/LayoutBlockItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698