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

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: Address even more review comments Created 5 years, 6 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 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 while (object->parent() && !object->hasLayer()) 2285 while (object->parent() && !object->hasLayer())
2286 object = object->parent(); 2286 object = object->parent();
2287 if (object->hasLayer()) 2287 if (object->hasLayer())
2288 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer(); 2288 return toLayoutBoxModelObject(object)->layer()->root()->isRootLayer();
2289 return false; 2289 return false;
2290 } 2290 }
2291 2291
2292 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const 2292 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const
2293 { 2293 {
2294 // Respect the image's orientation if it's being used as a full-page image o r it's 2294 // Respect the image's orientation if it's being used as a full-page image o r it's
2295 // an <img> and the setting to respect it everywhere is set. 2295 // an <img> and image-orientation: from-image is set.
2296 return document().isImageDocument() 2296 // FIXME: crbug.com/498233
Noel Gordon 2015/06/19 07:41:25 // Respect the image's orientation if it's being u
rwlbuis 2015/06/19 16:03:15 Oh, missed this.... but it will be easy to fix.
Noel Gordon 2015/06/19 16:50:07 Ok, let's do it next round.
2297 || (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation; 2297 bool respectOrientation = false;
2298 if (document().isImageDocument()) {
2299 respectOrientation = true;
Noel Gordon 2015/06/19 07:41:25 nit: this code might read better of your preferred
rwlbuis 2015/06/19 16:03:15 Great suggestion, I think it looks much clearer, d
2300 } else if (isHTMLImageElement(node())) {
2301 if (document().settings() && document().settings()->shouldRespectImageOr ientation())
2302 respectOrientation = true;
2303 else if (style() && style()->respectImageOrientation() == RespectImageOr ientation)
2304 respectOrientation = true;
2305 }
2306
2307 return respectOrientation ? RespectImageOrientation : DoNotRespectImageOrien tation;
2298 } 2308 }
2299 2309
2300 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat ionContainer, bool* paintInvalidationContainerSkipped) const 2310 LayoutObject* LayoutObject::container(const LayoutBoxModelObject* paintInvalidat ionContainer, bool* paintInvalidationContainerSkipped) const
2301 { 2311 {
2302 if (paintInvalidationContainerSkipped) 2312 if (paintInvalidationContainerSkipped)
2303 *paintInvalidationContainerSkipped = false; 2313 *paintInvalidationContainerSkipped = false;
2304 2314
2305 // This method is extremely similar to containingBlock(), but with a few not able 2315 // This method is extremely similar to containingBlock(), but with a few not able
2306 // exceptions. 2316 // exceptions.
2307 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when 2317 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 const blink::LayoutObject* root = object1; 3280 const blink::LayoutObject* root = object1;
3271 while (root->parent()) 3281 while (root->parent())
3272 root = root->parent(); 3282 root = root->parent();
3273 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3283 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3274 } else { 3284 } else {
3275 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3285 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3276 } 3286 }
3277 } 3287 }
3278 3288
3279 #endif 3289 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698