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

Side by Side Diff: Source/core/dom/TreeScope.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: fix compile on mac Created 7 years 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/dom/TreeScope.h" 28 #include "core/dom/TreeScope.h"
29 29
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "core/dom/ContainerNode.h" 31 #include "core/dom/ContainerNode.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/IdTargetObserverRegistry.h" 35 #include "core/dom/IdTargetObserverRegistry.h"
36 #include "core/dom/NodeRenderStyle.h"
36 #include "core/dom/TreeScopeAdopter.h" 37 #include "core/dom/TreeScopeAdopter.h"
37 #include "core/dom/shadow/ElementShadow.h" 38 #include "core/dom/shadow/ElementShadow.h"
38 #include "core/dom/shadow/ShadowRoot.h" 39 #include "core/dom/shadow/ShadowRoot.h"
39 #include "core/events/EventPath.h" 40 #include "core/events/EventPath.h"
40 #include "core/html/HTMLAnchorElement.h" 41 #include "core/html/HTMLAnchorElement.h"
41 #include "core/html/HTMLFrameOwnerElement.h" 42 #include "core/html/HTMLFrameOwnerElement.h"
42 #include "core/html/HTMLLabelElement.h" 43 #include "core/html/HTMLLabelElement.h"
43 #include "core/html/HTMLMapElement.h" 44 #include "core/html/HTMLMapElement.h"
44 #include "core/page/DOMSelection.h" 45 #include "core/page/DOMSelection.h"
45 #include "core/page/FocusController.h" 46 #include "core/page/FocusController.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key)) 491 if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key))
491 result = element; 492 result = element;
492 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { 493 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
493 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) 494 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key))
494 result = shadowResult; 495 result = shadowResult;
495 } 496 }
496 } 497 }
497 return result; 498 return result;
498 } 499 }
499 500
501 void TreeScope::setNeedsStyleRecalcForViewportUnits()
502 {
503 for (Element* element = ElementTraversal::firstWithin(*rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) {
504 for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root ->olderShadowRoot())
505 root->setNeedsStyleRecalcForViewportUnits();
506 RenderStyle* style = element->renderStyle();
507 if (style && style->hasViewportUnits())
508 element->setNeedsStyleRecalc(LocalStyleChange);
509 }
510 }
511
500 } // namespace WebCore 512 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698