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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1424313003: element.scrollIntoView only scrolls the layout viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 5 years, 1 month 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/layout/LayoutObject.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) 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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 { 632 {
633 for (const LayoutObject* current = this; current; current = current->parent( )) { 633 for (const LayoutObject* current = this; current; current = current->parent( )) {
634 if (current->hasLayer()) 634 if (current->hasLayer())
635 return toLayoutBoxModelObject(current)->layer(); 635 return toLayoutBoxModelObject(current)->layer();
636 } 636 }
637 // FIXME: we should get rid of detached layout subtrees, at which point this code should 637 // FIXME: we should get rid of detached layout subtrees, at which point this code should
638 // not be reached. crbug.com/411429 638 // not be reached. crbug.com/411429
639 return nullptr; 639 return nullptr;
640 } 640 }
641 641
642 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) 642 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY, ScrollType scrollType, bool makeVis ibleInVisualViewport)
643 { 643 {
644 LayoutBox* enclosingBox = this->enclosingBox(); 644 LayoutBox* enclosingBox = this->enclosingBox();
645 if (!enclosingBox) 645 if (!enclosingBox)
646 return false; 646 return false;
647 647
648 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType); 648 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, makeVisi bleInVisualViewport);
649 return true; 649 return true;
650 } 650 }
651 651
652 LayoutBox* LayoutObject::enclosingBox() const 652 LayoutBox* LayoutObject::enclosingBox() const
653 { 653 {
654 LayoutObject* curr = const_cast<LayoutObject*>(this); 654 LayoutObject* curr = const_cast<LayoutObject*>(this);
655 while (curr) { 655 while (curr) {
656 if (curr->isBox()) 656 if (curr->isBox())
657 return toLayoutBox(curr); 657 return toLayoutBox(curr);
658 curr = curr->parent(); 658 curr = curr->parent();
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527. 1226 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527.
1227 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"), 1227 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"),
1228 "PaintInvalidationTracking", 1228 "PaintInvalidationTracking",
1229 TRACE_EVENT_SCOPE_THREAD, 1229 TRACE_EVENT_SCOPE_THREAD,
1230 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer)); 1230 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer));
1231 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", 1231 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()",
1232 "object", this->debugName().ascii(), 1232 "object", this->debugName().ascii(),
1233 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason))); 1233 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason)));
1234 1234
1235 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are 1235 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are
1236 // painted, such as SVG images. 1236 // painted, such as SVG images.
1237 if (!paintInvalidationContainer.isPaintInvalidationContainer()) 1237 if (!paintInvalidationContainer.isPaintInvalidationContainer())
1238 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); 1238 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect));
1239 1239
1240 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) 1240 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer())
1241 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason); 1241 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason);
1242 } 1242 }
1243 1243
1244 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const 1244 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const
1245 { 1245 {
1246 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be en passed to PaintController. crbug.com/547119. 1246 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be en passed to PaintController. crbug.com/547119.
1247 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. 1247 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree.
1248 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { 1248 if (PaintLayer* enclosingLayer = this->enclosingLayer()) {
1249 // This is valid because we want to invalidate the client in the display item list of the current backing. 1249 // This is valid because we want to invalidate the client in the display item list of the current backing.
1250 DisableCompositingQueryAsserts disabler; 1250 DisableCompositingQueryAsserts disabler;
1251 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) 1251 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries())
1252 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, nullptr); 1252 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, nullptr);
1253 enclosingLayer->setNeedsRepaint(); 1253 enclosingLayer->setNeedsRepaint();
1254 } 1254 }
1255 } 1255 }
1256 1256
1257 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect* paintInvalidationRect) const 1257 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect* paintInvalidationRect) const
1258 { 1258 {
1259 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, paintInvalidationRect); 1259 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, paintInvalidationRect);
1260 1260
1261 if (PaintLayer* enclosingLayer = this->enclosingLayer()) 1261 if (PaintLayer* enclosingLayer = this->enclosingLayer())
1262 enclosingLayer->setNeedsRepaint(); 1262 enclosingLayer->setNeedsRepaint();
1263 } 1263 }
1264 1264
1265 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const 1265 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const
1266 { 1266 {
1267 if (!paintInvalidationContainer) 1267 if (!paintInvalidationContainer)
1268 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); 1268 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState);
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 const blink::LayoutObject* root = object1; 3512 const blink::LayoutObject* root = object1;
3513 while (root->parent()) 3513 while (root->parent())
3514 root = root->parent(); 3514 root = root->parent();
3515 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3515 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3516 } else { 3516 } else {
3517 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3517 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3518 } 3518 }
3519 } 3519 }
3520 3520
3521 #endif 3521 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698