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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTableElement.cpp

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights
8 * reserved. 8 * reserved.
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 const QualifiedName& name) const { 379 const QualifiedName& name) const {
380 if (name == widthAttr || name == heightAttr || name == bgcolorAttr || 380 if (name == widthAttr || name == heightAttr || name == bgcolorAttr ||
381 name == backgroundAttr || name == valignAttr || name == vspaceAttr || 381 name == backgroundAttr || name == valignAttr || name == vspaceAttr ||
382 name == hspaceAttr || name == alignAttr || name == cellspacingAttr || 382 name == hspaceAttr || name == alignAttr || name == cellspacingAttr ||
383 name == borderAttr || name == bordercolorAttr || name == frameAttr || 383 name == borderAttr || name == bordercolorAttr || name == frameAttr ||
384 name == rulesAttr) 384 name == rulesAttr)
385 return true; 385 return true;
386 return HTMLElement::isPresentationAttribute(name); 386 return HTMLElement::isPresentationAttribute(name);
387 } 387 }
388 388
389 void HTMLTableElement::parseAttribute(const QualifiedName& name, 389 void HTMLTableElement::parseAttribute(
390 const AtomicString& oldValue, 390 const AttributeModificationParams& params) {
391 const AtomicString& value) { 391 const QualifiedName& name = params.name;
392 CellBorders bordersBefore = getCellBorders(); 392 CellBorders bordersBefore = getCellBorders();
393 unsigned short oldPadding = m_padding; 393 unsigned short oldPadding = m_padding;
394 394
395 if (name == borderAttr) { 395 if (name == borderAttr) {
396 // FIXME: This attribute is a mess. 396 // FIXME: This attribute is a mess.
397 m_borderAttr = parseBorderWidthAttribute(value); 397 m_borderAttr = parseBorderWidthAttribute(params.newValue);
398 } else if (name == bordercolorAttr) { 398 } else if (name == bordercolorAttr) {
399 m_borderColorAttr = !value.isEmpty(); 399 m_borderColorAttr = !params.newValue.isEmpty();
400 } else if (name == frameAttr) { 400 } else if (name == frameAttr) {
401 // FIXME: This attribute is a mess. 401 // FIXME: This attribute is a mess.
402 bool borderTop; 402 bool borderTop;
403 bool borderRight; 403 bool borderRight;
404 bool borderBottom; 404 bool borderBottom;
405 bool borderLeft; 405 bool borderLeft;
406 m_frameAttr = getBordersFromFrameAttributeValue( 406 m_frameAttr = getBordersFromFrameAttributeValue(
407 value, borderTop, borderRight, borderBottom, borderLeft); 407 params.newValue, borderTop, borderRight, borderBottom, borderLeft);
408 } else if (name == rulesAttr) { 408 } else if (name == rulesAttr) {
409 m_rulesAttr = UnsetRules; 409 m_rulesAttr = UnsetRules;
410 if (equalIgnoringCase(value, "none")) 410 if (equalIgnoringCase(params.newValue, "none"))
411 m_rulesAttr = NoneRules; 411 m_rulesAttr = NoneRules;
412 else if (equalIgnoringCase(value, "groups")) 412 else if (equalIgnoringCase(params.newValue, "groups"))
413 m_rulesAttr = GroupsRules; 413 m_rulesAttr = GroupsRules;
414 else if (equalIgnoringCase(value, "rows")) 414 else if (equalIgnoringCase(params.newValue, "rows"))
415 m_rulesAttr = RowsRules; 415 m_rulesAttr = RowsRules;
416 else if (equalIgnoringCase(value, "cols")) 416 else if (equalIgnoringCase(params.newValue, "cols"))
417 m_rulesAttr = ColsRules; 417 m_rulesAttr = ColsRules;
418 else if (equalIgnoringCase(value, "all")) 418 else if (equalIgnoringCase(params.newValue, "all"))
419 m_rulesAttr = AllRules; 419 m_rulesAttr = AllRules;
420 } else if (name == cellpaddingAttr) { 420 } else if (params.name == cellpaddingAttr) {
421 if (!value.isEmpty()) 421 if (!params.newValue.isEmpty())
422 m_padding = std::max(0, value.toInt()); 422 m_padding = std::max(0, params.newValue.toInt());
423 else 423 else
424 m_padding = 1; 424 m_padding = 1;
425 } else if (name == colsAttr) { 425 } else if (params.name == colsAttr) {
426 // ### 426 // ###
427 } else { 427 } else {
428 HTMLElement::parseAttribute(name, oldValue, value); 428 HTMLElement::parseAttribute(params);
429 } 429 }
430 430
431 if (bordersBefore != getCellBorders() || oldPadding != m_padding) { 431 if (bordersBefore != getCellBorders() || oldPadding != m_padding) {
432 m_sharedCellStyle = nullptr; 432 m_sharedCellStyle = nullptr;
433 setNeedsTableStyleRecalc(); 433 setNeedsTableStyleRecalc();
434 } 434 }
435 } 435 }
436 436
437 static StylePropertySet* createBorderStyle(CSSValueID value) { 437 static StylePropertySet* createBorderStyle(CSSValueID value) {
438 MutableStylePropertySet* style = 438 MutableStylePropertySet* style =
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 const AtomicString& HTMLTableElement::summary() const { 606 const AtomicString& HTMLTableElement::summary() const {
607 return getAttribute(summaryAttr); 607 return getAttribute(summaryAttr);
608 } 608 }
609 609
610 DEFINE_TRACE(HTMLTableElement) { 610 DEFINE_TRACE(HTMLTableElement) {
611 visitor->trace(m_sharedCellStyle); 611 visitor->trace(m_sharedCellStyle);
612 HTMLElement::trace(visitor); 612 HTMLElement::trace(visitor);
613 } 613 }
614 614
615 } // namespace blink 615 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTableElement.h ('k') | third_party/WebKit/Source/core/html/HTMLTextAreaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698