| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/layout/LayoutBoxModelObject.h" | 27 #include "core/layout/LayoutBoxModelObject.h" |
| 28 | 28 |
| 29 #include "core/dom/NodeComputedStyle.h" |
| 30 #include "core/html/HTMLBodyElement.h" |
| 29 #include "core/layout/ImageQualityController.h" | 31 #include "core/layout/ImageQualityController.h" |
| 30 #include "core/layout/LayoutBlock.h" | 32 #include "core/layout/LayoutBlock.h" |
| 31 #include "core/layout/LayoutFlowThread.h" | 33 #include "core/layout/LayoutFlowThread.h" |
| 32 #include "core/layout/LayoutGeometryMap.h" | 34 #include "core/layout/LayoutGeometryMap.h" |
| 33 #include "core/layout/LayoutInline.h" | 35 #include "core/layout/LayoutInline.h" |
| 34 #include "core/layout/LayoutObject.h" | 36 #include "core/layout/LayoutObject.h" |
| 35 #include "core/layout/LayoutTextFragment.h" | 37 #include "core/layout/LayoutTextFragment.h" |
| 36 #include "core/layout/LayoutView.h" | 38 #include "core/layout/LayoutView.h" |
| 37 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" | 39 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
| 38 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 40 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // gets the same layout after changing position property, although no | 244 // gets the same layout after changing position property, although no |
| 243 // re-raster (rect-based invalidation) is needed, display items should | 245 // re-raster (rect-based invalidation) is needed, display items should |
| 244 // still update their paint offset. | 246 // still update their paint offset. |
| 245 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && oldStyle) { | 247 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && oldStyle) { |
| 246 bool newStyleIsFixedPosition = style()->position() == FixedPosition; | 248 bool newStyleIsFixedPosition = style()->position() == FixedPosition; |
| 247 bool oldStyleIsFixedPosition = oldStyle->position() == FixedPosition; | 249 bool oldStyleIsFixedPosition = oldStyle->position() == FixedPosition; |
| 248 if (newStyleIsFixedPosition != oldStyleIsFixedPosition) | 250 if (newStyleIsFixedPosition != oldStyleIsFixedPosition) |
| 249 invalidateDisplayItemClientForNonCompositingDescendants(); | 251 invalidateDisplayItemClientForNonCompositingDescendants(); |
| 250 } | 252 } |
| 251 | 253 |
| 254 // The used style for body background may change due to computed style chang
e |
| 255 // on the document element because of background stealing. |
| 256 // Refer to backgroundStolenForBeingBody() and |
| 257 // http://www.w3.org/TR/css3-background/#body-background for more info. |
| 258 if (isDocumentElement()) { |
| 259 HTMLBodyElement* body = document().firstBodyElement(); |
| 260 LayoutObject* bodyLayout = body ? body->layoutObject() : nullptr; |
| 261 if (bodyLayout && bodyLayout->isBoxModelObject()) { |
| 262 bool newStoleBodyBackground = toLayoutBoxModelObject(bodyLayout)->ba
ckgroundStolenForBeingBody(style()); |
| 263 bool oldStoleBodyBackground = oldStyle && toLayoutBoxModelObject(bod
yLayout)->backgroundStolenForBeingBody(oldStyle); |
| 264 if (newStoleBodyBackground != oldStoleBodyBackground |
| 265 && bodyLayout->style() && bodyLayout->style()->hasBackground())
{ |
| 266 bodyLayout->setShouldDoFullPaintInvalidation(); |
| 267 } |
| 268 } |
| 269 } |
| 270 |
| 252 if (FrameView *frameView = view()->frameView()) { | 271 if (FrameView *frameView = view()->frameView()) { |
| 253 bool newStyleIsViewportConstained = style()->hasViewportConstrainedPosit
ion(); | 272 bool newStyleIsViewportConstained = style()->hasViewportConstrainedPosit
ion(); |
| 254 bool oldStyleIsViewportConstrained = oldStyle && oldStyle->hasViewportCo
nstrainedPosition(); | 273 bool oldStyleIsViewportConstrained = oldStyle && oldStyle->hasViewportCo
nstrainedPosition(); |
| 255 if (newStyleIsViewportConstained != oldStyleIsViewportConstrained) { | 274 if (newStyleIsViewportConstained != oldStyleIsViewportConstrained) { |
| 256 if (newStyleIsViewportConstained && layer()) | 275 if (newStyleIsViewportConstained && layer()) |
| 257 frameView->addViewportConstrainedObject(this); | 276 frameView->addViewportConstrainedObject(this); |
| 258 else | 277 else |
| 259 frameView->removeViewportConstrainedObject(this); | 278 frameView->removeViewportConstrainedObject(this); |
| 260 } | 279 } |
| 261 } | 280 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 | 949 |
| 931 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 950 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 932 for (LayoutObject* child = startChild; child && child != endChild; ) { | 951 for (LayoutObject* child = startChild; child && child != endChild; ) { |
| 933 // Save our next sibling as moveChildTo will clear it. | 952 // Save our next sibling as moveChildTo will clear it. |
| 934 LayoutObject* nextSibling = child->nextSibling(); | 953 LayoutObject* nextSibling = child->nextSibling(); |
| 935 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 954 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 936 child = nextSibling; | 955 child = nextSibling; |
| 937 } | 956 } |
| 938 } | 957 } |
| 939 | 958 |
| 959 bool LayoutBoxModelObject::backgroundStolenForBeingBody(const ComputedStyle* roo
tElementStyle) const |
| 960 { |
| 961 // http://www.w3.org/TR/css3-background/#body-background |
| 962 // If the root element is <html> with no background, and a <body> child elem
ent exists, |
| 963 // the root element steals the first <body> child element's background. |
| 964 if (!isBody()) |
| 965 return false; |
| 966 |
| 967 Element* rootElement = document().documentElement(); |
| 968 if (!isHTMLHtmlElement(rootElement)) |
| 969 return false; |
| 970 |
| 971 if (!rootElementStyle) |
| 972 rootElementStyle = rootElement->ensureComputedStyle(); |
| 973 if (rootElementStyle->hasBackground()) |
| 974 return false; |
| 975 |
| 976 if (node() != document().firstBodyElement()) |
| 977 return false; |
| 978 |
| 979 return true; |
| 980 } |
| 981 |
| 940 } // namespace blink | 982 } // namespace blink |
| OLD | NEW |