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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2312823002: Added support for isInherited flags to ComputedStyleBase (Closed)
Patch Set: Rebase and a bit more cleanup work... Maybe needs a rethink Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 if (oldStyle->hasExplicitlyInheritedProperties()) 221 if (oldStyle->hasExplicitlyInheritedProperties())
222 return Inherit; 222 return Inherit;
223 223
224 return NoInherit; 224 return NoInherit;
225 } 225 }
226 226
227 // TODO(sashab): Generate this function. 227 // TODO(sashab): Generate this function.
228 void ComputedStyle::propagateIndependentInheritedProperties(const ComputedStyle& parentStyle) 228 void ComputedStyle::propagateIndependentInheritedProperties(const ComputedStyle& parentStyle)
229 { 229 {
230 ComputedStyleBase::propagateIndependentInheritedProperties(parentStyle);
230 if (m_nonInheritedData.m_isPointerEventsInherited) 231 if (m_nonInheritedData.m_isPointerEventsInherited)
231 setPointerEvents(parentStyle.pointerEvents()); 232 setPointerEvents(parentStyle.pointerEvents());
232 if (m_nonInheritedData.m_isVisibilityInherited)
233 setVisibility(parentStyle.visibility());
234 } 233 }
235 234
236 StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignmentData& value , ItemPosition normalValueBehavior) 235 StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignmentData& value , ItemPosition normalValueBehavior)
237 { 236 {
238 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto ' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it. 237 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto ' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it.
239 if (value.position() == ItemPositionNormal || value.position() == ItemPositi onAuto) 238 if (value.position() == ItemPositionNormal || value.position() == ItemPositi onAuto)
240 return {normalValueBehavior, OverflowAlignmentDefault}; 239 return {normalValueBehavior, OverflowAlignmentDefault};
241 return value; 240 return value;
242 } 241 }
243 242
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 m_rareInheritedData = inheritParent.m_rareInheritedData; 318 m_rareInheritedData = inheritParent.m_rareInheritedData;
320 } 319 }
321 m_styleInheritedData = inheritParent.m_styleInheritedData; 320 m_styleInheritedData = inheritParent.m_styleInheritedData;
322 m_inheritedData = inheritParent.m_inheritedData; 321 m_inheritedData = inheritParent.m_inheritedData;
323 if (m_svgStyle != inheritParent.m_svgStyle) 322 if (m_svgStyle != inheritParent.m_svgStyle)
324 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); 323 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get());
325 } 324 }
326 325
327 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) 326 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other)
328 { 327 {
328 ComputedStyleBase::copyNonInheritedFromCached(other);
329 m_box = other.m_box; 329 m_box = other.m_box;
330 m_visual = other.m_visual; 330 m_visual = other.m_visual;
331 m_background = other.m_background; 331 m_background = other.m_background;
332 m_surround = other.m_surround; 332 m_surround = other.m_surround;
333 m_rareNonInheritedData = other.m_rareNonInheritedData; 333 m_rareNonInheritedData = other.m_rareNonInheritedData;
334 334
335 // The flags are copied one-by-one because m_nonInheritedData.m_contains a b unch of stuff other than real style data. 335 // The flags are copied one-by-one because m_nonInheritedData.m_contains a b unch of stuff other than real style data.
336 // See comments for each skipped flag below. 336 // See comments for each skipped flag below.
337 m_nonInheritedData.m_effectiveDisplay = other.m_nonInheritedData.m_effective Display; 337 m_nonInheritedData.m_effectiveDisplay = other.m_nonInheritedData.m_effective Display;
338 m_nonInheritedData.m_originalDisplay = other.m_nonInheritedData.m_originalDi splay; 338 m_nonInheritedData.m_originalDisplay = other.m_nonInheritedData.m_originalDi splay;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // m_nonInheritedData.m_emptyState 380 // m_nonInheritedData.m_emptyState
381 // m_nonInheritedData.m_affectedByFocus 381 // m_nonInheritedData.m_affectedByFocus
382 // m_nonInheritedData.m_affectedByHover 382 // m_nonInheritedData.m_affectedByHover
383 // m_nonInheritedData.m_affectedByActive 383 // m_nonInheritedData.m_affectedByActive
384 // m_nonInheritedData.m_affectedByDrag 384 // m_nonInheritedData.m_affectedByDrag
385 // m_nonInheritedData.m_isLink 385 // m_nonInheritedData.m_isLink
386 386
387 // Any properties that are inherited on a style are also inherited on elemen ts 387 // Any properties that are inherited on a style are also inherited on elemen ts
388 // that share this style. 388 // that share this style.
389 m_nonInheritedData.m_isPointerEventsInherited = other.m_nonInheritedData.m_i sPointerEventsInherited; 389 m_nonInheritedData.m_isPointerEventsInherited = other.m_nonInheritedData.m_i sPointerEventsInherited;
390 m_nonInheritedData.m_isVisibilityInherited = other.m_nonInheritedData.m_isVi sibilityInherited;
391 390
392 if (m_svgStyle != other.m_svgStyle) 391 if (m_svgStyle != other.m_svgStyle)
393 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); 392 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get());
394 DCHECK_EQ(zoom(), initialZoom()); 393 DCHECK_EQ(zoom(), initialZoom());
395 } 394 }
396 395
397 bool ComputedStyle::operator==(const ComputedStyle& o) const 396 bool ComputedStyle::operator==(const ComputedStyle& o) const
398 { 397 {
399 return inheritedEqual(o) 398 return inheritedEqual(o)
400 && nonInheritedEqual(o); 399 && nonInheritedEqual(o);
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 if (value < 0) 2049 if (value < 0)
2051 fvalue -= 0.5f; 2050 fvalue -= 0.5f;
2052 else 2051 else
2053 fvalue += 0.5f; 2052 fvalue += 0.5f;
2054 } 2053 }
2055 2054
2056 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2055 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2057 } 2056 }
2058 2057
2059 } // namespace blink 2058 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698