| 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) 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 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 bool LayoutObject::isRooted() const | 2304 bool LayoutObject::isRooted() const |
| 2305 { | 2305 { |
| 2306 const LayoutObject* object = this; | 2306 const LayoutObject* object = this; |
| 2307 while (object->parent() && !object->hasLayer()) | 2307 while (object->parent() && !object->hasLayer()) |
| 2308 object = object->parent(); | 2308 object = object->parent(); |
| 2309 if (object->hasLayer()) | 2309 if (object->hasLayer()) |
| 2310 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer(); | 2310 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer(); |
| 2311 return false; | 2311 return false; |
| 2312 } | 2312 } |
| 2313 | 2313 |
| 2314 LayoutObject* LayoutObject::layoutObjectForRootBackground() | |
| 2315 { | |
| 2316 ASSERT(isDocumentElement()); | |
| 2317 if (!hasBackground() && isHTMLHtmlElement(node())) { | |
| 2318 // Locate the <body> element using the DOM. This is easier than trying | |
| 2319 // to crawl around a layout tree with potential :before/:after content a
nd | |
| 2320 // anonymous blocks created by inline <body> tags etc. We can locate the
<body> | |
| 2321 // layout object very easily via the DOM. | |
| 2322 HTMLElement* body = document().body(); | |
| 2323 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; | |
| 2324 if (bodyObject) | |
| 2325 return bodyObject; | |
| 2326 } | |
| 2327 | |
| 2328 return this; | |
| 2329 } | |
| 2330 | |
| 2331 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const | 2314 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const |
| 2332 { | 2315 { |
| 2333 // Respect the image's orientation if it's being used as a full-page image o
r it's | 2316 // Respect the image's orientation if it's being used as a full-page image o
r it's |
| 2334 // an <img> and the setting to respect it everywhere is set. | 2317 // an <img> and the setting to respect it everywhere is set. |
| 2335 return document().isImageDocument() | 2318 return document().isImageDocument() |
| 2336 || (document().settings() && document().settings()->shouldRespectImageOr
ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp
ectImageOrientation; | 2319 || (document().settings() && document().settings()->shouldRespectImageOr
ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp
ectImageOrientation; |
| 2337 } | 2320 } |
| 2338 | 2321 |
| 2339 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat
ionContainer, bool* paintInvalidationContainerSkipped) const | 2322 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat
ionContainer, bool* paintInvalidationContainerSkipped) const |
| 2340 { | 2323 { |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3176 { | 3159 { |
| 3177 // Only full invalidation reasons are allowed. | 3160 // Only full invalidation reasons are allowed. |
| 3178 ASSERT(isFullPaintInvalidationReason(reason)); | 3161 ASSERT(isFullPaintInvalidationReason(reason)); |
| 3179 | 3162 |
| 3180 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason(
) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; | 3163 bool isUpgradingDelayedFullToFull = m_bitfields.fullPaintInvalidationReason(
) == PaintInvalidationDelayedFull && reason != PaintInvalidationDelayedFull; |
| 3181 | 3164 |
| 3182 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is
UpgradingDelayedFullToFull) { | 3165 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone || is
UpgradingDelayedFullToFull) { |
| 3183 if (reason == PaintInvalidationFull) | 3166 if (reason == PaintInvalidationFull) |
| 3184 reason = documentLifecycleBasedPaintInvalidationReason(document().li
fecycle()); | 3167 reason = documentLifecycleBasedPaintInvalidationReason(document().li
fecycle()); |
| 3185 m_bitfields.setFullPaintInvalidationReason(reason); | 3168 m_bitfields.setFullPaintInvalidationReason(reason); |
| 3186 | |
| 3187 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && isBody()) { | |
| 3188 // The rootObject paints view's background. We need to invalidate it
when | |
| 3189 // view's background changes because of change of body's style. | |
| 3190 // FIXME: The condition is broader than needed for simplicity. | |
| 3191 // Might remove this when fixing crbug.com/475115. | |
| 3192 if (LayoutObject* rootObject = document().documentElement()->layoutO
bject()) | |
| 3193 rootObject->setShouldDoFullPaintInvalidation(); | |
| 3194 } | |
| 3195 } | 3169 } |
| 3196 | 3170 |
| 3197 if (!isUpgradingDelayedFullToFull) { | 3171 if (!isUpgradingDelayedFullToFull) { |
| 3198 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval
idation); | 3172 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval
idation); |
| 3199 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called outside of FrameView::updateLayoutAndStyleForPainting(). | 3173 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called outside of FrameView::updateLayoutAndStyleForPainting(). |
| 3200 markContainerChainForPaintInvalidation(); | 3174 markContainerChainForPaintInvalidation(); |
| 3201 } | 3175 } |
| 3202 } | 3176 } |
| 3203 | 3177 |
| 3204 void LayoutObject::setMayNeedPaintInvalidation() | 3178 void LayoutObject::setMayNeedPaintInvalidation() |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3305 const blink::LayoutObject* root = object1; | 3279 const blink::LayoutObject* root = object1; |
| 3306 while (root->parent()) | 3280 while (root->parent()) |
| 3307 root = root->parent(); | 3281 root = root->parent(); |
| 3308 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3282 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3309 } else { | 3283 } else { |
| 3310 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3284 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3311 } | 3285 } |
| 3312 } | 3286 } |
| 3313 | 3287 |
| 3314 #endif | 3288 #endif |
| OLD | NEW |