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

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

Issue 2141693002: Fix order of operations in LayoutView::mapAncestorToLocal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp » ('j') | 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 368 }
369 369
370 return container; 370 return container;
371 } 371 }
372 372
373 void LayoutView::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transf ormState& transformState, MapCoordinatesFlags mode) const 373 void LayoutView::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transf ormState& transformState, MapCoordinatesFlags mode) const
374 { 374 {
375 if (this == ancestor) 375 if (this == ancestor)
376 return; 376 return;
377 377
378 if (mode & IsFixed && m_frameView)
379 transformState.move(m_frameView->scrollOffset());
380
381 if (mode & UseTransforms && shouldUseTransformFromContainer(0)) {
382 TransformationMatrix t;
383 getTransformFromContainer(0, LayoutSize(), t);
384 transformState.applyTransform(t);
385 }
386
387 if (mode & TraverseDocumentBoundaries) { 378 if (mode & TraverseDocumentBoundaries) {
388 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { 379 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) {
389 // A LayoutView is a containing block for fixed-position elements, s o don't carry this state across frames. 380 // A LayoutView is a containing block for fixed-position elements, s o don't carry this state across frames.
390 mode &= ~IsFixed; 381 parentDocLayoutObject->mapAncestorToLocal(ancestor, transformState, mode & ~IsFixed);
391 382
383 transformState.move(parentDocLayoutObject->contentBoxOffset());
392 transformState.move(-frame()->view()->scrollOffset()); 384 transformState.move(-frame()->view()->scrollOffset());
393 transformState.move(parentDocLayoutObject->contentBoxOffset());
394
395 parentDocLayoutObject->mapAncestorToLocal(ancestor, transformState, mode);
396 } 385 }
397 } else { 386 } else {
398 ASSERT(!ancestor); 387 ASSERT(!ancestor);
399 } 388 }
389
390 if (mode & IsFixed)
391 transformState.move(frame()->view()->scrollOffset());
400 } 392 }
401 393
402 void LayoutView::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout Point&) const 394 void LayoutView::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout Point&) const
403 { 395 {
404 // Record the entire size of the contents of the frame. Note that we don't j ust 396 // Record the entire size of the contents of the frame. Note that we don't j ust
405 // use the viewport size (containing block) here because we want to ensure t his includes 397 // use the viewport size (containing block) here because we want to ensure t his includes
406 // all children (so we can avoid walking them explicitly). 398 // all children (so we can avoid walking them explicitly).
407 rects.append(LayoutRect(LayoutPoint::zero(), LayoutSize(frameView()->content sSize()))); 399 rects.append(LayoutRect(LayoutPoint::zero(), LayoutSize(frameView()->content sSize())));
408 } 400 }
409 401
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 // of this override. All frame scrolling should be handled by 992 // of this override. All frame scrolling should be handled by
1001 // ViewportScrollCallback. 993 // ViewportScrollCallback.
1002 994
1003 if (!frameView()) 995 if (!frameView())
1004 return ScrollResult(false, false, delta.width(), delta.height()); 996 return ScrollResult(false, false, delta.width(), delta.height());
1005 997
1006 return frameView()->getScrollableArea()->userScroll(granularity, delta); 998 return frameView()->getScrollableArea()->userScroll(granularity, delta);
1007 } 999 }
1008 1000
1009 } // namespace blink 1001 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698