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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1162793003: Add CSS image-orientation: from-image (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add runtime flag Created 5 years, 5 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
OLDNEW
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 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 const LayoutObject* object = this; 2314 const LayoutObject* object = this;
2315 while (object->parent() && !object->hasLayer()) 2315 while (object->parent() && !object->hasLayer())
2316 object = object->parent(); 2316 object = object->parent();
2317 if (object->hasLayer()) 2317 if (object->hasLayer())
2318 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer(); 2318 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer();
2319 return false; 2319 return false;
2320 } 2320 }
2321 2321
2322 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const 2322 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const
2323 { 2323 {
2324 // Respect the image's orientation if it's being used as a full-page image o r it's 2324 // Respect the image's orientation if it's being used as a full-page image o r
2325 // an <img> and the setting to respect it everywhere is set. 2325 // it's an <img> and the setting to respect it everywhere is set or the <img >
2326 return document().isImageDocument() 2326 // has image-orientation: from-image style. FIXME: crbug.com/498233
2327 || (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation; 2327 if (document().isImageDocument())
2328 return RespectImageOrientation;
2329
2330 if (!isHTMLImageElement(node()))
2331 return DoNotRespectImageOrientation;
2332
2333 if (document().settings() && document().settings()->shouldRespectImageOrient ation())
2334 return RespectImageOrientation;
2335
2336 if (style() && style()->respectImageOrientation() == RespectImageOrientation )
2337 return RespectImageOrientation;
2338
2339 return DoNotRespectImageOrientation;
2328 } 2340 }
2329 2341
2330 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat ionContainer, bool* paintInvalidationContainerSkipped) const 2342 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat ionContainer, bool* paintInvalidationContainerSkipped) const
2331 { 2343 {
2332 if (paintInvalidationContainerSkipped) 2344 if (paintInvalidationContainerSkipped)
2333 *paintInvalidationContainerSkipped = false; 2345 *paintInvalidationContainerSkipped = false;
2334 2346
2335 // This method is extremely similar to containingBlock(), but with a few not able 2347 // This method is extremely similar to containingBlock(), but with a few not able
2336 // exceptions. 2348 // exceptions.
2337 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when 2349 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
3301 const blink::LayoutObject* root = object1; 3313 const blink::LayoutObject* root = object1;
3302 while (root->parent()) 3314 while (root->parent())
3303 root = root->parent(); 3315 root = root->parent();
3304 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3316 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3305 } else { 3317 } else {
3306 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3318 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3307 } 3319 }
3308 } 3320 }
3309 3321
3310 #endif 3322 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698