Chromium Code Reviews| 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 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 } | 461 } |
| 462 | 462 |
| 463 void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) | 463 void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) |
| 464 { | 464 { |
| 465 document().updateLayoutIgnorePendingStylesheets(); | 465 document().updateLayoutIgnorePendingStylesheets(); |
| 466 | 466 |
| 467 if (!renderer()) | 467 if (!renderer()) |
| 468 return; | 468 return; |
| 469 | 469 |
| 470 LayoutRect bounds = boundingBox(); | 470 LayoutRect bounds = boundingBox(); |
| 471 | |
| 472 // Fix start : for crbug.com/295848. | |
|
arpitabahuguna
2014/09/11 14:14:59
You don't need this comment line.
| |
| 473 // The bounding box is computed by considering the y position of element | |
| 474 // which includes the parent's top border. But scrolling does not consider | |
| 475 // border, so this border top should be removed | |
|
pals
2014/09/12 13:40:08
. at the end of the comment.
| |
| 476 RenderBox* parentBox = renderer()->enclosingScrollableBox(); | |
|
arpitabahuguna
2014/09/11 14:14:59
Why do you name this parentBox??
| |
| 477 if (parentBox && parentBox->borderTop() > 0) { | |
|
pals
2014/09/12 13:40:08
{} not needed here.
| |
| 478 bounds.setY(bounds.y().toInt() - parentBox->borderTop()); | |
|
pals
2014/09/12 13:40:08
I think scrollRectTOVisible expects absolute rect.
| |
| 479 } | |
| 480 parentBox = 0; | |
|
arpitabahuguna
2014/09/11 14:14:58
Not required.
| |
| 481 // Fix end : for crbug.com/295848 | |
|
arpitabahuguna
2014/09/11 14:14:59
Again, this line is not required.
| |
| 482 | |
| 471 if (centerIfNeeded) | 483 if (centerIfNeeded) |
| 472 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNe eded, ScrollAlignment::alignCenterIfNeeded); | 484 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNe eded, ScrollAlignment::alignCenterIfNeeded); |
| 473 else | 485 else |
| 474 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNe eded, ScrollAlignment::alignToEdgeIfNeeded); | 486 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNe eded, ScrollAlignment::alignToEdgeIfNeeded); |
| 475 } | 487 } |
| 476 | 488 |
| 477 static float localZoomForRenderer(RenderObject& renderer) | 489 static float localZoomForRenderer(RenderObject& renderer) |
| 478 { | 490 { |
| 479 // FIXME: This does the wrong thing if two opposing zooms are in effect and canceled each | 491 // FIXME: This does the wrong thing if two opposing zooms are in effect and canceled each |
| 480 // other out, but the alternative is that we'd have to crawl up the whole re nder tree every | 492 // other out, but the alternative is that we'd have to crawl up the whole re nder tree every |
| (...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3267 return v8::Handle<v8::Object>(); | 3279 return v8::Handle<v8::Object>(); |
| 3268 | 3280 |
| 3269 wrapper->SetPrototype(binding->prototype()); | 3281 wrapper->SetPrototype(binding->prototype()); |
| 3270 | 3282 |
| 3271 wrapperType->refObject(toScriptWrappableBase()); | 3283 wrapperType->refObject(toScriptWrappableBase()); |
| 3272 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate); | 3284 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate); |
| 3273 return wrapper; | 3285 return wrapper; |
| 3274 } | 3286 } |
| 3275 | 3287 |
| 3276 } // namespace blink | 3288 } // namespace blink |
| OLD | NEW |