| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 Node::NodeType Element::nodeType() const | 266 Node::NodeType Element::nodeType() const |
| 267 { | 267 { |
| 268 return ELEMENT_NODE; | 268 return ELEMENT_NODE; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void Element::synchronizeAllAttributes() const | 271 void Element::synchronizeAllAttributes() const |
| 272 { | 272 { |
| 273 synchronizeAttribute(HTMLNames::styleAttr.localName()); | 273 synchronizeAttribute(HTMLNames::styleAttr.localName()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void Element::scrollIntoView(bool alignToTop) | |
| 277 { | |
| 278 document().updateLayoutIgnorePendingStylesheets(); | |
| 279 | |
| 280 if (!renderer()) | |
| 281 return; | |
| 282 | |
| 283 LayoutRect bounds = boundingBox(); | |
| 284 // Align to the top / bottom and to the closest edge. | |
| 285 if (alignToTop) | |
| 286 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNe
eded, ScrollAlignment::alignTopAlways); | |
| 287 else | |
| 288 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNe
eded, ScrollAlignment::alignBottomAlways); | |
| 289 } | |
| 290 | |
| 291 void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) | |
| 292 { | |
| 293 document().updateLayoutIgnorePendingStylesheets(); | |
| 294 | |
| 295 if (!renderer()) | |
| 296 return; | |
| 297 | |
| 298 LayoutRect bounds = boundingBox(); | |
| 299 if (centerIfNeeded) | |
| 300 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNe
eded, ScrollAlignment::alignCenterIfNeeded); | |
| 301 else | |
| 302 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNe
eded, ScrollAlignment::alignToEdgeIfNeeded); | |
| 303 } | |
| 304 | |
| 305 int Element::offsetLeft() | 276 int Element::offsetLeft() |
| 306 { | 277 { |
| 307 document().updateLayoutIgnorePendingStylesheets(); | 278 document().updateLayoutIgnorePendingStylesheets(); |
| 308 if (RenderBoxModelObject* renderer = renderBoxModelObject()) | 279 if (RenderBoxModelObject* renderer = renderBoxModelObject()) |
| 309 return renderer->offsetLeft(); | 280 return renderer->offsetLeft(); |
| 310 return 0; | 281 return 0; |
| 311 } | 282 } |
| 312 | 283 |
| 313 int Element::offsetTop() | 284 int Element::offsetTop() |
| 314 { | 285 { |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 return false; | 1751 return false; |
| 1781 // Turn off style sharing for elements that can gain layers for reasons outs
ide of the style system. | 1752 // Turn off style sharing for elements that can gain layers for reasons outs
ide of the style system. |
| 1782 // See comments in RenderObject::setStyle(). | 1753 // See comments in RenderObject::setStyle(). |
| 1783 // FIXME: Why does gaining a layer from outside the style system require dis
abling sharing? | 1754 // FIXME: Why does gaining a layer from outside the style system require dis
abling sharing? |
| 1784 if (isHTMLCanvasElement(*this)) | 1755 if (isHTMLCanvasElement(*this)) |
| 1785 return false; | 1756 return false; |
| 1786 return true; | 1757 return true; |
| 1787 } | 1758 } |
| 1788 | 1759 |
| 1789 } // namespace blink | 1760 } // namespace blink |
| OLD | NEW |